diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 12:01:04 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 12:01:04 (GMT) |
commit | 198efeb27e5c2a87d0a2bb6859446cb1faf45ed8 (patch) | |
tree | e4c99e89cbecd2084a87a8c7a5d4877385fcec1c | |
parent | bb2e4df9bee3148e819c98410aa36e22dad95d7a (diff) | |
parent | e85867003ca1741f378b1f58f4dd9d48577a5d9b (diff) | |
download | Qt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.zip Qt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.tar.gz Qt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-animations
Conflicts:
src/gui/graphicsview/qgraphicsitem.cpp
971 files changed, 18765 insertions, 37275 deletions
diff --git a/.commit-template b/.commit-template new file mode 100644 index 0000000..589ca89 --- /dev/null +++ b/.commit-template @@ -0,0 +1,10 @@ +# ===[ Subject ]==========[ one line, please wrap at 72 characters ]===| + +# ---[ Details ]---------[ remember extra blank line after subject ]---| + +# ---[ Fields ]-----------------[ uncomment and edit as applicable ]---| + +#Task-number: +#Reviewed-by: + +# ==================================[ please wrap at 72 characters ]===| @@ -1,4 +1,4 @@ -This is a list of Frequently Asked Questions regarding Qt Release 4.5.0. +This is a list of Frequently Asked Questions regarding this Qt release. Q: I'm using a Unix system and I downloaded the Zip package. However, when I try to run the configure script, I get the following error message: diff --git a/LGPL_EXCEPTION.TXT b/LGPL_EXCEPTION.txt index 8d0f85e..8d0f85e 100644 --- a/LGPL_EXCEPTION.TXT +++ b/LGPL_EXCEPTION.txt diff --git a/config.tests/mac/defaultarch.test b/config.tests/mac/defaultarch.test new file mode 100755 index 0000000..4502af7 --- /dev/null +++ b/config.tests/mac/defaultarch.test @@ -0,0 +1,33 @@ +#!/bin/sh + +COMPILER=$1 +VERBOSE=$2 +WORKDIR=$3 +QT_MAC_DEFUALT_ARCH= + +touch defaultarch.c + +# compile something and run 'file' on it. +if "$COMPILER" -c defaultarch.c 2>/dev/null 1>&2; then + FIlE_OUTPUT=`file defaultarch.o` + [ "$VERBOSE" = "yes" ] && echo "'file' reports compiler ($COMPILER) default architechture as: $FIlE_OUTPUT" + +fi +rm -f defaultarch.c defaultarch.o + +# detect our known archs. +if echo "$FIlE_OUTPUT" | grep '\<i386\>' > /dev/null 2>&1; then + QT_MAC_DEFUALT_ARCH=x86 # configure knows it as "x86" not "i386" +fi +if echo "$FIlE_OUTPUT" | grep '\<x86_64\>' > /dev/null 2>&1; then + QT_MAC_DEFUALT_ARCH=x86_64 +fi +if echo "$FIlE_OUTPUT" | grep '\<ppc\>' > /dev/null 2>&1; then + QT_MAC_DEFUALT_ARCH=ppc +fi +if echo "$FIlE_OUTPUT" | grep '\<ppc64\>' > /dev/null 2>&1; then + QT_MAC_DEFUALT_ARCH=ppc64 +fi + +[ "$VERBOSE" = "yes" ] && echo "setting QT_MAC_DEFUALT_ARCH to \"$QT_MAC_DEFUALT_ARCH\"" +export QT_MAC_DEFUALT_ARCH diff --git a/config.tests/unix/opengles1/opengles1.pro b/config.tests/unix/opengles1/opengles1.pro index d800a5d..ad8dd31 100644 --- a/config.tests/unix/opengles1/opengles1.pro +++ b/config.tests/unix/opengles1/opengles1.pro @@ -6,4 +6,4 @@ for(p, QMAKE_LIBDIR_OPENGL) { } CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL +LIBS += $$QMAKE_LIBS_OPENGL_QT diff --git a/config.tests/unix/opengles1cl/opengles1cl.pro b/config.tests/unix/opengles1cl/opengles1cl.pro index c9addf9..415cdbb 100644 --- a/config.tests/unix/opengles1cl/opengles1cl.pro +++ b/config.tests/unix/opengles1cl/opengles1cl.pro @@ -6,4 +6,4 @@ for(p, QMAKE_LIBDIR_OPENGL) { } CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL +LIBS += $$QMAKE_LIBS_OPENGL_QT diff --git a/config.tests/unix/opengles2/opengles2.pro b/config.tests/unix/opengles2/opengles2.pro index 13f95a1..0dfae42 100644 --- a/config.tests/unix/opengles2/opengles2.pro +++ b/config.tests/unix/opengles2/opengles2.pro @@ -6,4 +6,4 @@ for(p, QMAKE_LIBDIR_OPENGL) { } CONFIG -= qt -LIBS += $$QMAKE_LIBS_OPENGL +LIBS += $$QMAKE_LIBS_OPENGL_QT diff --git a/config.tests/x11/xlib/xlib.cpp b/config.tests/x11/xlib/xlib.cpp new file mode 100644 index 0000000..8d25bf5 --- /dev/null +++ b/config.tests/x11/xlib/xlib.cpp @@ -0,0 +1,9 @@ +#include <X11/Xlib.h> + +int main(int, char **) +{ + Display *d = XOpenDisplay(NULL); + XCloseDisplay(d); + return 0; +} + diff --git a/config.tests/x11/xlib/xlib.pro b/config.tests/x11/xlib/xlib.pro new file mode 100644 index 0000000..658161e --- /dev/null +++ b/config.tests/x11/xlib/xlib.pro @@ -0,0 +1,3 @@ +CONFIG += x11 +CONFIG -= qt +SOURCES = xlib.cpp @@ -119,7 +119,13 @@ elif [ -f "$relpath"/src/gui/kernel/qapplication_qws.cpp ]; then # ~ src/gui/base/qapplication_qws.cpp is present # ~ this is the free or commercial edition # ~ this is the internal edition and Qt Embedded is explicitly enabled - PLATFORM_QWS=maybe + if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ]; then + # This is a depot build, or an all-platforms package + PLATFORM_QWS=maybe + else + # This must be the embedded package, since the Qt/Mac source files are not present + PLATFORM_QWS=yes + fi fi #----------------------------------------------------------------------------- @@ -199,10 +205,10 @@ earlyArgParse() h|help|--help|-help) if [ "$VAL" = "yes" ]; then OPT_HELP="$VAL" - COMMERCIAL_USER="yes" #doesn't matter we will display the help + COMMERCIAL_USER="no" #doesn't matter we will display the help else UNKNOWN_OPT=yes - COMMERCIAL_USER="yes" #doesn't matter we will display the help + COMMERCIAL_USER="no" #doesn't matter we will display the help fi ;; --*) @@ -518,9 +524,14 @@ fi SYSTEM_VARIABLES="CC CXX CFLAGS CXXFLAGS LDFLAGS" for varname in $SYSTEM_VARIABLES; do + qmakevarname="${varname}" + # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS + if [ "${varname}" = "LDFLAGS" ]; then + qmakevarname="LFLAGS" + fi cmd=`echo \ 'if [ -n "\$'${varname}'" ]; then - QMakeVar set QMAKE_'${varname}' "\$'${varname}'" + QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'" fi'` eval "$cmd" done @@ -2090,7 +2101,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then fi # symlink files from src/gui/embedded neccessary to build qvfb -if [ "$CFG_DEV" = "yes" -o "$Edition" = "Qtopia" ]; then +if [ "$CFG_DEV" = "yes" ]; then for f in qvfbhdr.h qlock_p.h qlock.cpp qwssignalhandler_p.h qwssignalhandler.cpp; do dest="${relpath}/tools/qvfb/${f}" rm -f "$dest" @@ -2687,6 +2698,21 @@ if [ "$QT_CROSS_COMPILE" = "yes" ]; then fi fi +# check -arch arguments for validity. +if [ "$PLATFORM_MAC" = "yes" ]; then + ALLOWED="x86 ppc x86_64 ppc64 i386" + for i in $CFG_MAC_ARCHS + do + if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then + echo "Unknown architecture: \"$i\". Supported architectures: x86[i386] ppc x86_64 ppc64"; + exit 2; + fi + done + +# replace "i386" with "x86" to support configuring with -arch i386 as an alias for x86. + CFG_MAC_ARCHS="${CFG_MAC_ARCHS/i386/x86}" +fi + # find the default framework value if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then if [ "$CFG_FRAMEWORK" = "auto" ]; then @@ -3654,39 +3680,7 @@ echo echo "This is the $Platform ${EditionString} Edition." echo -if [ "$Edition" = "Qtopia" ]; then - TheLicense=`head -n 1 "$relpath/LICENSE.Qtopia"` - while true; do - if [ "$OPT_CONFIRM_LICENSE" = "yes" -o "$CFG_NOKIA" = "yes" ]; then - echo "You have already accepted the terms of the $TheLicense license." - acceptance=yes - else - echo "You are licensed to use this software under the terms of" - echo "the $TheLicense" - echo - echo "Type '?' to read the $TheLicense" - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Do you accept the terms of the license? " - else - echo "Do you accept the terms of the license? \c" - fi - read acceptance - fi - echo - if [ "$acceptance" = "yes" ]; then - break - elif [ "$acceptance" = "no" ] ;then - echo "You are not licensed to use this software." - echo - exit 0 - elif [ "$acceptance" = "?" ]; then - more "$relpath/LICENSE.Qtopia" - fi - done -elif [ "$Edition" = "NokiaInternalBuild" ]; then +if [ "$Edition" = "NokiaInternalBuild" ]; then echo "Detected -nokia-developer option" echo "Nokia employees and agents are allowed to use this software under" echo "the authority of Nokia Corporation and/or its subsidiary(-ies)" @@ -4742,6 +4736,14 @@ if [ "$PLATFORM_X11" = "yes" ]; then X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive" fi + # Check we actually have X11 :-) + if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + echo "Basic XLib functionality test failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}." + exit 1 + fi + # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es1cl = ES 1.x common lite, es2 = OpenGL ES 2.x) if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then @@ -5503,6 +5505,22 @@ if [ "$CFG_MAC_DWARF2" = "yes" ]; then QT_CONFIG="$QT_CONFIG dwarf2" fi +# Set the default arch. Select 32-bit/carbon if nothing else has +# been specified on the configure line. +if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_ARCHS" == "" ]; then + source "$mactests/defaultarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" + + if [ "$QT_MAC_DEFUALT_ARCH" == "x86_64" ]; then + CFG_MAC_ARCHS=" x86" + elif [ "$QT_MAC_DEFUALT_ARCH" == "ppc64" ]; then + CFG_MAC_ARCHS=" ppc" + else + CFG_MAC_ARCHS=" $QT_MAC_DEFUALT_ARCH" + fi + + [ "$OPT_VERBOSE" == "yes" ] && echo "Setting Mac architechture to$CFG_MAC_ARCHS." +fi + # enable cocoa and/or carbon on Mac if [ "$CFG_MAC_COCOA" = "yes" ]; then # -cocoa on the command line disables carbon completely (i.e. use cocoa for 32-bit as well) @@ -6173,13 +6191,31 @@ rm -f .options BUILD_OPTIONS="$BUILD_CONFIG $BUILD_OPTIONS" # extract the operating system from the XPLATFORM TARGET_OPERATING_SYSTEM=`echo $XPLATFORM | cut -f 2- -d/ | cut -f -1 -d-` + # when cross-compiling, don't include build-host information (build key is target specific) QT_BUILD_KEY="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS" +if [ -n "$QT_NAMESPACE" ]; then + QT_BUILD_KEY="$QT_BUILD_KEY $QT_NAMESPACE" +fi +MAC_NEED_TWO_BUILD_KEYS="no" +if [ "$PLATFORM_MAC" = "yes" -a "$CFG_MAC_COCOA" = "yes" ]; then + QT_BUILD_KEY_CARBON=$QT_BUILD_KEY + TARGET_OPERATING_SYSTEM="$TARGET_OPERATING_SYSTEM-cocoa" + QT_BUILD_KEY_COCOA="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPILER $BUILD_OPTIONS" + if [ "$CFG_MAC_CARBON" = "no" ]; then + QT_BUILD_KEY=$QT_BUILD_KEY_COCOA + else + MAC_NEED_TWO_BUILD_KEYS="yes" + fi +fi # don't break loading plugins build with an older version of Qt QT_BUILD_KEY_COMPAT= if [ "$QT_CROSS_COMPILE" = "no" ]; then # previous versions of Qt used a build key built from the uname QT_BUILD_KEY_COMPAT="$CFG_USER_BUILD_KEY $UNAME_MACHINE $UNAME_SYSTEM $COMPILER $BUILD_OPTIONS" + if [ -n "$QT_NAMESPACE" ]; then + QT_BUILD_KEY_COMPAT="$QT_BUILD_KEY_COMPAT $QT_NAMESPACE" + fi fi # strip out leading/trailing/extra whitespace QT_BUILD_KEY=`echo $QT_BUILD_KEY | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` @@ -6200,6 +6236,7 @@ full) echo "#endif" >>"$tmpconfig" ;; esac + cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF /* Qt Edition */ @@ -6210,9 +6247,19 @@ cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF /* Machine byte-order */ #define Q_BIG_ENDIAN 4321 #define Q_LITTLE_ENDIAN 1234 +EOF -#define QT_BUILD_KEY "$QT_BUILD_KEY" +if [ "$MAC_NEED_TWO_BUILD_KEYS" = "no" ]; then + echo "#define QT_BUILD_KEY \"$QT_BUILD_KEY\"" \ + >> "$outpath/src/corelib/global/qconfig.h.new" +else + cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF + +#define QT_BUILD_KEY_CARBON "$QT_BUILD_KEY_CARBON" +#define QT_BUILD_KEY_COCOA "$QT_BUILD_KEY_COCOA" EOF +fi + if [ -n "$QT_BUILD_KEY_COMPAT" ]; then echo "#define QT_BUILD_KEY_COMPAT \"$QT_BUILD_KEY_COMPAT\"" \ >> "$outpath/src/corelib/global/qconfig.h.new" diff --git a/configure.exe b/configure.exe Binary files differindex 54e8a60..ff71f08 100644 --- a/configure.exe +++ b/configure.exe diff --git a/demos/embeddeddialogs/customproxy.cpp b/demos/embeddeddialogs/customproxy.cpp index ed2fc76..dd8766f 100644 --- a/demos/embeddeddialogs/customproxy.cpp +++ b/demos/embeddeddialogs/customproxy.cpp @@ -44,7 +44,7 @@ #include <QtGui> CustomProxy::CustomProxy(QGraphicsItem *parent, Qt::WindowFlags wFlags) - : QGraphicsProxyWidget(parent, wFlags), popupShown(false) + : QGraphicsProxyWidget(parent, wFlags), popupShown(false), currentPopup(0) { timeLine = new QTimeLine(250, this); connect(timeLine, SIGNAL(valueChanged(qreal)), @@ -112,13 +112,17 @@ bool CustomProxy::sceneEventFilter(QGraphicsItem *watched, QEvent *event) QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &value) { if (change == ItemChildAddedChange || change == ItemChildRemovedChange) { - QGraphicsItem *item = qVariantValue<QGraphicsItem *>(value); if (change == ItemChildAddedChange) { - item->setCacheMode(ItemCoordinateCache); - item->installSceneEventFilter(this); - } else { - item->removeSceneEventFilter(this); + currentPopup = qVariantValue<QGraphicsItem *>(value); + currentPopup->setCacheMode(ItemCoordinateCache); + if (scene()) + currentPopup->installSceneEventFilter(this); + } else if (scene()) { + currentPopup->removeSceneEventFilter(this); + currentPopup = 0; } + } else if (currentPopup && change == ItemSceneHasChanged) { + currentPopup->installSceneEventFilter(this); } return QGraphicsProxyWidget::itemChange(change, value); } diff --git a/demos/embeddeddialogs/customproxy.h b/demos/embeddeddialogs/customproxy.h index 0a5fbaf..d324426 100644 --- a/demos/embeddeddialogs/customproxy.h +++ b/demos/embeddeddialogs/customproxy.h @@ -70,6 +70,7 @@ private slots: private: QTimeLine *timeLine; bool popupShown; + QGraphicsItem *currentPopup; }; #endif diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp index 18343cb..41bbfb3 100644 --- a/demos/qtdemo/colors.cpp +++ b/demos/qtdemo/colors.cpp @@ -278,6 +278,9 @@ void Colors::parseArgs(int argc, char *argv[]) + "[-low] [-ticker-letters<int>] [-ticker-speed<float>] [-no-ticker-morph] " + "[-ticker-morph-speed<float>] [-ticker-text<string>]"); exit(0); + } else{ + QMessageBox::warning(0, "QtDemo", QString("Unrecognized argument:\n") + s); + exit(0); } } diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp index bfa2e3f..a9e9b4b 100644 --- a/demos/qtdemo/menumanager.cpp +++ b/demos/qtdemo/menumanager.cpp @@ -184,7 +184,6 @@ void MenuManager::itemSelected(int userCode, const QString &menuName) this->tickerInAnim->startDelay = 2000; this->ticker->useGuideQt(); this->score->queueMovie("ticker", Score::NEW_ANIMATION_ONLY); - this->window->switchTimerOnOff(true); } break; case MENU1: @@ -220,7 +219,6 @@ void MenuManager::itemSelected(int userCode, const QString &menuName) this->score->queueMovie(this->currentInfo + " -buttons", Score::NEW_ANIMATION_ONLY); if (!Colors::noTicker){ this->score->queueMovie("ticker -out", Score::NEW_ANIMATION_ONLY); - this->window->switchTimerOnOff(false); } break; case UP:{ @@ -257,7 +255,6 @@ void MenuManager::itemSelected(int userCode, const QString &menuName) this->ticker->doIntroTransitions = false; this->tickerInAnim->startDelay = 500; this->score->queueMovie("ticker", Score::NEW_ANIMATION_ONLY); - this->window->switchTimerOnOff(true); } } else if (this->currentMenuCode != ROOT) itemSelected(ROOT, Colors::rootMenuName); diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml index df2d93b..03b59f3 100644 --- a/demos/qtdemo/xml/examples.xml +++ b/demos/qtdemo/xml/examples.xml @@ -137,6 +137,7 @@ <example filename="fontsampler" name="Font Sampler" /> <example filename="imagecomposition" name="Image Composition" /> <example filename="painterpaths" name="Painter Paths" /> + <example filename="svggenerator" name="SVG Generator" /> <example filename="svgviewer" name="SVG Viewer" /> <example filename="transformations" name="Transformations" /> </category> diff --git a/dist/README b/dist/README index 110be1c..38b3a1c 100644 --- a/dist/README +++ b/dist/README @@ -114,7 +114,7 @@ HOW TO REPORT A BUG If you think you have found a bug in Qt, we would like to hear about it so that we can fix it. Before reporting a bug, please check http://qtsoftware.com/developer/faqs/ and -http://qtsoftware.com/products/appdev/platform/platforms/ to see if the to see if +http://qtsoftware.com/products/appdev/platform/platforms/ to see if the issue is already known. Always include the following information in your bug report: the name diff --git a/dist/changes-4.5.1 b/dist/changes-4.5.1 new file mode 100644 index 0000000..c9e689f --- /dev/null +++ b/dist/changes-4.5.1 @@ -0,0 +1,574 @@ +Qt 4.5.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 4.5.0. For more details, +refer to the online documentation included in this distribution. The +documentation is also available online: + + http://doc.trolltech.com/4.5 + +The Qt version 4.5 series is binary compatible with the 4.4.x series. +Applications compiled for 4.4 will continue to run with 4.5. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Task Tracker: + + http://www.qtsoftware.com/developer/task-tracker + +Each of these identifiers can be entered in the task tracker to obtain more +information about a particular change. + +**************************************************************************** +* General * +**************************************************************************** + +General Improvements +-------------------- + +- Documentation and Examples + * Added printing feature for the Spreadsheet demo. + * [245675] Clarified the differences between QItemDelegate and + QStyledItemDelegate. + * [248752] Marked QPrintDialog::printer(), setPrinter() and addButton() + as Unix only functions, part of Qt3Support. + +- Embedded Dialogs demo + * [246517] Fixed warnings and bugs in hover handling on Mac OS X + + +Optimizations +------------- + +- Graphics View Framework has been optimized in several areas + * Improved the performance of QGraphicsItem::clipPath(). + * Improved the performance of QGraphicsItem::setPos(). + * Improved the performance of QGraphicsItem::effectiveOpacity(). + * Improved the performance of QGrahicsScene::items(*). + * Improved handling of updates. + * Reduced the number of floating point operations. + * Reduced QVariant overhead. + +Third party components +---------------------- + + +**************************************************************************** +* Library * +**************************************************************************** + +- QAbstractItemModel + * Clarified some warning messages printed if the model is invalid. + +- QAbstractEventDispatcher + * [248805] Duplicate timerids could occur if a timer is running while the + QObject is moved to another thread, stopping timers from working. + +- QAbstractSocket + * [192037] Emit the disconnected signal only if we were connected before. + +- QAccessible + * [221731] Fixed a bug where the accessibility plugin could crash if + there was an "&" at the end or spin forever if a label had a sequence of + "&&". + * [241161] Fixed a bug in browsing menus with the keyboard. + +- QAtomicInt + * [216492] Fixed compilation on 64-bit PowerPC machines with gcc 4.3. + +- QAuthenticator + * [237979] Fixed implementation of md5-sess. + +- QByteArray + * [246233] QByteArray::fromHex() fails with input of size 1. + +- QColorDialog + * [247349] Fixed a bug causing the wrong alpha value to be returned. + +- QCombobox + * [248094] Fixed scrollbar from appearing when not required. + +- QCompleter + * [246056] Fixed an assertion failure in setCompletionPrefix(). + * [250064] Fixed a regression in focus policy propagation. + +- QtConcurrent + * [244718] Reduced the number of calls to QThread::idealThreadCount(). + +- QDirIterator + * [247645] Fixed a bug that may loose all cached data inside QFileInfo. + +- QFile + * [244485] Renaming a file does not change QFile::fileName(). + * [244500] QFile::rename() does not always return false when the method + fails + +- QFileInfo + * [205244] Return valid file info also for relative UNC paths. + +- QFileDialog + * [221323] Fixed a bug in QFileDialog's programmatical file selection. + * [248332] QFileDialog is slow after visiting a large directory. + * [250194] Fixed an issue with QFileDialog and QSortFilterProxyModel + index mapping. + +- QGLFramebufferObject + * Framebuffer object extension resolution now works with OpenGL/ES 2.0. + +- QGraphicsItem + * Fixed a slow down regression in QGraphicsItem::ItemCoordinateCache. + * [247890] Cached QGraphicsItems are not updated if update() is called + when they are hidden. + * [250272] Fixed a crash that could occur when an item is deleted but + it does not get removed from the sceneeventfilters. + +- QGraphicsGridLayout + * [242472] Fixed a bug where the calculation of the maximum width of a + column was incorrect. + +- QGraphicsScene + * [243707] Fixed a crash when adding a child before a parent to the + scene. + +- QGraphicsView + * [245766] Rubber Band drag mode does not update correctly when + scrolling. + +- QGraphicsWidget + * [246215] Fixed a regression where we could cache the wrong size hint + because we called the virtual sizeHint() from the constructor. + +- QHttp + * Compile fixes for QT_BEGIN_NAMESPACE being in the wrong place in some + private headers. + * [208445] Cancel request upon receiving unknown authentication method. + +- QHostAddress + * [247330] Fixed compilation on MinGW by adding a missing QPair include. + +- QLocalSocket + * Fixed a bug that would cause QLocalSocket to disconnect 30 seconds + after a succesful delayed connection on UNIX. + +- QMacStyle + * Adjusted the opacity value for popups. + * [248769] Fixed a regression where QMacStyle would only draw tabs when + passed a QStyleOptionTabV3. + +- QMainWindow + * [248048] Fixed a regression that would cause tooltips to disappear when + using the unified toolbar. + +- QMetaType + * [248890] The detailed description of QMetaType no longer contradicts + the documentation of QMetaType::type() + +- QMutex + * Fixed a performance regression for contended mutexes as reported on the + qt4-preview-feedback list. + +- QPainter + * Compile fixes for OpenGL paint engine on OpenGL/ES 1.1 CommonLite and + OpenGL/ES 1.0. + * [246573] Fixed a very slow stroking of paths in the X11 paint engine. + * [247083] Fixed the scale applied to antialiased cosmetic pens in X11 + paint engine. + * [247492] Fixed a rendering bug in the raster paint engine causing + * [247505] Fixed missing fills of rectangles with negative width/height + in raster paint engine. + one-pixel offset when drawing premultiplied ARGB32 images on RGB16 + images. + * [249490] Fixed one-pixel offset between stroke and fills of ellipses in + the X11 paint engine. + * [249628] Fixed a crash in OpenGL paint engine when filling using + Qt::NoBrush. + + +- QPixmap + * [249175] Fixed QPixmap::fromImage() of monochrome images to result in + black/white pixels and not transparent/white pixels. + +- QProcess + * [247865] Fixed a crash when calling QProcess::start() and + startDetached() with an empty program string. + +- QScrollBar + * [247985] Stylesheet: added the feature to style scrollbar menus. + +- QSharedPointer + * [246843] Fixed a crash caused by using QSharedPointer in global statics. + +- QSortFilterProxyModel + * [247867] Properly sort when calling appendRows(). + * [248868] Re-sort when the model is reset if dynamicSort is enabled. + * [248868] Fixed QSortFilterProxyModel::sort() if dynamicSort was disabled. + +- QSSlSocket + * [245668] Set also protocol, verifyMode and verifyDepth in + setSslConfiguration(). + +- QString + * [249517] Fixed a regression in replace(int, int, QChar) when the string + is empty. + +- QStyleSheetStyle + * Improved support for setting background and foreground roles in styles + such as the text color in a combo box popup on Mac and Cleanlooks, or + the background of QScrollBar. + * Fixed a crash that occured while styling the title bar of a QMdiArea. + * [188195] Fixed the background of QAbstractScrollArea losing its color + if styled with pseudo-class. + * [246542] Fixed a bug in QToolButton::hover{ color:.... }. + +- QThread + * [249997] Added documentation indicating that the priority set by the + programmer may be ignored, for example on Linux. + +- QTreeView + * Fixed a crash that may occur when events are processed immediately + after a QSortFilterProxyModel is invalidated. + * [246025] Fixed auto-expand that occured when quickly collapsing an item + after clicking on a child. + * [248163] Fixed a possible crash in the paintEvent() when spans are used. + * [248805] Calling QTreeView::sortByColumn() programmatically was not + working if manual sorting was disabled. + +- QWidget + * [250388] Fixed a potential crash in QWidget::scroll() when using the + raster graphics system. + +- QWidget + * [246852] Improved handling of WindowMaximizeButtonHint for widgets with + layouts. + +-QLocale + * String-to-number conversion functions will now ignore trailing and + leading whitespaces in all locales as documented. + +- QWizard + * [248107] Fixed a bug on Windows Vista causing the Back button to + connect to the back() signal twice. + +- Q3ListView + * [248689] Fixed a bug in Q3ListView that would not update under certain + conditions. + +- QtWebKit + * Fixed a bug in cookie handling (WebKit Bugzilla 24062, Benjamin Meyer). + * Fixed a bug in calling from JavaScript into NPAPI plugins on Windows. + * Fixed the updating state of WebActions (Erik Bunce) + * Fixed a bug in HTML 5 Canvas clearRect() (Dirk Schulze) + * Fixed the theming of text fields with KDE 4 Oxygen style (Zack Rusin) + * Fixed path fill styles (Zack Rusin) + * Fixed pre-edit text handling with input methods. + * [248643] Fixed compiling with the "-pedantic" compile option. + +- QSqlTableModel + * Made setTable() try and use the database's letter case (uppercase/ + lowercase) of the given tablename. + * [189093] QSqlTableModel did not handle updates when one of the fields + had a NULL value. + +**************************************************************************** +* Database Drivers * +**************************************************************************** + + * Fixed the DB2 driver returning a double field as empty. + * Fixed a memory leak in the DB2 driver. + * Fixed the DB2 driver not quoting table/field names properly. + * Fixed an issue with ODBC & FreeTDS not accepting quotes in statements. + * Fixed a bug in the sqlite2 driver not returning false on failing to + execute a statement. + * PrecisionPolicy now works in the oracle driver. + * Fixed a bug in the ODBC driver returning a list of tables when + requested. + * Fixed Interbase retrieving scale/precision information on numeric/ + decimal fields. + * Stopped drivers from quoting again when escapeIdentifier is called + twice. + * Fixed a bug in the sqlite2 driver not quoting fields correctly. + * [232769] Fixed a memory overflow issue on bound out strings in ODBC + Driver + * [249059] Fixed a bug that handled QPSQL datetime/time fields with + negative timezone offsets incorrectly. + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Qt for Linux/X11 +---------------- + + * Ensured proper resetting for input contexts when switching between + multiple input context plugins. + * Input methods preedit strings are now reset properly when user switches + focus without commiting a string. + * Unicode conversion functions will handle Latin-1 character set only if + they are used before a QCoreApplication/QApplication is constructed. + * Improved handling of failed unicode conversion. + * Fixed clipboard handling when the user manually creates an instance of + the QDesktopWidget. + * [226048] Ensured that the QDesktopWidget::resized() signal is emitted + properly when a new screen appears or the screen geometry is changed + without affecting the whole desktop's geometry. + * [232632] Fixed a bug in reparenting widgets to a difference X11 screen. + * [241888] The background of the drag-n-drop cursor is now respected, + according to the stylesheet. + * [244337] Improved input method handling when a widget's native window + id is recreated. + * [244607] Current focus widget is properly set and input method is + properly initialized when showing a toplevel widget that accepts + keyboard input. + +- Phonon/GStreamer + * [233188] Fixed a problem where the seek slider reset to 0 while being + dragged. + * [244259] Fixed a problem where the backend failed to indicate an error + when the streaming failed. + * [246097] Added support for the MediaController interface to allow audio + CD playback. + * [246189] Fixed a problem where the backend failed to correctly escape + certain file names casuing playback to not start. + + +- QGtkStyle + * The system palette is no longer strictly forced. Also improved behavior + related to system theme changes. + * Fixed palette and styling issues with the background color of combo box + popups. + * [238196] Allowed middle click to set scrollbar position, following GTK+ + behavior. + * [239829] Disabled alt-key navigation for QGtkStyle following GTK+ + behavior. + * [247653] Fixed a compilation issue on Solaris. + * [249363] QFrame is now styled as a GtkScrolledWindow. + +- Font rendering + * Improved performance of subpixel antialiased text rendering by using a + mask in the calls to XRender's text compositing function. + * [248387] Properly respect the font config LCD filter settings for + subpixel antialiased text rendering when Freetype's native subpixel + rendering is disabled. + * [248498] Fix garbled rendering of subpixel antialiased text when using + Freetype's native subpixel rendering for vertical subpixel layouts. + * [248644] Fall back to Qt's subpixel rendering if Freetype's subpixel + rendering was available at compile-time but not at run-time. + +- QEventDispatcherGlib + * Event posted to a thread before it is started are not processed until + others events are posted. + +- QWidget + * [213512] Fixed a bug that caused wrong clipping when using the + Qt::WA_PaintOutsidePaintEvent attribute. + + +Qt for Windows +-------------- + + * [240891] Corrected the focus behavior of native file dialogs, when an + application has multiple toplevel widgets. + * [243583] Improved drag-and-drop handling when switching mouse buttons + quickly. + * [244875] The system menu will now be shown for a fullscreen window. + * [245330] Fixed a bug that caused mouse inputs to be ignored on modal + dialogs, when shown from an ActiveQt control. + * [249576] Fixed a crash when using a combobox with Qt::NoFocus. + + +- QCoreApplication + * [247401] Fixed a bug that caused a restarted timer to fire too early, + resulting in QtWebKit's Javascript consuming 100% CPU on Windows. +- QWindowsXPStyle + * [248036] Fixed an issue where tool buttons were hovering incorrectly + when disabled. + +- QWidget + * [248391] Fixed a bug that made it impossible to dynamically switch from + QPainter-based graphics to native graphics API and back. + + +Qt for Mac OS X +--------------- + + * Fixed a crash when showing a widget that is a modal window but has no + parent. + * Added QSysInfo::MV_10_6 as an enum to test against. + * Various compile fixes for the preliminary supported Snow Leopard. + * The uninstall-qt.py script included in the binary package no longer + complains about removing itself multiple times. +- * Improved the documentation for how qt_mac_set_dock_menu() works. + * Fixed an issue with the focus frame's transparency as it was difficult + to use the QWidget with stylesheets. + * [223525] Fixed a crash in the MacMainWindow Demo. + * [248803] Ensured that two dialogs shown at the same time will both not + have visible default buttons. + +- QDesktopWidget + * [244004] Properly support multiple screens with different sizes. + +- QDialog + * [195904] Parent dialog is displayed on top of its modal child. + * [218980] Modeless dialogs should be stacked above normal windows. + * [239155] QDialog(foo, Qt::Sheet) with QComboBox has non-native + behavior. + +- QFileDialog + * [219844] Fixed a crash caused by QFileDialog::getOpenFileName()'s + search buttons (native version). + * [225705] QFileDialog::getSaveFileName()'s filter does not display + correctly. + +- QMenu + * [228017] Ensured that QMenu closes when expanding a system menu. + +- QTestLib + * Activate the test application when launched from the command line. + +- Event system + * [210912] Fixed a bug where ShowEvent not sent when reshowing a window + after it was minimized. + +- macdeployqt + * The binary packages now include this tool. + * macdeployqt now runs 'strip' on the deployed binaries. + * Fixed an issue that prevented the QtSvg module from being deployed. + +- configure script + * Now supports "-arch i386" as an alias for "-arch x86". + * Detects invalid arch arguemnts and exits. + +- Cocoa port + * Fixed a bug where actions in the native menubar were not disabled + properly. + * Made shortcuts work properly when using the Dvorak-QWERTY+CMD keyboard + layout. + * Fixed a bug where dialogs were positioned in the wrong place on the + screen. + * The build-key for Cocoa was changed in the unlikely case that a plugin + may make assumptions on how Qt was built. All Cocoa plugins built + against Qt 4.5.0 will NOT work with Qt 4.5.1; we do not foresee + changing this again. + * Fixed a bug where some windows did not get activation when they + normally should. + * Fixed a bug where key events sent to popups were not propagated + onwards. + * QFileOpenEvents will no longer be sent for items passed via command + line. + * Various fixes for determining the metrics of text and the ability to + disable kerning. + * Modified the Colliding Mice Example to work better with coalesced + updates. + * Fixed a bug where the drag cursor was not updated when modifier keys + were used. + * [239043] Fixed a bug that caused QGraphicsProxyWidget to shrink when + moved. + * [244369] Window flags on Cocoa windows should look similar to the + Carbon ones. + * [247947] Fixed a crash in drag and drop. + * [248918] Fixed color matching for themed text items. + * The command + h shortcut is now enabled. (Hides the current window.) + * [249296] Fixed a bug where line edits on a second page of a stack + widget were not getting key events. + +Qt for Embedded Linux +--------------------- + +- * Various improvements to the Qt DirectFB plugin. + * Fixed recreation of temporary EGL surfaces in the PowerVR QScreen + driver. +- * Document some necessary #define's for building the PowerVR QScreen + driver. + +Qt for Windows CE +----------------- + + * [246619] Fixed a tap and hold bug for QCheckbox. + +**************************************************************************** +* Compiler Specific Changes * +**************************************************************************** + + +**************************************************************************** +* Tools * +**************************************************************************** + +- Build System + +- Assistant + + +- Designer + * [245503] Fixed redundant backslashes in string property in the property + browser. + * [245961] Restricted objectname-validation to known object name + properties only. + * [247995] Fixed a crash occurring after layout operations that caused + an instance of QGridLayout or QFormLayout to shrink. + * [248000] Fixed a crash ocurring when re-layouting empty grid layouts. + * [249097] Fixed a crash related to undoing a QGridLayout re-layout + operation. + +- Linguist + + - Linguist GUI + + * [248076] Fixed a crash caused by opening files for which we have no + plural rules. + * [249519] Fixed a crash upon dropping text into a non-focused line + edit. + + - Entire Linguist toolchain + + * [244035] Fixed an infinite loop in PO writer. + * [247738] Improved handling of duplicated messages. + * [248849] Fixed the encoding in XLIFF writer. + * [249022] Fixed TS' and QM's handling of messages which appear in + multiple encodings. + + - lupdate + + * [248724] Fixed the encoding of messages from .ui files if CODECFORTR + is not utf8. + * [249633] Fixed the processing of C++ backslash line continuations. + +- rcc + + +- moc + * [240368] moc parsing issue with "unsigned" subphrase + +- uic + * [244998] Fixed include file generation for phonon widgets. + * [248070] Fixed code generation for QStringList-type properties to use + encoding properly. + * [242447] Made uic generate class-specific code correctly in the case of + multiple levels of inheritance. + +- uic3 + + +- qmake + * On Mac OS, properly escape file names in QMAKE_BUNDLE_DATA. + * Fixed moc and uic features to make shadow builds work even if a + non-shadow build is present + * [201495] Comment processing in qmake prevented file from being moc'ed + * [248806] Ensured that the Xcode generator includes the right path to + frameworks. + +- configure + + +- qtconfig + + +- qt3to4 + + +**************************************************************************** +* Plugins * +**************************************************************************** + + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + diff --git a/doc/src/custom-types.qdoc b/doc/src/custom-types.qdoc index bf5340e..81eecfc 100644 --- a/doc/src/custom-types.qdoc +++ b/doc/src/custom-types.qdoc @@ -56,9 +56,123 @@ Standard types such as QSize, QColor and QString can all be stored in QVariant objects, used as the types of properties in QObject-based classes, and emitted in signal-slot communication. + In this document, we take a custom type and describe how to integrate it into Qt's object model so that it can be stored in the same way as standard Qt types. We then show how to register the custom type to allow it to be used in signals and slots connections. \section1 Creating a Custom Type + + Before we begin, we need to ensure that the custom type we are creating meets all the + requirements imposed by QMetaType. In other words, it must provide: + + \list + \o a public default constructor, + \o a public copy constructor, and + \o a public destructor. + \endlist + + The following \c Message class definition includes these members: + + \snippet examples/tools/customtype/message.h custom type definition + + The class also provides a constructor for normal use and two public member functions + that are used to obtain the private data. + + \section1 Declaring the Type with QMetaType + + The \c Message class only needs a suitable implementation in order to be usable. + However, Qt's type system will not be able to understand how to store, retrieve + and serialize instances of this class without some assistance. For example, we + will be unable to store \c Message values in QVariant. + + The class in Qt responsible for custom types is QMetaType. To make the type known + to this class, we invoke the Q_DECLARE_METATYPE() macro on the class in the header + file where it is defined: + + \snippet examples/tools/customtype/message.h custom type meta-type declaration + + This now makes it possible for \c Message values to be stored in QVariant objects + and retrieved later. See the \l{Custom Type Example} for code that demonstrates + this. + + The Q_DECLARE_METATYPE() macro also makes it possible for these values to be used as + arguments to signals, but \e{only in direct signal-slot connections}. + To make the custom type generally usable with the signals and slots mechanism, we + need to perform some extra work. + + \section1 Creating and Destroying Custom Objects + + Although the declaration in the previous section makes the type available for use + in direct signal-slot connections, it cannot be used for queued signal-slot + connections, such as those that are made between objects in different threads. + This is because the meta-object system does not know how to handle creation and + destruction of objects of the custom type at run-time. + + To enable creation of objects at run-time, call the qRegisterMetaType() template + function to register it with the meta-object system. This also makes the type + available for queued signal-slot communication as long as you call it before you + make the first connection that uses the type. + + The \l{Queued Custom Type Example} declares a \c Block class which is registered + in the \c{main.cpp} file: + + \snippet examples/threads/queuedcustomtype/main.cpp main start + \dots + \snippet examples/threads/queuedcustomtype/main.cpp register meta-type for queued communications + \dots + \snippet examples/threads/queuedcustomtype/main.cpp main finish + + This type is later used in a signal-slot connection in the \c{window.cpp} file: + + \snippet examples/threads/queuedcustomtype/window.cpp Window constructor start + \dots + \snippet examples/threads/queuedcustomtype/window.cpp connecting signal with custom type + \dots + \snippet examples/threads/queuedcustomtype/window.cpp Window constructor finish + + If a type is used in a queued connection without being registered, a warning will be + printed at the console; for example: + + \code + QObject::connect: Cannot queue arguments of type 'Block' + (Make sure 'Block' is registered using qRegisterMetaType().) + \endcode + + \section1 Making the Type Printable + + It is often quite useful to make a custom type printable for debugging purposes, + as in the following code: + + \snippet examples/tools/customtype/main.cpp printing a custom type + + This is achieved by creating a streaming operator for the type, which is often + defined in the header file for that type: + + \snippet examples/tools/customtype/message.h custom type streaming operator + + The implementation for the \c Message type in the \l{Custom Type Example} + goes to some effort to make the printable representation as readable as + possible: + + \snippet examples/tools/customtype/message.cpp custom type streaming operator + + The output sent to the debug stream can, of course, be made as simple or as + complicated as you like. Note that the value returned by this function is + the QDebug object itself, though this is often obtained by calling the + maybeSpace() member function of QDebug that pads out the stream with space + characters to make it more readable. + + \section1 Further Reading + + The Q_DECLARE_METATYPE() macro and qRegisterMetaType() function documentation + contain more detailed information about their uses and limitations. + + The \l{Custom Type Example}{Custom Type}, + \l{Custom Type Sending Example}{Custom Type Sending} + and \l{Queued Custom Type Example}{Queued Custom Type} examples show how to + implement a custom type with the features outlined in this document. + + The \l{Debugging Techniques} document provides an overview of the debugging + mechanisms discussed above. */ diff --git a/doc/src/debug.qdoc b/doc/src/debug.qdoc index cd9d8cb..da5a82f 100644 --- a/doc/src/debug.qdoc +++ b/doc/src/debug.qdoc @@ -200,7 +200,10 @@ between each item. Here is an example for a class that represents a 2D coordinate. - \snippet doc/src/snippets/qdebugsnippet.cpp 0 + \snippet doc/src/snippets/qdebug/qdebugsnippet.cpp 0 + + Integration of custom types with Qt's meta-object system is covered + in more depth in the \l{Creating Custom Qt Types} document. \section1 Debugging Macros diff --git a/doc/src/deployment.qdoc b/doc/src/deployment.qdoc index 496fe81..d9f7c1a 100644 --- a/doc/src/deployment.qdoc +++ b/doc/src/deployment.qdoc @@ -89,7 +89,8 @@ of Qt, you get Qt as a shared library. The disadvantage with the shared library approach is that you - will get more files to deploy. + will get more files to deploy. For more information, see + \l{sharedlibrary.html}{Creating Shared Libraries}. \section1 Deploying Qt's Libraries @@ -110,13 +111,14 @@ \o \l {QtNetwork} \o \l {QtOpenGL} \o \l {QtScript} - \o \l {QtSql} + \o \l {QtScriptTools} \row + \o \l {QtSql} \o \l {QtSvg} \o \l {QtWebKit} \o \l {QtXml} - \o \l {QtXmlPatterns} \row + \o \l {QtXmlPatterns} \o \l {Phonon Module}{Phonon} \o \l {Qt3Support} \endtable @@ -177,11 +179,13 @@ Please see \l{QtWebKit Module#License Information}{the QtWebKit module documentation} for more information. - \row \o Phonon \o Phonon + \row \o \l{Phonon Module}{Phonon} \o Phonon \o Phonon relies on the native multimedia engines on different platforms. Phonon itself is licensed under the GNU LGPL version 2. Please see \l{Phonon Module#License Information}{the Phonon module documentation} - for more information. + for more information on licensing and the + \l{Phonon Overview#Backends}{Phonon Overview} for details of the backends + in use on different platforms. \endtable \section1 Platform-Specific Notes @@ -878,30 +882,44 @@ HTML pages from the World Wide Web, you should include all text codec plugins to support as many HTML encodings possible. - The search path for Qt plugins (as well as a few other paths) is - hard-coded into the QtCore library. By default, the first plugin - search path will be hard-coded to be a \c plugins subdirectory of - the Qt installation: - - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 25 - - Pre-determined paths like this one have certain disadvantages. - For example, they may not exist on the target machine. For that - reason you need to examine various alternatives to make sure that - the Qt plugins are found: + The search path for Qt plugins is hard-coded into the QtCore library. + By default, the plugins subdirectory of the Qt installation is the first + plugin search path. However, pre-determined paths like the default one + have certain disadvantages. For example, they may not exist on the target + machine. For that reason, you need to examine various alternatives to make + sure that the Qt plugins are found: \list - \o \l{qt-conf.html}{Using \c qt.conf}. This is the recommended - approach since it provides the most flexibility. - + \o \l{qt-conf.html}{Using \c qt.conf}. This approach is the recommended + if you have executables in different places sharing the same plugins. + \o Using QApplication::addLibraryPath() or - QApplication::setLibraryPaths(). + QApplication::setLibraryPaths(). This approach is recommended if you only + have one executable that will use the plugin. \o Using a third party installation utility to change the hard-coded paths in the QtCore library. \endlist + + If you add a custom path using QApplication::addLibraryPath it could + look like this: + + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 54 + + Then qApp->libraryPaths() would return something like this: + + "C:/customPath/plugins " + "C:/Qt/4.5.0/plugins" + "E:/myApplication/directory/" + + The executable will look for the plugins in these directories and + the same order as the QStringList returned by qApp->libraryPaths(). + The newly added path is prepended to the qApp->libraryPaths() which + means that it will be searched through first. However, if you use + qApp->setLibraryPaths(), you will be able to determend which paths + and in which order they will be searched. The \l{How to Create Qt Plugins} document outlines the issues you need to pay attention to when building and deploying plugins for @@ -1105,7 +1123,7 @@ \snippet doc/src/snippets/code/doc_src_deployment.qdoc 38 For the Qt frameworks, the first line (i.e. \c - {path/to/Qt/lib/QtGui.framework/Versions/4.0/QtGui (compatibility + {path/to/Qt/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.0.0, current version 4.0.1)}) becomes the framework's identification name which is used by the dynamic linker (\c dyld). @@ -1448,4 +1466,11 @@ \o The accessibility plugin is always deployed. \o Accessibility for Qt3Support is deployed if the application uses the Qt3Support module. \endlist + + macdeployqt supports the following options: + \list + \o -no-plugins: Skip plugin deployment + \o -dmg : Create a .dmg disk image + \o -no-strip : Don't run 'strip' on the binaries + \endlist */ diff --git a/doc/src/designer-manual.qdoc b/doc/src/designer-manual.qdoc index 768f476..e10a5be 100644 --- a/doc/src/designer-manual.qdoc +++ b/doc/src/designer-manual.qdoc @@ -128,6 +128,7 @@ \header \i Widget Filter Box \i Widget Morphing + \i Disambiguation Field \row \i \inlineimage designer-widget-filter.png \i \inlineimage designer-widget-morph.png @@ -1855,7 +1856,7 @@ pixmap property in the property editor. \section2 The Direct Approach - To demonstrate thow to use user interface (\c{.ui}) files straight from + To demonstrate how to use user interface (\c{.ui}) files straight from \QD, we create a simple Calculator Form application. This is based on the original \l{Calculator Form Example}{Calculator Form} example. @@ -2294,7 +2295,7 @@ pixmap property in the property editor. \image worldtimeclockplugin-example.png - The \l QtDesigner module provides you with the ability to create cusom + The \l QtDesigner module provides you with the ability to create custom widgets in \QD. @@ -2442,6 +2443,10 @@ pixmap property in the property editor. \target BuildingandInstallingthePlugin \section1 Building and Installing the Plugin + \section2 A Simple Plugin + + The \l{Custom Widget Plugin Example} demonstrates a simple \QD plugin. + The \c{.pro} file for a plugin must specify the headers and sources for both the custom widget and the plugin interface. Typically, this file only has to specify that the plugin's project is to be built as a library, but @@ -2476,65 +2481,42 @@ pixmap property in the property editor. See QCoreApplication::libraryPaths() for more information about customizing paths for libraries and plugins with Qt applications. -\omit - \section1 Using Qt Script to Aid in Building Forms - - Starting with Qt 4.3, \c .ui files may contain - \l{QtScript}{Qt Script} snippets that are executed by \l uic or QUiLoader - when building forms. + \section2 Splitting up the Plugin - The snippets are executed per widget. The snippet may modify properties - or invoke slots on the widget. + In a real world scenario, you do not want to have dependencies of the + application making use of the custom widgets to the \QD headers and + libraries as introduced by the simple approach explained above. - Special variables are used to access the widget: + There are two ways to resolve this: - \table - \header - \o Name - \o Value - \row \o \c widget - \o The widget being built. - \row \o \c childWidgets - \o An array containing the child widgets. This is useful - for QDesignerContainerExtension subclasses. - \endtable + \list + \i Create a \c{.pri} file that contains the headers sources and sources + of the custom widget: - If scripts are present in an \c {uic}-generated form, the application - must be configured with Qt Script support. + \code + INCLUDEPATH += $$PWD + HEADERS += $$PWD/analogclock.h + SOURCES += $$PWD/analogclock.cpp + \endcode - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 5 + This file would then be included by the \c{.pro} file of the plugin and + the application: - For security reasons, the execution of scripts is disabled - by default in QUiLoader. You can enable it by - calling the QUiLoader::setScriptingEnabled() method. + \code + include(customwidget.pri) + \endcode - The resulting script snippet is concatenated from snippets occurring in - several places: + Running \c{qmake -Wall} on the \c{.pro} files causes a warning to be + printed if an included \c{.pri} file cannot be found. - \table - \header - \o Source - \o Usage - \row \o The \c codeTemplate() function of QDesignerCustomWidgetInterface - \o Allows snippets to be run on a per-class basis; for example, to set up a - container using the QDesignerContainerExtension. - \row \o The \c script() method of QDesignerScriptExtension - \o Allows snippets to be run on a per-widget basis; for example, - to set up the internal state of a custom widget. - - Such an internal state might be, for example, the contents of - a custom item view container widget, for which an editor - is provided by an QDesignerTaskMenuExtension object. - - \row \o Snippets entered at run-time using the \gui{Change script...} - option of the form's context menu - \o Fast prototyping. To get an idea, - drag a QLineEdit onto the form, enter the script - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 6 - and preview the form. - \endtable -\endomit + \i Create a standalone shared library containing the custom widgets only + as described in + \l{sharedlibrary.html}{Creating Shared Libraries}. + This library would then be used by the application as well as by the + \QD plugin. Care must be taken to ensure that the plugin can locate + the library at run-time. + \endlist \section1 Related Examples diff --git a/doc/src/diagrams/qtransform-representation.sk b/doc/src/diagrams/qtransform-representation.sk new file mode 100644 index 0000000..17dcbfe --- /dev/null +++ b/doc/src/diagrams/qtransform-representation.sk @@ -0,0 +1,103 @@ +##Sketch 1 2 +document() +layout('A4',0) +layer('Layer 1',1,1,0,0,(0,0,0)) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,190,760) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,190,695) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,190,630) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,320,760) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,320,695) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,320,630) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,255,760) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,255,695) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,255,630) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m33',(329.16,589.968)) +G() +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('dy',(274.828,577.768)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m32',(264.16,602.768)) +G_() +G() +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m31',(199.16,602.768)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('dx',(209.828,577.8)) +G_() +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m11',(199.16,719.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m12',(264.16,719.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m13',(329.16,719.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m21',(199.16,654.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m22',(264.16,654.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m23',(329.16,654.968)) +guidelayer('Guide Lines',1,0,0,1,(0,0,1)) +grid((0,0,5,5),1,(0,0,1),'Grid') diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index c1f9ef5..b750aa0 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -234,6 +234,7 @@ \o \l{painting/fontsampler}{Font Sampler} \o \l{painting/imagecomposition}{Image Composition}\raisedaster \o \l{painting/painterpaths}{Painter Paths}\raisedaster + \o \l{painting/svggenerator}{SVG Generator}\raisedaster \o \l{painting/svgviewer}{SVG Viewer} \o \l{painting/transformations}{Transformations}\raisedaster \endlist @@ -315,6 +316,7 @@ \section1 Threads \list + \o \l{threads/queuedcustomtype}{Queued Custom Type}\raisedaster \o \l{threads/mandelbrot}{Mandelbrot}\raisedaster \o \l{threads/semaphores}{Semaphores}\raisedaster \o \l{threads/waitconditions}{Wait Conditions}\raisedaster @@ -326,6 +328,8 @@ \o \l{tools/codecs}{Codecs} \o \l{tools/completer}{Completer}\raisedaster \o \l{tools/customcompleter}{Custom Completer}\raisedaster + \o \l{tools/customtype}{Custom Type}\raisedaster + \o \l{tools/customtypesending}{Custom Type Sending}\raisedaster \o \l{tools/echoplugin}{Echo Plugin}\raisedaster \o \l{tools/i18n}{I18N} \o \l{tools/plugandpaint}{Plug & Paint}\raisedaster diff --git a/doc/src/examples/collidingmice-example.qdoc b/doc/src/examples/collidingmice-example.qdoc index 7ea2ca2..657a204 100644 --- a/doc/src/examples/collidingmice-example.qdoc +++ b/doc/src/examples/collidingmice-example.qdoc @@ -66,7 +66,7 @@ \section1 Mouse Class Definition - The \c mouse class inherits both QObject and QGraphicsItem. The + The \c mouse class inherits from QGraphicsItem. The QGraphicsItem class is the base class for all graphical items in the Graphics View framework, and provides a light-weight foundation for writing your own custom items. @@ -78,14 +78,11 @@ {QGraphicsItem::}{boundingRect()}, which returns an estimate of the area painted by the item, and \l {QGraphicsItem::}{paint()}, which implements the actual painting. In addition, we reimplement - the \l {QGraphicsItem::}{shape()} function to return an accurate + the \l {QGraphicsItem::}{shape()} and \l {QGraphicsItem::}{advance()}. + We reimplement \l {QGraphicsItem::}{shape()} to return an accurate shape of our mouse item; the default implementation simply returns - the item's bounding rectangle. - - The rationale for deriving from QObject in addition to - QGraphicsItem is to be able to animate our items by reimplementing - QObject's \l {QObject::}{timerEvent()} function and use - QObject::startTimer() to generate timer events. + the item's bounding rectangle. We reimplement \l {QGraphicsItem::}{advance()} + to handle the animation so it all happens on one update. \section1 Mouse Class Definition @@ -105,19 +102,18 @@ calling the item's \l {QGraphicsItem::rotate()}{rotate()} function we alter the direction in which the mouse will start moving. - In the end we call QObject's \l {QObject::}{startTimer()} - function, emitting a timer event every 1000/33 millisecond. This - enables us to animate our mouse item using our reimplementation of - the \l {QObject::}{timerEvent()} function; whenever a mouse - receives a timer event it will trigger \l - {QObject::}{timerEvent()}: - + When the QGraphicsScene decides to advance the scene a frame it will call + QGraphicsItem::advance() on each of the items. This enables us to animate + our mouse using our reimplementation of the advance() function. + \snippet examples/graphicsview/collidingmice/mouse.cpp 4 \snippet examples/graphicsview/collidingmice/mouse.cpp 5 \snippet examples/graphicsview/collidingmice/mouse.cpp 6 - First we ensure that the mice stays within a circle with a radius - of 150 pixels. + First, we don't bother doing any advance if the step is 0 since we want to our advance in + the actual advance (advance() is called twice, once with step == 0 indicating that items + are about to advance and with step == 1 for the actual advance). We also ensure that the + mice stays within a circle with a radius of 150 pixels. Note the \l {QGraphicsItem::mapFromScene()}{mapFromScene()} function provided by QGraphicsItem. This function maps a position @@ -275,5 +271,12 @@ In the end, we set the application window's title and size before we enter the main event loop using the QApplication::exec() function. -*/ + Finally, we create a QTimer and connect its timeout() signal to the advance() + slot of the scene. Every time the timer fires, the scene will advance one frame. + We then tell the timer to fire every 1000/33 millisecond. This will + give us a frame rate of 30 frames a second, which is fast enough for most animations. + Doing the animation with a single timer connect to advance the scene ensures that all the + mice are moved at one point and, more importantly, only one update is sent to the screen + after all the mice have moved. +*/
\ No newline at end of file diff --git a/doc/src/examples/customtype.qdoc b/doc/src/examples/customtype.qdoc new file mode 100644 index 0000000..ffeccc3 --- /dev/null +++ b/doc/src/examples/customtype.qdoc @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example tools/customtype + \title Custom Type Example + + The Custom Type example shows how to integrate a custom type into Qt's + meta-object system. + + Contents: + + \tableofcontents + + \section1 Overview + + Qt provides a range of standard value types that are used to provide + rich and meaningful APIs. These types are integrated with the meta-object + system, enabling them to be stored in QVariant objects, written out in + debugging information and sent between components in signal-slot + communication. + + Custom types can also be integrated with the meta-object system as long as + they are written to conform to some simple guidelines. In this example, we + introduce a simple \c Message class, we describe how we make it work with + QVariant, and we show how it can be extended to generate a printable + representation of itself for use in debugging output. + + \section1 The Message Class Definition + + The \c Message class is a simple value class that contains two pieces + of information (a QString and a QStringList), each of which can be read + using trivial getter functions: + + \snippet examples/tools/customtype/message.h custom type definition + + The default constructor, copy constructor and destructor are + all required, and must be public, if the type is to be integrated into the + meta-object system. Other than this, we are free to implement whatever we + need to make the type do what we want, so we also include a constructor + that lets us set the type's data members. + + To enable the type to be used with QVariant, we declare it using the + Q_DECLARE_METATYPE() macro: + + \snippet examples/tools/customtype/message.h custom type meta-type declaration + + We do not need to write any additional code to accompany this macro. + + To allow us to see a readable description of each \c Message object when it + is sent to the debug output stream, we define a streaming operator: + + \snippet examples/tools/customtype/message.h custom type streaming operator + + This facility is useful if you need to insert tracing statements in your + code for debugging purposes. + + \section1 The Message Class Implementation + + The implementation of the default constructor, copy constructor and destructor + are straightforward for the \c Message class: + + \snippet examples/tools/customtype/message.cpp Message class implementation + + The streaming operator is implemented in the following way: + + \snippet examples/tools/customtype/message.cpp custom type streaming operator + + Here, we want to represent each value depending on how many lines are stored + in the message body. We stream text to the QDebug object passed to the + operator and return the QDebug object obtained from its maybeSpace() member + function; this is described in more detail in the + \l{Creating Custom Qt Types#Making the Type Printable}{Creating Custom Qt Types} + document. + + We include the code for the getter functions for completeness: + + \snippet examples/tools/customtype/message.cpp getter functions + + With the type fully defined, implemented, and integrated with the + meta-object system, we can now use it. + + \section1 Using the Message + + In the example's \c{main()} function, we show how a \c Message object can + be printed to the console by sending it to the debug stream: + + \snippet examples/tools/customtype/main.cpp printing a custom type + + You can use the type with QVariant in exactly the same way as you would + use standard Qt value types. Here's how to store a value using the + QVariant::setValue() function: + + \snippet examples/tools/customtype/main.cpp storing a custom value + + Alternatively, the qVariantFromValue() and qVariantSetValue() functions + can be used if you are using a compiler without support for member template + functions. + + The value can be retrieved using the QVariant::value() member template + function: + + \snippet examples/tools/customtype/main.cpp retrieving a custom value + + Alternatively, the qVariantValue() template function can be used if + you are using a compiler without support for member template functions. + + \section1 Further Reading + + The custom \c Message type can also be used with direct signal-slot + connections; see the \l{Custom Type Sending Example} for a demonstration + of this. + To register a custom type for use with queued signals and slots, such as + those used in cross-thread communication, see the + \l{Queued Custom Type Example}. + + More information on using custom types with Qt can be found in the + \l{Creating Custom Qt Types} document. +*/ diff --git a/doc/src/examples/customtypesending.qdoc b/doc/src/examples/customtypesending.qdoc new file mode 100644 index 0000000..d335c28 --- /dev/null +++ b/doc/src/examples/customtypesending.qdoc @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example tools/customtypesending + \title Custom Type Sending Example + + The Custom Type Sending example shows how to use a custom type with signals + and slots. + + \image customtypesending-example.png + + Contents: + + \tableofcontents + + \section1 Overview + + In the \l{Custom Type Example}, we showed how to integrate custom types + with the meta-object system, enabling them to be stored in QVariant + objects, written out in debugging information and used in signal-slot + communication. + + In this example, we demonstrate that the preparations made to the + \c Message class and its declaration with Q_DECLARE_METATYPE() enable it + to be used with direct signal-slot connections. We do this by creating + a \c Window class containing signals and slots whose signatures include + \c Message arguments. + + \section1 The Window Class Definition + + We define a simple \c Window class with a signal and public slot that + allow a \c Message object to be sent via a signal-slot connection: + + \snippet examples/tools/customtypesending/window.h Window class definition + + The window will contain a text editor to show the contents of a message + and a push button that the user can click to send a message. To facilitate + this, we also define the \c sendMessage() slot. We also keep a \c Message + instance in the \c thisMessage private variable which holds the actual + message to be sent. + + \section1 The Window Class Implementation + + The \c Window constructor sets up a user interface containing a text + editor and a push button. + + \snippet examples/tools/customtypesending/window.cpp Window constructor + + The button's \l{QPushButton::}{clicked()} signal is connected to the + window's \c{sendMessage()} slot, which emits the \c{messageSent(Message)} + signal with the \c Message held by the \c thisMessage variable: + + \snippet examples/tools/customtypesending/window.cpp sending a message + + We implement a slot to allow the message to be received, and this also + lets us set the message in the window programatically: + + \snippet examples/tools/customtypesending/window.cpp receiving a message + + In this function, we simply assign the new message to \c thisMessage + and update the text in the editor. + + \section1 Making the Connection + + In the example's \c{main()} function, we perform the connection between + two instances of the \c Window class: + + \snippet examples/tools/customtypesending/main.cpp main function + + We set the message for the first window and connect the + \c{messageSent(Message)} signal from each window to the other's + \c{setMessage(Message)} slot. Since the signals and slots mechanism is only + concerned with the type, we can simplify the signatures of both the + signal and slot when we make the connection. + + When the user clicks on the \gui{Send message} button in either window, + the message shown will be emitted in a signal that the other window will + receive and display. + + \section1 Further Reading + + Although the custom \c Message type can be used with direct signals and + slots, an additional registration step needs to be performed if you want + to use it with queued signal-slot connections. See the + \l{Queued Custom Type Example} for details. + + More information on using custom types with Qt can be found in the + \l{Creating Custom Qt Types} document. +*/ diff --git a/doc/src/examples/extension.qdoc b/doc/src/examples/extension.qdoc index 8a0ca3a..02e0698 100644 --- a/doc/src/examples/extension.qdoc +++ b/doc/src/examples/extension.qdoc @@ -80,9 +80,9 @@ user type a word to search for, we need several \l {QCheckBox}{QCheckBox}es to facilitate the search options, and we need three \l {QPushButton}{QPushButton}s: the \gui Find button to - start a search, the \gui More button to enable an advanced search, - and the \gui Close button to exit the application. Finally, we - need a QWidget representing the application's extension part. + start a search and the \gui More button to enable an advanced search. + Finally, we need a QWidget representing the application's extension + part. \section1 FindDialog Class Implementation @@ -128,8 +128,7 @@ the connection makes sure that the extension widget is shown depending on the state of \gui More button. - We also connect the \gui Close button to the QWidget::close() - slot, and we put the checkboxes associated with the advanced + We also put the check boxes associated with the advanced search options into a layout we install on the extension widget. \snippet examples/dialogs/extension/finddialog.cpp 4 @@ -137,7 +136,7 @@ Before we create the main layout, we create several child layouts for the widgets: First we allign the QLabel ans its buddy, the QLineEdit, using a QHBoxLayout. Then we vertically allign the - QLabel and QLineEdit with the checkboxes associated with the + QLabel and QLineEdit with the check boxes associated with the simple search, using a QVBoxLayout. We also create a QVBoxLayout for the buttons. In the end we lay out the two latter layouts and the extension widget using a QGridLayout. diff --git a/doc/src/examples/queuedcustomtype.qdoc b/doc/src/examples/queuedcustomtype.qdoc new file mode 100644 index 0000000..bbd1427 --- /dev/null +++ b/doc/src/examples/queuedcustomtype.qdoc @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example threads/queuedcustomtype + \title Queued Custom Type Example + + The Queued Custom Type example shows how to send custom types between + threads with queued signals and slots. + + \image queuedcustomtype-example.png + + Contents: + + \tableofcontents + + \section1 Overview + + In the \l{Custom Type Sending Example}, we showed how to use a custom type + with signal-slot communication within the same thread. + + In this example, we create a new value class, \c Block, and register it + with the meta-object system to enable us to send instances of it between + threads using queued signals and slots. + + \section1 The Block Class + + The \c Block class is similar to the \c Message class described in the + \l{Custom Type Example}. It provides the default constructor, copy + constructor and destructor in the public section of the class that the + meta-object system requires. It describes a colored rectangle. + + \snippet examples/threads/queuedcustomtype/block.h custom type definition and meta-type declaration + + We will still need to register it with the meta-object system at + run-time by calling the qRegisterMetaType() template function before + we make any signal-slot connections that use this type. + Even though we do not intend to use the type with QVariant in this example, + it is good practice to also declare the new type with Q_DECLARE_METATYPE(). + + The implementation of the \c Block class is trivial, so we avoid quoting + it here. + + \section1 The Window Class + + We define a simple \c Window class with a public slot that accepts a + \c Block object. The rest of the class is concerned with managing the + user interface and handling images. + + \snippet examples/threads/queuedcustomtype/window.h Window class definition + + The \c Window class also contains a worker thread, provided by a + \c RenderThread object. This will emit signals to send \c Block objects + to the window's \c addBlock(Block) slot. + + The parts of the \c Window class that are most relevant are the constructor + and the \c addBlock(Block) slot. + + The constructor creates a thread for rendering images, sets up a user + interface containing a label and two push buttons that are connected to + slots in the same class. + + \snippet examples/threads/queuedcustomtype/window.cpp Window constructor start + \snippet examples/threads/queuedcustomtype/window.cpp set up widgets and connections + \snippet examples/threads/queuedcustomtype/window.cpp connecting signal with custom type + + In the last of these connections, we connect a signal in the + \c RenderThread object to the \c addBlock(Block) slot in the window. + + \dots + \snippet examples/threads/queuedcustomtype/window.cpp Window constructor finish + + The rest of the constructor simply sets up the layout of the window. + + The \c addBlock(Block) slot receives blocks from the rendering thread via + the signal-slot connection set up in the constructor: + + \snippet examples/threads/queuedcustomtype/window.cpp Adding blocks to the display + + We simply paint these onto the label as they arrive. + + \section1 The RenderThread Class + + The \c RenderThread class processes an image, creating \c Block objects + and using the \c sendBlock(Block) signal to send them to other components + in the example. + + \snippet examples/threads/queuedcustomtype/renderthread.h RenderThread class definition + + The constructor and destructor are not quoted here. These take care of + setting up the thread's internal state and cleaning up when it is destroyed. + + Processing is started with the \c processImage() function, which calls the + \c RenderThread class's reimplementation of the QThread::run() function: + + \snippet examples/threads/queuedcustomtype/renderthread.cpp processing the image (start) + + Ignoring the details of the way the image is processed, we see that the + signal containing a block is emitted in the usual way: + + \dots + \snippet examples/threads/queuedcustomtype/renderthread.cpp processing the image (finish) + + Each signal that is emitted will be queued and delivered later to the + window's \c addBlock(Block) slot. + + \section1 Registering the Type + + In the example's \c{main()} function, we perform the registration of the + \c Block class as a custom type with the meta-object system by calling the + qRegisterMetaType() template function: + + \snippet examples/threads/queuedcustomtype/main.cpp main function + + This call is placed here to ensure that the type is registered before any + signal-slot connections are made that use it. + + The rest of the \c{main()} function is concerned with setting a seed for + the pseudo-random number generator, creating and showing the window, and + setting a default image. See the source code for the implementation of the + \c createImage() function. + + \section1 Further Reading + + This example showed how a custom type can be registered with the + meta-object system so that it can be used with signal-slot connections + between threads. For ordinary communication involving direct signals and + slots, it is enough to simply declare the type in the way described in the + \l{Custom Type Sending Example}. + + In practice, both the Q_DECLARE_METATYPE() macro and the qRegisterMetaType() + template function can be used to register custom types, but + qRegisterMetaType() is only required if you need to perform signal-slot + communication or need to create and destroy objects of the custom type + at run-time. + + More information on using custom types with Qt can be found in the + \l{Creating Custom Qt Types} document. +*/ diff --git a/doc/src/examples/qxmlstreambookmarks.qdoc b/doc/src/examples/qxmlstreambookmarks.qdoc index 7059043..fb3a1c1 100644 --- a/doc/src/examples/qxmlstreambookmarks.qdoc +++ b/doc/src/examples/qxmlstreambookmarks.qdoc @@ -103,8 +103,9 @@ The \c read() function accepts a QIODevice and sets it using \l{QXmlStreamReader::setDevice()}{setDevice()}. The actual process - of reading only takes place in event the file is a valid XBEL 1.0 - file. Otherwise, the \l{QXmlStreamReader::raiseError()} + of reading only takes place if the file is a valid XBEL 1.0 file. + Note that the XML input needs to be well-formed to be accepted by + QXmlStreamReader. Otherwise, the \l{QXmlStreamReader::raiseError()} {raiseError()} function is used to display an error message. \snippet examples/xml/streambookmarks/xbelreader.cpp 1 diff --git a/doc/src/examples/svggenerator.qdoc b/doc/src/examples/svggenerator.qdoc new file mode 100644 index 0000000..32bb89a --- /dev/null +++ b/doc/src/examples/svggenerator.qdoc @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example painting/svggenerator + \title SVG Generator Example + + The SVG Generator example shows how to add SVG file export to applications. + + \image svggenerator-example.png + + Scalable Vector Graphics (SVG) is an XML-based language for describing + two-dimensional vector graphics. Qt provides classes for rendering and + generating SVG drawings. This example allows the user to create a simple + picture and save it to an SVG file. + + The example consists of two classes: \c Window and \c DisplayWidget. + + The \c Window class contains the application logic and constructs the user + interface from a Qt Designer \c{.ui} file as described in the + \l{Using a Designer .ui File in Your Application#The Multiple Inheritance Approach}{Qt Designer manual}. + It also contains the code to write an SVG file. + + The \c DisplayWidget class performs all the work of painting a picture on + screen. Since we want the SVG to resemble this picture as closely as + possible, we make this code available to the \c Window class so that it can + be used to generate SVG files. + + \section1 The DisplayWidget Class + + The \c DisplayWidget class displays a drawing consisting of a selection of + elements chosen by the user. These are defined using \c Shape and + \c Background enums that are included within the class definition: + + \snippet examples/painting/svggenerator/displaywidget.h DisplayWidget class definition + + Much of this class is used to configure the appearance of the drawing. The + \c paintEvent() and \c paint() functions are most relevant to the purpose + of this example, so we will describe these here and leave the reader to + look at the source code for the example to see how shapes and colors are + handled. + + We reimplement the QWidget::paintEvent() function to display the drawing + on screen: + + \snippet examples/painting/svggenerator/displaywidget.cpp paint event + + Here, we only construct a QPainter object, begin painting on the device + and set a render hint for improved output quality before calling the + \c paint() function to perform the painting itself. When this returns, + we close the painter and return. + + The \c paint() function is designed to be used for different painting + tasks. In this example, we use it to draw on a \c DisplayWidget instance + and on a QSvgGenerator object. We show how the painting is performed to + demonstrate that there is nothing device-specific about the process: + + \snippet examples/painting/svggenerator/displaywidget.cpp paint function + + \section1 The Window Class + + The \c Window class represents the example's window, containing the user + interface, which has been created using Qt Designer: + + \snippet examples/painting/svggenerator/window.h Window class definition + + As with the \c DisplayWidget class, we concentrate on the parts of the code + which are concerned with painting and SVG generation. In the \c Window + class, the \c saveSvg() function is called whenever the \gui{Save As...} + button is clicked; this connection was defined in the \c{window.ui} file + using Qt Designer. + + The start of the \c saveSvg() function performs the task of showing a file + dialog so that the user can specify a SVG file to save the drawing to. + + \snippet examples/painting/svggenerator/window.cpp save SVG + + In the rest of the function, we set up the generator and configure it to + generate output with the appropriate dimensions and write to the + user-specified file. We paint on the QSvgGenerator object in the same way + that we paint on a widget, calling the \c DisplayWidget::paint() function + so that we use exactly the same code that we used to display the drawing. + + The generation process itself begins with the call to the painter's + \l{QPainter::}{begin()} function and ends with call to its + \l{QPainter::}{end()} function. The QSvgGenerator paint device relies on + the explicit use of these functions to ensure that output is written to + the file. + + \section1 Further Reading + + The \l{SVG Viewer Example} shows how to display SVG drawings in an + application, and can be used to show the contents of SVG files created + by this example. + + See the QtSvg module documentation for more information about SVG and Qt's + SVG classes. +*/ diff --git a/doc/src/exportedfunctions.qdoc b/doc/src/exportedfunctions.qdoc index 2d4821f..f67950c 100644 --- a/doc/src/exportedfunctions.qdoc +++ b/doc/src/exportedfunctions.qdoc @@ -101,8 +101,10 @@ press-and-hold operation on the application's dock icon or \key{Ctrl}-clicks on it while the application is running. - The menu will be turned into a Mac menu which will be merged - with Mac OS X built-in commands. + The menu will be turned into a Mac menu and the items added to the default + Dock menu. There is no merging of the Qt menu items with the items that are + in the Dock menu (i.e., it is not recommended to include actions that + duplicate functionality of items already in the Dock menu). \section1 void qt_mac_set_menubar_icons(bool \e{enable}) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 8904ddb..3bfb5af 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -352,3 +352,8 @@ \externalpage http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html \title GNU Lesser General Public License, version 2.1 */ + +/*! + \externalpage http://developers.sun.com/sunstudio/downloads/patches/index.jsp + \title Sun Studio Patches +*/ diff --git a/doc/src/graphicsview.qdoc b/doc/src/graphicsview.qdoc index fc21c53..049b0c3 100644 --- a/doc/src/graphicsview.qdoc +++ b/doc/src/graphicsview.qdoc @@ -77,8 +77,8 @@ \section1 The Graphics View Architecture Graphics View provides an item-based approach to model-view programming, - much like InterView's convenience classes QTableWidget, QTreeWidget and - QListWidget. Several views can observe a single scene, and the scene + much like InterView's convenience classes QTableView, QTreeView and + QListView. Several views can observe a single scene, and the scene contains items of varying geometric shapes. \section2 The Scene diff --git a/doc/src/images/customtypesending-example.png b/doc/src/images/customtypesending-example.png Binary files differnew file mode 100644 index 0000000..fbc3953 --- /dev/null +++ b/doc/src/images/customtypesending-example.png diff --git a/doc/src/images/extension-example.png b/doc/src/images/extension-example.png Binary files differindex dfaacc0..18fab52 100644 --- a/doc/src/images/extension-example.png +++ b/doc/src/images/extension-example.png diff --git a/doc/src/images/extension_more.png b/doc/src/images/extension_more.png Binary files differindex 2b06809..407af27 100644 --- a/doc/src/images/extension_more.png +++ b/doc/src/images/extension_more.png diff --git a/doc/src/images/qtransform-representation.png b/doc/src/images/qtransform-representation.png Binary files differindex 2608872..883d5dc 100644 --- a/doc/src/images/qtransform-representation.png +++ b/doc/src/images/qtransform-representation.png diff --git a/doc/src/images/queuedcustomtype-example.png b/doc/src/images/queuedcustomtype-example.png Binary files differnew file mode 100644 index 0000000..4399b63 --- /dev/null +++ b/doc/src/images/queuedcustomtype-example.png diff --git a/doc/src/images/svggenerator-example.png b/doc/src/images/svggenerator-example.png Binary files differnew file mode 100644 index 0000000..e7a8e53 --- /dev/null +++ b/doc/src/images/svggenerator-example.png diff --git a/doc/src/installation.qdoc b/doc/src/installation.qdoc index 6d02801..925a195 100644 --- a/doc/src/installation.qdoc +++ b/doc/src/installation.qdoc @@ -614,7 +614,7 @@ in the \l{Qt for Windows CE Requirements} document. <td><tt>-xinerama</tt> or auto-detected</td><td>1.1.0</td> </tr><tr id="DefaultColor"> <td> Xi </td><td> libXi </td><td> X11 Input Extensions</td> - <td>auto-detected</td><td>1.3.0</td> + <td><tt>-xinput</tt> or auto-detected</td><td>1.3.0</td> </tr><tr id="DefaultColor"> <td> Xt </td><td> libXt </td><td> Xt Intrinsics</td><td></td><td>0.99</td> </tr><tr id="DefaultColor"> diff --git a/doc/src/model-view-programming.qdoc b/doc/src/model-view-programming.qdoc index 50d6498..bf0c1c8 100644 --- a/doc/src/model-view-programming.qdoc +++ b/doc/src/model-view-programming.qdoc @@ -227,9 +227,14 @@ \section2 Delegates QAbstractItemDelegate is the abstract base class for delegates in the - model/view framework. A default delegate implementation is provided by - the QItemDelegate class, and this is used as the default delegate by - Qt's standard views. + model/view framework. Since Qt 4.4, the default delegate implementation is + provided by QStyledItemDelegate, and this is used as the default delegate + by Qt's standard views. However, QStyledItemDelegate and QItemDelegate are + independent alternatives to painting and providing editors for items in + views. The difference between them is that QStyledItemDelegate uses the + current style to paint its items. We therefore recommend using + QStyledItemDelegate as the base class when implementing custom delegates or + when working with Qt style sheets. Delegates are described in the section on \l{Delegate Classes}. diff --git a/doc/src/phonon-api.qdoc b/doc/src/phonon-api.qdoc index 01f7c8a..3d04c68 100644 --- a/doc/src/phonon-api.qdoc +++ b/doc/src/phonon-api.qdoc @@ -2568,7 +2568,7 @@ details. Phonon also provides EffectWidget, which lets the user modify the - parameters of an effect an the fly, e.g., with comboboxes. + parameters of an effect an the fly; e.g., with combo boxes. \sa {Phonon Module}, EffectWidget */ @@ -2656,7 +2656,7 @@ To find out what \l{Phonon::}{AudioOutputDevice}s are available for AudioOutput, you can call - BackendCapabilities::availableAudioDevices(). A default device is + BackendCapabilities::availableAudioOutputDevices(). A default device is selected by the backend, but it is possible to set the device to be used with setOutputDevice(). The outputDeviceChanged() signal will be emitted if the device changes. diff --git a/doc/src/phonon.qdoc b/doc/src/phonon.qdoc index e86ccf6..9470e61 100644 --- a/doc/src/phonon.qdoc +++ b/doc/src/phonon.qdoc @@ -49,7 +49,7 @@ \section1 Introduction Qt uses the Phonon multimedia framework to provide functionality - for playback of the most common multimedia formats.The media can + for playback of the most common multimedia formats. The media can be read from files or streamed over a network, using a QURL to a file. @@ -566,7 +566,8 @@ framework, but rather use exchangeable backends to do the work. See the \l{Phonon Module} page for general information about the - framework. + framework and the \l{Phonon Overview} for an introductory tour of its + features. */ /*! diff --git a/doc/src/platform-notes.qdoc b/doc/src/platform-notes.qdoc index ad13c1c..c8046c4 100644 --- a/doc/src/platform-notes.qdoc +++ b/doc/src/platform-notes.qdoc @@ -232,9 +232,7 @@ \section1 Windows Vista - Known issues for Qt on Vista will be listed here. - - As of Qt 4.2.0 no Vista-specific issues are known. + At the time Qt %VERSION% was released, there were no known Vista-specific issues. \target Windows NT \section1 Windows XP, Windows 2000 and Windows NT @@ -404,7 +402,7 @@ Any platform-compiler combinations not listed here should be considered unsupported. - \section2 Actively Supported Platforms + \section1 Actively Supported Platforms \table \header \o OS \o Architecture \o Makespec \o Compiler version(s) @@ -435,7 +433,7 @@ \o wince*-msvc2008 \o Visual Studio 2008 \endtable - \section2 Community Supported Platforms + \section1 Community Supported Platforms \table \header \o OS \o Architecture \o Makespec \o Compiler version(s) @@ -460,7 +458,7 @@ \row \o Embedded Linux \o MIPS, PowerPC \o qws/linux-g++ \o GCC 3.4, 4.1, 4.2, 4.3 \endtable - \section2 Unsupported Platforms + \section1 Unsupported Platforms The following platforms were supported in previous releases, either as actively supported or community supported platforms, but are now unsupported. @@ -493,7 +491,6 @@ \row \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \o MIPSpro 7.4.2m \o{5,1} \e{Unsupported - see the Unsupported Platforms table} \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} \row \o \l{Known Issues in %VERSION%}{Intel CC 10 (see note)} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} @@ -666,9 +663,9 @@ \section2 Sun Studio - Qt is tested using Sun Studio 10 (Sun CC 5.5). Go to - \l{http://developers.sun.com/prodtech/cc/downloads/patches/index.html}{Sun's website} - to download the latest patches for your Sun compiler. + Qt is tested using Sun Studio 8 (Sun CC 5.5). Go to + \l{Sun Studio Patches} page on Sun's Web site to download + the latest patches for your Sun compiler. \section2 Sun WorkShop 5.0 diff --git a/doc/src/porting4-removedvirtual.qdocinc b/doc/src/porting4-removedvirtual.qdocinc index 3eedad2..1af4fa6 100644 --- a/doc/src/porting4-removedvirtual.qdocinc +++ b/doc/src/porting4-removedvirtual.qdocinc @@ -22,7 +22,7 @@ \row \o void QButton::drawButtonLabel(QPainter *) \o Use Q3Button instead or reimplement QButton::paintEvent(). \row \o void QButton::setAccel(const QKeySequence &) \o Setter. \row \o void QButton::setAutoRepeat(bool) \o Setter. -\row \o void QButton::setDown(bool) \o Setter. +\row \o void QButton::setDown(bool) \o Use Q3Button instead or reimplement or port to the new QPushButton API. \row \o void QButton::setPixmap(const QPixmap &) \o Setter. \row \o void QButton::setState(ToggleState) \o Setter. \row \o void QButton::setText(const QString &) \o Use the QAbstractButton::setText() setter function. diff --git a/doc/src/qalgorithms.qdoc b/doc/src/qalgorithms.qdoc index 459fb81..b33c250 100644 --- a/doc/src/qalgorithms.qdoc +++ b/doc/src/qalgorithms.qdoc @@ -490,7 +490,10 @@ of \a value in the variable passed as a reference in argument \a n. \overload - This is the same as qLowerBound(\a{container}.begin(), \a{container}.end(), value); + For read-only iteration over containers, this function is broadly equivalent to + qLowerBound(\a{container}.begin(), \a{container}.end(), value). However, since it + returns a const iterator, you cannot use it to modify the container; for example, + to insert items. */ /*! \fn RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value) diff --git a/doc/src/qaxcontainer.qdoc b/doc/src/qaxcontainer.qdoc index 2138aaf..48c76fc 100644 --- a/doc/src/qaxcontainer.qdoc +++ b/doc/src/qaxcontainer.qdoc @@ -73,9 +73,6 @@ standard ActiveX controls to provide high-level user interface functionality are provided. - The QAxContainer module is part of the \l{Qt Full Framework Edition} for - Windows. It is \e not part of the \l{Open Source Versions of Qt}. - \sa {ActiveQt Framework} Topics: diff --git a/doc/src/qaxserver.qdoc b/doc/src/qaxserver.qdoc index ff04962..f0c317b 100644 --- a/doc/src/qaxserver.qdoc +++ b/doc/src/qaxserver.qdoc @@ -63,9 +63,6 @@ Some \l{Qt Examples#ActiveQt}{example implementations} of ActiveX controls and COM objects are provided. - The QAxServer module is part of the \l{Qt Full Framework Edition} for - Windows. It is \e not part of the \l{Open Source Versions of Qt}. - \sa {ActiveQt Framework} Topics: diff --git a/doc/src/qdesktopwidget.qdoc b/doc/src/qdesktopwidget.qdoc index 0361aae..5a27fb4 100644 --- a/doc/src/qdesktopwidget.qdoc +++ b/doc/src/qdesktopwidget.qdoc @@ -48,6 +48,9 @@ \ingroup environment \mainclass + QApplication::desktop() function should be used to get an instance + of the QDesktopWidget. + Systems with more than one graphics card and monitor can manage the physical screen space available either as multiple desktops, or as a large virtual desktop, which usually has the size of the bounding @@ -86,12 +89,14 @@ screens. The correct width and height values are obtained using availableGeometry() or screenGeometry() for a particular screen. - \sa QApplication, QX11Info::appRootWindow() + \sa QApplication, QApplication::desktop(), QX11Info::appRootWindow() */ /*! \fn QDesktopWidget::QDesktopWidget() + \internal + Creates the desktop widget. If the system supports a virtual desktop, this widget will have @@ -104,6 +109,8 @@ /*! \fn QDesktopWidget::~QDesktopWidget() + \internal + Destroys the desktop widget and frees any allocated resources. */ diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc index 30da8c6..39581a2 100644 --- a/doc/src/qmake-manual.qdoc +++ b/doc/src/qmake-manual.qdoc @@ -367,15 +367,20 @@ \row \o debug \o The project is to be built in debug mode. \row \o debug_and_release \o The project is built in \e both debug and release modes. + \row \o debug_and_release_target \o The project is built in \e both debug + and release modes. TARGET is built into \e both the debug and release directories. \row \o build_all \o If \c debug_and_release is specified, the project is built in both debug and release modes by default. + \row \o autogen_precompile_source \o Automatically generates a \c .cpp file that includes + the precompiled header file specified in the .pro file. \row \o ordered \o When using the \c subdirs template, this option specifies that the directories listed should be processed in the order in which they are given. \row \o warn_on \o The compiler should output as many warnings as possible. This is ignored if \c warn_off is specified. \row \o warn_off \o The compiler should output as few warnings as possible. - \endtable + \row \o copy_dir_files \o Enables the install rule to also copy directories, not just files. + \endtable The \c debug_and_release option is special in that it enables \e both debug and release versions of a project to be built. In such a case, the Makefile that @@ -3075,6 +3080,9 @@ called \c{.qmake.cache} in parent directories of the current directory. If it fails to find this file, it will silently ignore this step of processing. + If it finds a \c{.qmake.cache} file then it will process this file first before + it processes the project file. + \target LibDepend \section1 Library Dependencies diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index 6220795..d9f001e 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -142,7 +142,7 @@ QAction::iconVisibleInMenu property. Menus that are currently open or menus already created in the native - Mac OS X menubar MAY NOT pick up a change in this attribute. Changes + Mac OS X menubar \e{may not} pick up a change in this attribute. Changes in the QAction::iconVisibleInMenu property will always be picked up. \value AA_NativeWindows Ensures that widgets have native windows. @@ -508,11 +508,11 @@ \value DirectConnection When emitted, the signal is immediately delivered to the slot. \value QueuedConnection When emitted, the signal is queued until the event loop is able to deliver it to the slot. - \value - BlockingQueuedConnection Same as QueuedConnection, except that the current thread blocks + \value BlockingQueuedConnection + Same as QueuedConnection, except that the current thread blocks until the slot has been delivered. This connection type should only be used for receivers in a different thread. Note that misuse - of this type can lead to dead locks in your application. + of this type can lead to deadlocks in your application. \value AutoConnection If the signal is emitted from the thread in which the receiving object lives, the slot is invoked directly, as with diff --git a/doc/src/qprintdialog.qdoc b/doc/src/qprintdialog.qdoc index 6cac1c9..a4cd18b 100644 --- a/doc/src/qprintdialog.qdoc +++ b/doc/src/qprintdialog.qdoc @@ -39,26 +39,34 @@ ** ****************************************************************************/ +#ifdef QT3_SUPPORT /*! - \fn QPrinter *QPrintDialog::printer() const + \fn QPrinter *QPrintDialog::printer() const - Returns a pointer to the printer this dialog configures, or 0 if - this dialog does not operate on any printer. + Returns a pointer to the printer this dialog configures, or 0 if + this dialog does not operate on any printer. + + This function is available for Unix platforms only. */ /*! - \fn void QPrintDialog::setPrinter(QPrinter *printer, bool pickupSettings) + \fn void QPrintDialog::setPrinter(QPrinter *printer, bool pickupSettings) + + Sets this dialog to configure printer \a printer, or no printer if \a printer + is null. If \a pickupSettings is true, the dialog reads most of + its settings from \a printer. If \a pickupSettings is false (the + default) the dialog keeps its old settings. - Sets this dialog to configure printer \a printer, or no printer if \a printer - is null. If \a pickupSettings is true, the dialog reads most of - its settings from \a printer. If \a pickupSettings is false (the - default) the dialog keeps its old settings. + This function is available for Unix platforms only. */ /*! - \fn void QPrintDialog::addButton(QPushButton *button) + \fn void QPrintDialog::addButton(QPushButton *button) + + Adds the \a button to the layout of the print dialog. The added + buttons are arranged from the left to the right below the + last groupbox of the printdialog. - Adds the \a button to the layout of the print dialog. The added - buttons are arranged from the left to the right below the - last groupbox of the printdialog. + This function is available for Unix platforms only. */ +#endif diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index cd66c10..5d83ef2 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -161,9 +161,9 @@ \o Support for OLE verbs and MIME data handling in \l{ActiveQt}. \endlist - For more information about improvements in the current release, see - the \l{http://www.qtsoftware.com/developer/changes/changes-4.1.4/} - {detailed list of changes}. + For more information about improvements in each Qt release, see + the \l{http://www.qtsoftware.com/developer/changes/} + {detailed lists of changes}. \section1 Significant Improvements @@ -447,11 +447,10 @@ \l{http://www.qtsoftware.com/developer/changes/changes-4.5.0}{available online}. A \l{Known Issues in %VERSION%}{list of known issues} for this release is also available. - \omit + Changes between this release and the previous release are provided in the \c{changes-%VERSION%} file (also \l{http://www.qtsoftware.com/developer/changes/changes-%VERSION%}{available online}). - \endomit A list of other Qt 4 features can be found on the \bold{\l{What's New in Qt 4}} page. diff --git a/doc/src/qtcocoa-known-issues.qdoc b/doc/src/qtcocoa-known-issues.qdoc deleted file mode 100644 index eedbd68..0000000 --- a/doc/src/qtcocoa-known-issues.qdoc +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtcocoa-known-issues.html - \title Known Issues with the Qt/Mac Cocoa Port - - This document explains the current list of features in the Qt/Mac Cocoa port - that are currently not working. Most of the issues will be addressed in - upcoming snapshots and beta releases. We hope that all the issues should be - addressed by the time the of the final 4.5.0 release. - - \tableofcontents - - \section1 What Works - - Here are the things that we can say about the current state of the Qt/Mac Cocoa port. - - \list - \i \e{64-bit Support}: - The Qt libraries currently do build and link as 64-bit frameworks and it is - possible to build and run many of the Qt examples as 64-bit. - - \i \e{HIViews are now NSViews}: - Every QWidget is now backed by an NSView pointer instead of an HIViewRef. - QWidget::winId() will return an NSView pointer that can be used in other - Cocoa technologies (e.g., Core Animation). - - \i \e{Some Native Dialogs Work}: - QFileDialog and QColorDialog have been ported to use NSOpen-/NSSavePanel and - NSColorPanel respectively. QPrintDialog and QPageSetupDialog are not in - this release, but are on their way. Currently, none of these dialogs show - up as sheets pending the creation of an asynchronous API. - - \i \e{Painting, Printing, and Styles}: - Since printing and painting used Quartz 2D and styling used HITheme, these - sub-systems work without any changes. - - \i \e {OpenGL}: - OpenGL is fully supported,including pixel buffers and framebuffer objects. - - \i \e{Clipboard}: - Using QClipboard to copy and paste data works as expected. - - \i \e{Mouse, Keyboard, and Wheel events}: - Mouse, keyboard, and wheel events are dispatched to the proper - widget. The Qt/Mac Cocoa port respects Cocoa's idea of a "First - Responder." - - \endlist - - \section1 Current Known Issues - - The following are items that don't currently work, but that we plan to have - resolved before the final release of the Qt/Mac Cocoa port. Please do not - file bugs on these. - - \list - \i \e{Carbon Support}: - The current source tree for the Qt/Mac Cocoa port contains source for - building Qt/Mac with Cocoa. It contains some of the source code that is - used for the Carbon port, but it is currently not set up to build the - Carbon Qt/Mac libraries. Please use a normal release or snapshot if you - want to use Carbon. - - \i \e{Drag and Drop Support}: - Drag and Drop is currently not implemented and needs to be ported to Cocoa, - but using the clipboard does work at this time. - - \i \e {Accessibility}: - Accessibility support is not implemented and needs to be ported to Cocoa. - - \i \e {Text}: - Most text rendering works fine for Latin-1 characters. However, rendering - non-Latin-1 characters has not been tested. - - \i \e {Input Methods}: - Input methods also need to be ported to Cocoa. - - \i \e {Shortcuts}: - Shortcuts that exist outside of the menu bar may not be dispatched. - - \i \e {Tablet Support}: - The tablet support has not been ported from Carbon yet. However, it should - still be possible to use the tablet as a mouse. - - \i \e {Phonon}: - Phonon uses the QuickTime backend that is only available on 32-bit. Using - Phonon in 64-bit requires a QTKit-based backend and has not been done. - - \i \e {Unified Toolbar}: - The QMainWindow::setUnifiedTitleAndToolBarOnMac() method currently does nothing. - - \i \e {Dialogs, Tool Windows, Sheets, and Drawers}: - At the moment, all windows are subclasses of NSWindow. This means that - window types like drawers and sheets do not work and tool windows do not - get the right decorations. Modal dialogs do show up at the correct window - level, but are not yet considered "panels." Many window flags are not - recognized. - - \endlist - - \section1 Things We Don't Expect to Support - - The following items that we do not plan on spending any resources on unless - there is monumental outcry for their inclusion. - - \list - \i \e{Qt3Support}: - At this time we have no plans for making the Qt3Support module work with - the Qt/Mac Cocoa port in 64-bit mode. Following in footsteps of Apple, we - would like to encourage you to consider the time of going Cocoa and 64-bit - as a chance to jettison Qt 3 constructs and classes. - - \i \e{Support for versions of Mac OS X below 10.5}: - We are using methods and classes that are only available in 10.5 and - higher. Most of these functions don't have any equivalent on earlier - versions. We recommend using the Carbon version for earlier versions of Mac - OS X. We anticipate keeping the Carbon port supported at least for the - lifetime of 4.5. - - \i \e{Support for -no-framework or -static}: - Cocoa requires that we load a nib in order to properly access the global - menu bar. This nib has to reside on disk somewhere. The most logical place - for it to reside is inside the QtGui framework. For this reason, building - Qt as standard "dylibs" or statically is no longer supported. - - \endlist - -*/ diff --git a/doc/src/sharedlibrary.qdoc b/doc/src/sharedlibrary.qdoc new file mode 100644 index 0000000..3febb8f --- /dev/null +++ b/doc/src/sharedlibrary.qdoc @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt GUI Toolkit. +** EDITIONS: FREE, PROFESSIONAL, ENTERPRISE +** +****************************************************************************/ + +/*! + \group deployment + \page sharedlibrary.html + \ingroup buildsystem + + \title Creating Shared Libraries + The following sections list certain things that should be taken into + account when creating shared libraries. + + \section1 Using Symbols from Shared Libraries + + Symbols - functions, variables or classes - contained in shared libraries + intended to be used by \e{clients}, such as applications or other + libraries, must be marked in a special way. These symbols are called + \e{public symbols} that are \e{exported} or made publicly visible. + + The remaining symbols should not be visible from the outside. On most + platforms, compilers will hide them by default. On some platforms, a + special compiler option is required to hide these symbols. + + When compiling a shared library, it must be marked for \e{export}. To use + the shared library from a client, some platforms may require a special + \e{import} declaration as well. + + Depending on your target platform, Qt provides special macros that contain + the necessary definitions: + \list + \o \c{Q_DECL_EXPORT} must be added to the declarations of symbols used + when compiling a shared library. + \o \c{Q_DECL_IMPORT} must be added to the declarations of symbols used + when compiling a client that uses the shared library. + \endlist + + Now, we need to ensure that the right macro is invoked -- whether we + compile a share library itself, or just the client using the shared + library. + Typically, this can be solved by adding a special header. + + Let us assume we want to create a shared library called \e{mysharedlib}. + A special header for this library, \c{mysharedlib_global.h}, looks like + this: + + \code + #include <QtCore/QtGlobal> + + #if defined(MYSHAREDLIB_LIBRARY) + # define MYSHAREDLIB_EXPORT Q_DECL_EXPORT + #else + # define MYSHAREDLIB_EXPORT Q_DECL_IMPORT + #endif + \endcode + + In the \c{.pro} file of the shared library, we add: + + \code + DEFINES += MYSHAREDLIB_LIBRARY + \endcode + + In each header of the library, we specify the following: + + \code + #include "mysharedlib_global.h" + + MYSHAREDLIB_EXPORT void foo(); + class MYSHAREDLIB_EXPORT MyClass... + \endcode + This ensures that the right macro is seen by both library and clients. We + also use this technique in Qt's sources. + + + \section1 Header File Considerations + + Typically, clients will include only the public header files of shared + libraries. These libraries might be installed in a different location, when + deployed. Therefore, it is important to exclude other internal header files + that were used when building the shared library. + + For example, the library might provide a class that wraps a hardware device + and contains a handle to that device, provided by some 3rd-party library: + + \code + #include <footronics/device.h> + + class MyDevice { + private: + FOOTRONICS_DEVICE_HANDLE handle; + }; + \endcode + + A similar situation arises with forms created by Qt Designer when using + aggregation or multiple inheritance: + + \code + #include "ui_widget.h" + + class MyWidget : public QWidget { + private: + Ui::MyWidget m_ui; + }; + \endcode + + When deploying the library, there should be no dependency to the internal + headers \c{footronics/device.h} or \c{ui_widget.h}. + + This can be avoided by making use of the \e{Pointer to implementation} + idiom described in various C++ programming books. For classes with + \e{value semantics}, consider using QSharedDataPointer. + + + \section1 Binary compatibility + + For clients loading a shared library, to work correctly, the memory + layout of the classes being used must match exactly the memory layout of + the library version that was used to compile the client. In other words, + the library found by the client at runtime must be \e{binary compatible} + with the version used at compile time. + + This is usually not a problem if the client is a self-contained software + package that ships all the libraries it needs. + + However, if the client application relies on a shared library that belongs + to a different installation package or to the operating system, then we + need to think of a versioning scheme for shared libraries and decide at + which level \e{Binary compatibility} is to be maintained. For example, Qt + libraries of the same \e{major version number} are guaranteed to be binary + compatible. + + Maintaining \e{Binary compatibility} places some restrictions on the changes + you can make to the classes. A good explanation can be found at + \l{http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++} + {KDE - Policies/Binary Compatibility Issues With C++}. These issues should + be considered right from the start of library design. + We recommend that the principle of \e{Information hiding} and the + \e{Pointer to implementation} technique be used wherever possible. +*/ diff --git a/doc/src/snippets/alphachannel.cpp b/doc/src/snippets/alphachannel.cpp index 7783271..ad0885a 100644 --- a/doc/src/snippets/alphachannel.cpp +++ b/doc/src/snippets/alphachannel.cpp @@ -47,11 +47,8 @@ #include <qfile.h> #include <qdir.h> #include <qfileinfo.h> - -#if (QT_VERSION) >= 0x040000 #include <QtGui> #include <QtCore> -#endif class MyClass : public QWidget { @@ -95,12 +92,10 @@ protected: //! [0] } - QPixmap channelImage, pixmap; + QPixmap channelImage, pixmap; QSize sizeHint() const { return QSize(500, 500); } }; - - int main(int argc, char **argv) { QApplication app(argc, argv); diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc index 844041a..b8bf571 100644 --- a/doc/src/snippets/code/doc_src_deployment.qdoc +++ b/doc/src/snippets/code/doc_src_deployment.qdoc @@ -407,3 +407,8 @@ Versions/A/QuartzCore libphonon_qt7.dylib QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk CONFIG+=x86 ppc //! [53] + + +//! [54] +qApp->addLibraryPath("C:/customPath/plugins"); +//! [54] diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 66bb998..e35dad9 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -44,7 +44,7 @@ PATH - to locate qmake, moc and other Qt tools //! [8] C: -cd /D C:\Qt\4.4.0-rc1 +cd /D C:\Qt\%VERSION% configure //! [8] diff --git a/doc/src/snippets/code/doc_src_qtestlib.qdoc b/doc/src/snippets/code/doc_src_qtestlib.qdoc index a4ef52e..ff52b2f 100644 --- a/doc/src/snippets/code/doc_src_qtestlib.qdoc +++ b/doc/src/snippets/code/doc_src_qtestlib.qdoc @@ -69,7 +69,7 @@ void TestQString::toUpper() //! [10] ********* Start testing of TestQString ********* -Config: Using QTest library 4.1.0, Qt 4.1.0 +Config: Using QTest library %VERSION%, Qt %VERSION% PASS : TestQString::initTestCase() PASS : TestQString::toUpper() PASS : TestQString::cleanupTestCase() @@ -99,4 +99,4 @@ private slots: } } }; -//! [12]
\ No newline at end of file +//! [12] diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp index 72663e9..287181a 100644 --- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp +++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp @@ -456,3 +456,11 @@ class MyClass : public QObject //! [45] QWidget w = QWidget(); //! [45] + +//! [46] + // Instead of comparing with 0.0 + qFuzzyCompare(0.0,1.0e-200); // This will return false + // Compare adding 1 to both values will fix the problem + qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true +//! [46] + diff --git a/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp index ca18465..c181a40 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp @@ -71,7 +71,7 @@ for(int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i) //! [methodCount] //! [6] -int methodIndex = pushButton->metaObject()->indexForMethod("animateClick"); +int methodIndex = pushButton->metaObject()->indexOfMethod("animateClick()"); QMetaMethod method = metaObject->method(methodIndex); method.invoke(pushButton, Qt::QueuedConnection); //! [6] @@ -82,7 +82,8 @@ QMetaMethod::invoke: Unable to handle unregistered datatype 'MyType' //! [8] QString retVal; -int methodIndex = obj->metaObject()->indexForMethod("compute"); +QByteArray normalizedSignature = QMetaObject::normalizedSignature("compute(QString, int, double)"); +int methodIndex = obj->metaObject()->indexOfMethod(normalizedSignature); QMetaMethod method = metaObject->method(methodIndex); method.invoke(obj, Qt::DirectConnection, diff --git a/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp b/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp index 355a237..783852b 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp @@ -33,7 +33,7 @@ MyStruct s2 = var.value<MyStruct>(); //! [3] int id = QMetaType::type("MyClass"); -if (id != -1) { +if (id == 0) { void *myClassPtr = QMetaType::construct(id); ... QMetaType::destroy(id, myClassPtr); diff --git a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp index a9c630b..5001984 100644 --- a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp +++ b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp @@ -11,7 +11,10 @@ public slots: QDesktopServices::setUrlHandler("help", helpInstance, "showHelp"); //! [0] - //! [1] mailto:user@foo.com?subject=Test&body=Just a test //! [1] + +//! [2] +QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode)); +//! [2] diff --git a/doc/src/snippets/qdebug/qdebug.pro b/doc/src/snippets/qdebug/qdebug.pro new file mode 100644 index 0000000..e62a71c --- /dev/null +++ b/doc/src/snippets/qdebug/qdebug.pro @@ -0,0 +1 @@ +SOURCES = qdebugsnippet.cpp diff --git a/doc/src/snippets/qdebugsnippet.cpp b/doc/src/snippets/qdebug/qdebugsnippet.cpp index 4c0d80d..b713f21 100644 --- a/doc/src/snippets/qdebugsnippet.cpp +++ b/doc/src/snippets/qdebug/qdebugsnippet.cpp @@ -62,9 +62,13 @@ QDebug operator<<(QDebug dbg, const Coordinate &c) int main(int argv, char **args) { - Coordinate nate; - nate.myX = 10; - nate.myY = 44; + Coordinate coordinate; + coordinate.myX = 10; + coordinate.myY = 44; - qDebug() << nate; +//! [1] + qDebug() << "Date:" << QDate::currentDate(); + qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40); + qDebug() << "Custom coordinate type:" << coordinate; +//! [1] } diff --git a/doc/src/snippets/qxmlstreamwriter/main.cpp b/doc/src/snippets/qxmlstreamwriter/main.cpp new file mode 100644 index 0000000..a0e7010 --- /dev/null +++ b/doc/src/snippets/qxmlstreamwriter/main.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QCoreApplication> +#include <QFile> +#include <QXmlStreamWriter> +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + QFile output; + output.open(stdout, QIODevice::WriteOnly); +//! [write output] +//! [start stream] + QXmlStreamWriter stream(&output); + stream.setAutoFormatting(true); + stream.writeStartDocument(); +//! [start stream] + stream.writeDTD("<!DOCTYPE xbel>"); + stream.writeStartElement("xbel"); + stream.writeAttribute("version", "1.0"); + stream.writeStartElement("folder"); + stream.writeAttribute("folded", "no"); +//! [write element] + stream.writeStartElement("bookmark"); + stream.writeAttribute("href", "http://www.qtsoftware.com/"); + stream.writeTextElement("title", "Qt Software"); + stream.writeEndElement(); // bookmark +//! [write element] + stream.writeEndElement(); // folder + stream.writeEndElement(); // xbel +//! [finish stream] + stream.writeEndDocument(); +//! [finish stream] +//! [write output] + output.close(); + return 0; +} diff --git a/doc/src/snippets/qxmlstreamwriter/qxmlstreamwriter.pro b/doc/src/snippets/qxmlstreamwriter/qxmlstreamwriter.pro new file mode 100644 index 0000000..8f74a5d --- /dev/null +++ b/doc/src/snippets/qxmlstreamwriter/qxmlstreamwriter.pro @@ -0,0 +1,2 @@ +SOURCES = main.cpp +QT += xml diff --git a/doc/src/snippets/xml/prettyprint/main.cpp b/doc/src/snippets/xml/prettyprint/main.cpp index 90f9f15..fa13ff6 100644 --- a/doc/src/snippets/xml/prettyprint/main.cpp +++ b/doc/src/snippets/xml/prettyprint/main.cpp @@ -48,7 +48,7 @@ #include <QXmlStreamReader> /* - This class exists for the solve purpose of creating a translation context. + This class exists for the sole purpose of creating a translation context. */ class PrettyPrint { diff --git a/doc/src/trolltech-webpages.qdoc b/doc/src/trolltech-webpages.qdoc index 5483a61..3897fcf 100644 --- a/doc/src/trolltech-webpages.qdoc +++ b/doc/src/trolltech-webpages.qdoc @@ -45,7 +45,7 @@ */ /*! - \externalpage http://www.qtsoftware.com/developer/notes/platforms/bugreport-form + \externalpage http://www.qtsoftware.com/bugreport-form \title Bug Report Form */ diff --git a/doc/src/tutorials/addressbook-sdk.qdoc b/doc/src/tutorials/addressbook-sdk.qdoc deleted file mode 100644 index af0013e..0000000 --- a/doc/src/tutorials/addressbook-sdk.qdoc +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page tutorials-addressbook-sdk.html - - \startpage {index.html}{Qt Reference Documentation} - \nextpage \l{Designing the User Interface}{Chapter 1} - - \title Address Book Tutorial - \ingroup howto - \ingroup tutorials - \brief An introduction to GUI programming with Qt and Qt Creator, - describing in detail how to put together a simple yet fully- - functioning application. - - This tutorial gives an introduction to GUI programming using the Qt SDK. - - ### Screenshot - - In the process, we will learn about some basic technologies provided by - Qt, such as: - - \list - \o Widgets and layout managers - \o Container classes - \o Signals and slots - \o Input and output devices - \endlist - - If you are completely new to Qt, please read \l{How to Learn Qt} if you - have not already done so. - - The tutorial's source code is located in Qt's - \c{examples/tutorials/addressbook} directory. - - Tutorial chapters: - - \list 1 - \o \l{Designing the User Interface} - \o \l{Adding Addresses} - \o \l{Navigating between Entries} - \o \l{Editing and Removing Addresses} - \o \l{Adding a Find Function} - \o \l{Loading and Saving} - \o \l{Additional Features} - \endlist - - Although this little application does not look much like a fully-fledged - modern GUI application, it uses many of the basic techniques that are used - in more complex applications. After you have worked through it, we - recommend checking out the \l{mainwindows/application}{Application} - example, which presents a small GUI application, with menus, toolbars, a - status bar, and so on. -*/ - - -/*! - \page tutorials-addressbook-sdk-part1.html - \contentspage {Address Book Tutorial}{Contents} - \nextpage \l{Adding Addresses}{Chapter 2} - \title Address Book 1 - Designing the User Interface - - The first part of this tutorial covers the design of the basic graphical - user interface (GUI) we use for the Address Book application. - - The first step to creating a GUI program is to design the user interface. - In this chapter, our goal is to set up the labels and input fields needed - to implement a basic address book application. The figure below is a - screenshot of our expected output. - - ### screenshot - - We begin by launching Qt Creator and use it to generate a new project. To - do this, select \gui New from the \gui File menu. In the - \gui{New File or Project} - -*/ diff --git a/doc/src/tutorials/widgets-tutorial.qdoc b/doc/src/tutorials/widgets-tutorial.qdoc index ce977f3..ead44af 100644 --- a/doc/src/tutorials/widgets-tutorial.qdoc +++ b/doc/src/tutorials/widgets-tutorial.qdoc @@ -80,7 +80,7 @@ \raw HTML <table align="left" width="100%"> - <tr><td> + <tr class="qt-code"><td> \endraw \snippet snippets/widgets-tutorial/toplevel/main.cpp create, resize and show \raw HTML @@ -98,7 +98,7 @@ \raw HTML <table align="left" width="100%"> - <tr><td> + <tr class="qt-code"><td> \endraw \snippet snippets/widgets-tutorial/childwidget/main.cpp create, position and show \raw HTML @@ -123,7 +123,7 @@ \raw HTML <table align="left" width="100%"> - <tr><td> + <tr class="qt-code"><td> \endraw \snippet snippets/widgets-tutorial/windowlayout/main.cpp create, lay out widgets and show \raw HTML @@ -157,7 +157,7 @@ \raw HTML <table align="left" width="100%"> - <tr><td> + <tr class="qt-code"><td> \endraw \snippet snippets/widgets-tutorial/nestedlayouts/main.cpp create, lay out widgets and show \raw HTML @@ -171,23 +171,4 @@ As well as QHBoxLayout and QVBoxLayout, Qt also provides QGridLayout and QFormLayout classes to help with more complex user interfaces. - - - - \omit - In the simple example below, the widget is created on the stack and will - automatically be deleted when the \c{main()} function exits. - - {{{#include <QtGui> - - int main(int argc, char *argv[]) - { - QApplication app(argc, argv); - QWidget window; - window.resize(480, 360); - window.show(); - return app.exec(); - } - }}} - \endomit */ diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standarddialogs/dialog.cpp index 0fe1f7e..1f7c5ef 100644 --- a/examples/dialogs/standarddialogs/dialog.cpp +++ b/examples/dialogs/standarddialogs/dialog.cpp @@ -59,7 +59,7 @@ Dialog::Dialog(QWidget *parent) integerLabel = new QLabel; integerLabel->setFrameStyle(frameStyle); QPushButton *integerButton = - new QPushButton(tr("QInputDialog::get&Integer()")); + new QPushButton(tr("QInputDialog::get&Int()")); doubleLabel = new QLabel; doubleLabel->setFrameStyle(frameStyle); @@ -198,8 +198,8 @@ void Dialog::setInteger() { //! [0] bool ok; - int i = QInputDialog::getInteger(this, tr("QInputDialog::getInteger()"), - tr("Percentage:"), 25, 0, 100, 1, &ok); + int i = QInputDialog::getInt(this, tr("QInputDialog::getInteger()"), + tr("Percentage:"), 25, 0, 100, 1, &ok); if (ok) integerLabel->setText(tr("%1%").arg(i)); //! [0] diff --git a/examples/graphicsview/collidingmice/main.cpp b/examples/graphicsview/collidingmice/main.cpp index 4a44481..23c91b0 100644 --- a/examples/graphicsview/collidingmice/main.cpp +++ b/examples/graphicsview/collidingmice/main.cpp @@ -83,6 +83,10 @@ int main(int argc, char **argv) view.resize(400, 300); view.show(); + QTimer timer; + QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance())); + timer.start(1000 / 33); + return app.exec(); } //! [6] diff --git a/examples/graphicsview/collidingmice/mouse.cpp b/examples/graphicsview/collidingmice/mouse.cpp index 1d10574..bbdb4e3 100644 --- a/examples/graphicsview/collidingmice/mouse.cpp +++ b/examples/graphicsview/collidingmice/mouse.cpp @@ -65,7 +65,6 @@ Mouse::Mouse() color(qrand() % 256, qrand() % 256, qrand() % 256) { rotate(qrand() % (360 * 16)); - startTimer(1000 / 33); } //! [0] @@ -123,8 +122,10 @@ void Mouse::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget * //! [3] //! [4] -void Mouse::timerEvent(QTimerEvent *) +void Mouse::advance(int step) { + if (!step) + return; //! [4] // Don't move too far away //! [5] diff --git a/examples/graphicsview/collidingmice/mouse.h b/examples/graphicsview/collidingmice/mouse.h index 832ea53..c08ce4a 100644 --- a/examples/graphicsview/collidingmice/mouse.h +++ b/examples/graphicsview/collidingmice/mouse.h @@ -43,13 +43,10 @@ #define MOUSE_H #include <QGraphicsItem> -#include <QObject> //! [0] -class Mouse : public QObject, public QGraphicsItem +class Mouse : public QGraphicsItem { - Q_OBJECT - public: Mouse(); @@ -59,7 +56,7 @@ public: QWidget *widget); protected: - void timerEvent(QTimerEvent *event); + void advance(int step); private: qreal angle; diff --git a/examples/itemviews/stardelegate/stardelegate.cpp b/examples/itemviews/stardelegate/stardelegate.cpp index 6c3677e..1e12971 100644 --- a/examples/itemviews/stardelegate/stardelegate.cpp +++ b/examples/itemviews/stardelegate/stardelegate.cpp @@ -58,7 +58,7 @@ void StarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, starRating.paint(painter, option.rect, option.palette, StarRating::ReadOnly); } else { - QItemDelegate::paint(painter, option, index); + QStyledItemDelegate::paint(painter, option, index); } //! [0] } @@ -71,7 +71,7 @@ QSize StarDelegate::sizeHint(const QStyleOptionViewItem &option, StarRating starRating = qVariantValue<StarRating>(index.data()); return starRating.sizeHint(); } else { - return QItemDelegate::sizeHint(option, index); + return QStyledItemDelegate::sizeHint(option, index); } } //! [1] @@ -88,7 +88,7 @@ QWidget *StarDelegate::createEditor(QWidget *parent, this, SLOT(commitAndCloseEditor())); return editor; } else { - return QItemDelegate::createEditor(parent, option, index); + return QStyledItemDelegate::createEditor(parent, option, index); } } //! [2] @@ -102,7 +102,7 @@ void StarDelegate::setEditorData(QWidget *editor, StarEditor *starEditor = qobject_cast<StarEditor *>(editor); starEditor->setStarRating(starRating); } else { - QItemDelegate::setEditorData(editor, index); + QStyledItemDelegate::setEditorData(editor, index); } } //! [3] @@ -115,7 +115,7 @@ void StarDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, StarEditor *starEditor = qobject_cast<StarEditor *>(editor); model->setData(index, qVariantFromValue(starEditor->starRating())); } else { - QItemDelegate::setModelData(editor, model, index); + QStyledItemDelegate::setModelData(editor, model, index); } } //! [4] diff --git a/examples/itemviews/stardelegate/stardelegate.h b/examples/itemviews/stardelegate/stardelegate.h index 8333da9..84814ed 100644 --- a/examples/itemviews/stardelegate/stardelegate.h +++ b/examples/itemviews/stardelegate/stardelegate.h @@ -42,15 +42,15 @@ #ifndef STARDELEGATE_H #define STARDELEGATE_H -#include <QItemDelegate> +#include <QStyledItemDelegate> //! [0] -class StarDelegate : public QItemDelegate +class StarDelegate : public QStyledItemDelegate { Q_OBJECT public: - StarDelegate(QWidget *parent = 0) : QItemDelegate(parent) {} + StarDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {} void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; diff --git a/examples/layouts/flowlayout/flowlayout.cpp b/examples/layouts/flowlayout/flowlayout.cpp index d1e857d..c4032d0 100644 --- a/examples/layouts/flowlayout/flowlayout.cpp +++ b/examples/layouts/flowlayout/flowlayout.cpp @@ -43,16 +43,16 @@ #include "flowlayout.h" -FlowLayout::FlowLayout(QWidget *parent, int margin, int spacing) - : QLayout(parent) +FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing) + : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing) { - setMargin(margin); - setSpacing(spacing); + setContentsMargins(margin, margin, margin, margin); } -FlowLayout::FlowLayout(int spacing) +FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing) + : m_hSpace(hSpacing), m_vSpace(vSpacing) { - setSpacing(spacing); + setContentsMargins(margin, margin, margin, margin); } FlowLayout::~FlowLayout() @@ -67,6 +67,24 @@ void FlowLayout::addItem(QLayoutItem *item) itemList.append(item); } +int FlowLayout::horizontalSpacing() const +{ + if (m_hSpace >= 0) { + return m_hSpace; + } else { + return smartSpacing(QStyle::PM_LayoutHorizontalSpacing); + } +} + +int FlowLayout::verticalSpacing() const +{ + if (m_vSpace >= 0) { + return m_vSpace; + } else { + return smartSpacing(QStyle::PM_LayoutVerticalSpacing); + } +} + int FlowLayout::count() const { return itemList.size(); @@ -125,20 +143,27 @@ QSize FlowLayout::minimumSize() const int FlowLayout::doLayout(const QRect &rect, bool testOnly) const { - int x = rect.x(); - int y = rect.y(); + int left, top, right, bottom; + getContentsMargins(&left, &top, &right, &bottom); + QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom); + int x = effectiveRect.x(); + int y = effectiveRect.y(); int lineHeight = 0; QLayoutItem *item; foreach (item, itemList) { QWidget *wid = item->widget(); - int spaceX = spacing() + wid->style()->layoutSpacing( + int spaceX = horizontalSpacing(); + if (spaceX == -1) + spaceX = wid->style()->layoutSpacing( QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal); - int spaceY = spacing() + wid->style()->layoutSpacing( + int spaceY = verticalSpacing(); + if (spaceY == -1) + spaceY = wid->style()->layoutSpacing( QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Vertical); int nextX = x + item->sizeHint().width() + spaceX; - if (nextX - spaceX > rect.right() && lineHeight > 0) { - x = rect.x(); + if (nextX - spaceX > effectiveRect.right() && lineHeight > 0) { + x = effectiveRect.x(); y = y + lineHeight + spaceY; nextX = x + item->sizeHint().width() + spaceX; lineHeight = 0; @@ -150,5 +175,19 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const x = nextX; lineHeight = qMax(lineHeight, item->sizeHint().height()); } - return y + lineHeight - rect.y(); + return y + lineHeight - rect.y() + bottom; +} + +int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const +{ + QObject *parent = this->parent(); + if (!parent) { + return -1; + } else if (parent->isWidgetType()) { + QWidget *pw = static_cast<QWidget *>(parent); + return pw->style()->pixelMetric(pm, 0, pw); + } else { + return static_cast<QLayout *>(parent)->spacing(); + } } + diff --git a/examples/layouts/flowlayout/flowlayout.h b/examples/layouts/flowlayout/flowlayout.h index f864d8e..9940e55 100644 --- a/examples/layouts/flowlayout/flowlayout.h +++ b/examples/layouts/flowlayout/flowlayout.h @@ -49,11 +49,13 @@ class FlowLayout : public QLayout { public: - FlowLayout(QWidget *parent, int margin = -1, int spacing = 0); - FlowLayout(int spacing = 0); + FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1); + FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1); ~FlowLayout(); void addItem(QLayoutItem *item); + int horizontalSpacing() const; + int verticalSpacing() const; Qt::Orientations expandingDirections() const; bool hasHeightForWidth() const; int heightForWidth(int) const; @@ -66,8 +68,11 @@ public: private: int doLayout(const QRect &rect, bool testOnly) const; + int smartSpacing(QStyle::PixelMetric pm) const; QList<QLayoutItem *> itemList; + int m_hSpace; + int m_vSpace; }; #endif diff --git a/examples/painting/painting.pro b/examples/painting/painting.pro index b6fad5a..6d00720 100644 --- a/examples/painting/painting.pro +++ b/examples/painting/painting.pro @@ -7,7 +7,7 @@ SUBDIRS = basicdrawing \ !wince*: SUBDIRS += fontsampler -contains(QT_CONFIG, svg): SUBDIRS += svgviewer +contains(QT_CONFIG, svg): SUBDIRS += svggenerator svgviewer # install target.path = $$[QT_INSTALL_EXAMPLES]/painting diff --git a/examples/painting/svggenerator/displaywidget.cpp b/examples/painting/svggenerator/displaywidget.cpp new file mode 100644 index 0000000..c973341 --- /dev/null +++ b/examples/painting/svggenerator/displaywidget.cpp @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include "displaywidget.h" + +DisplayWidget::DisplayWidget(QWidget *parent) + : QWidget(parent) +{ + QPainterPath car; + QPainterPath house; + + QFile file(":resources/shapes.dat"); + file.open(QFile::ReadOnly); + QDataStream stream(&file); + stream >> car >> house >> tree >> moon; + file.close(); + + shapeMap[Car] = car; + shapeMap[House] = house; + + background = Sky; + shapeColor = Qt::darkYellow; + shape = House; +} + +//! [paint event] +void DisplayWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter; + painter.begin(this); + painter.setRenderHint(QPainter::Antialiasing); + paint(painter); + painter.end(); +} +//! [paint event] + +//! [paint function] +void DisplayWidget::paint(QPainter &painter) +{ +//![paint picture] + painter.setClipRect(QRect(0, 0, 200, 200)); + painter.setPen(Qt::NoPen); + + switch (background) { + case Sky: + default: + painter.fillRect(QRect(0, 0, 200, 200), Qt::darkBlue); + painter.translate(145, 10); + painter.setBrush(Qt::white); + painter.drawPath(moon); + painter.translate(-145, -10); + break; + case Trees: + { + painter.fillRect(QRect(0, 0, 200, 200), Qt::darkGreen); + painter.setBrush(Qt::green); + painter.setPen(Qt::black); + for (int y = -55, row = 0; y < 200; y += 50, ++row) { + int xs; + if (row == 2 || row == 3) + xs = 150; + else + xs = 50; + for (int x = 0; x < 200; x += xs) { + painter.save(); + painter.translate(x, y); + painter.drawPath(tree); + painter.restore(); + } + } + break; + } + case Road: + painter.fillRect(QRect(0, 0, 200, 200), Qt::gray); + painter.setPen(QPen(Qt::white, 4, Qt::DashLine)); + painter.drawLine(QLine(0, 35, 200, 35)); + painter.drawLine(QLine(0, 165, 200, 165)); + break; + } + + painter.setBrush(shapeColor); + painter.setPen(Qt::black); + painter.translate(100, 100); + painter.drawPath(shapeMap[shape]); +//![paint picture] +} +//! [paint function] + +QColor DisplayWidget::color() const +{ + return shapeColor; +} + +void DisplayWidget::setBackground(Background background) +{ + this->background = background; + update(); +} + +void DisplayWidget::setColor(const QColor &color) +{ + this->shapeColor = color; + update(); +} + +void DisplayWidget::setShape(Shape shape) +{ + this->shape = shape; + update(); +} diff --git a/util/scripts/win-binary/nsis/qtnsisext/licensefinder.h b/examples/painting/svggenerator/displaywidget.h index 0957d65..58ad97e 100644 --- a/util/scripts/win-binary/nsis/qtnsisext/licensefinder.h +++ b/examples/painting/svggenerator/displaywidget.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,37 +38,43 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef LICENSEFINDER_H -#define LICENSEFINDER_H -#define MAX_KEY_LENGTH 512 -#define MAX_LICENSEE_LENGTH 512 -#define MAX_QT3INFO_LENGTH 512 +#ifndef DISPLAYWIDGET_H +#define DISPLAYWIDGET_H -typedef unsigned long ulong; +#include <QColor> +#include <QHash> +#include <QWidget> -class LicenseFinder +//! [DisplayWidget class definition] +class DisplayWidget : public QWidget { + Q_OBJECT + public: - LicenseFinder(); - char *getLicenseKey(); - char *getOldLicenseKey(); - char *getLicensee(); - char *getCustomerID(); - char *getProducts(); - char *getExpiryDate(); + enum Shape { House = 0, Car = 1 }; + enum Background { Sky = 0, Trees = 1, Road = 2 }; + + DisplayWidget(QWidget *parent = 0); + QColor color() const; + void paint(QPainter &painter); + +public slots: + void setBackground(Background background); + void setColor(const QColor &color); + void setShape(Shape shape); + +protected: + void paintEvent(QPaintEvent *event); private: - void searchLicense(); - bool lookInDirectory(const char* dir); - char *findPattern(char *h, const char *n, ulong hlen); - bool searched; - char m_key[MAX_KEY_LENGTH]; - char m_oldkey[MAX_KEY_LENGTH]; - char licensee[MAX_LICENSEE_LENGTH]; - char m_customerId[MAX_QT3INFO_LENGTH]; - char m_products[MAX_QT3INFO_LENGTH]; - char m_expiryDate[MAX_QT3INFO_LENGTH]; + Background background; + QColor shapeColor; + Shape shape; + QHash<Shape,QPainterPath> shapeMap; + QPainterPath moon; + QPainterPath tree; }; +//! [DisplayWidget class definition] -#endif
\ No newline at end of file +#endif diff --git a/examples/painting/svggenerator/forms/window.ui b/examples/painting/svggenerator/forms/window.ui new file mode 100644 index 0000000..bf11908 --- /dev/null +++ b/examples/painting/svggenerator/forms/window.ui @@ -0,0 +1,249 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Window</class> + <widget class="QWidget" name="Window"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>339</width> + <height>353</height> + </rect> + </property> + <property name="windowTitle"> + <string>SVG Generator</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="sizeConstraint"> + <enum>QLayout::SetFixedSize</enum> + </property> + <item row="0" column="0"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1"> + <widget class="DisplayWidget" name="displayWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>200</horstretch> + <verstretch>200</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>200</width> + <height>200</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>200</height> + </size> + </property> + </widget> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" colspan="3"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>&Shape:</string> + </property> + <property name="buddy"> + <cstring>shapeComboBox</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="shapeComboBox"> + <item> + <property name="text"> + <string>House</string> + </property> + </item> + <item> + <property name="text"> + <string>Car</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>&Color:</string> + </property> + <property name="buddy"> + <cstring>colorButton</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QToolButton" name="colorButton"> + <property name="text"> + <string>Choose Color...</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>&Background:</string> + </property> + <property name="buddy"> + <cstring>shapeComboBox_2</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="shapeComboBox_2"> + <item> + <property name="text"> + <string>Sky</string> + </property> + </item> + <item> + <property name="text"> + <string>Trees</string> + </property> + </item> + <item> + <property name="text"> + <string>Road</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item row="2" column="0" colspan="3"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QToolButton" name="toolButton_2"> + <property name="text"> + <string>Save &As...</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>DisplayWidget</class> + <extends>QWidget</extends> + <header>displaywidget.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections> + <connection> + <sender>shapeComboBox</sender> + <signal>currentIndexChanged(int)</signal> + <receiver>Window</receiver> + <slot>updateShape(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>288</x> + <y>232</y> + </hint> + <hint type="destinationlabel"> + <x>336</x> + <y>234</y> + </hint> + </hints> + </connection> + <connection> + <sender>colorButton</sender> + <signal>clicked()</signal> + <receiver>Window</receiver> + <slot>updateColor()</slot> + <hints> + <hint type="sourcelabel"> + <x>301</x> + <y>262</y> + </hint> + <hint type="destinationlabel"> + <x>337</x> + <y>267</y> + </hint> + </hints> + </connection> + <connection> + <sender>shapeComboBox_2</sender> + <signal>currentIndexChanged(int)</signal> + <receiver>Window</receiver> + <slot>updateBackground(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>306</x> + <y>299</y> + </hint> + <hint type="destinationlabel"> + <x>337</x> + <y>311</y> + </hint> + </hints> + </connection> + <connection> + <sender>toolButton_2</sender> + <signal>clicked()</signal> + <receiver>Window</receiver> + <slot>saveSvg()</slot> + <hints> + <hint type="sourcelabel"> + <x>298</x> + <y>336</y> + </hint> + <hint type="destinationlabel"> + <x>307</x> + <y>348</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <slot>updateBackground(int)</slot> + <slot>updateColor()</slot> + <slot>updateShape(int)</slot> + <slot>saveSvg()</slot> + </slots> +</ui> diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/main.cpp b/examples/painting/svggenerator/main.cpp index f67c971..fa8b0ab 100644 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/main.cpp +++ b/examples/painting/svggenerator/main.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,15 +38,15 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <QtGui/QtGui> -int main(int argc, char **argv) -{ - QApplication a(argc, argv); +#include <QApplication> - QLabel label; - label.setText("Hello world!"); - label.show(); +#include "window.h" - return a.exec(); +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + Window window; + window.show(); + return app.exec(); } diff --git a/examples/painting/svggenerator/resources/shapes.dat b/examples/painting/svggenerator/resources/shapes.dat Binary files differnew file mode 100644 index 0000000..d9b981e --- /dev/null +++ b/examples/painting/svggenerator/resources/shapes.dat diff --git a/examples/painting/svggenerator/svggenerator.pro b/examples/painting/svggenerator/svggenerator.pro new file mode 100644 index 0000000..4d08ba4 --- /dev/null +++ b/examples/painting/svggenerator/svggenerator.pro @@ -0,0 +1,15 @@ +FORMS = forms/window.ui +HEADERS = displaywidget.h \ + window.h +RESOURCES = svggenerator.qrc +SOURCES = displaywidget.cpp \ + main.cpp \ + window.cpp + +QT += svg + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/painting/svggenerator +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS svggenerator.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/painting/svggenerator +INSTALLS += target sources diff --git a/examples/painting/svggenerator/svggenerator.qrc b/examples/painting/svggenerator/svggenerator.qrc new file mode 100644 index 0000000..061d1f6 --- /dev/null +++ b/examples/painting/svggenerator/svggenerator.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>resources/shapes.dat</file> +</qresource> +</RCC> diff --git a/examples/painting/svggenerator/window.cpp b/examples/painting/svggenerator/window.cpp new file mode 100644 index 0000000..1965604 --- /dev/null +++ b/examples/painting/svggenerator/window.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QColorDialog> +#include <QFileDialog> +#include <QPainter> +#include <QSvgGenerator> +#include "window.h" +#include "displaywidget.h" + +Window::Window(QWidget *parent) + : QWidget(parent) +{ + setupUi(this); +} + +void Window::updateBackground(int background) +{ + displayWidget->setBackground(DisplayWidget::Background(background)); +} + +void Window::updateColor() +{ + QColor color = QColorDialog::getColor(displayWidget->color()); + if (color.isValid()) + displayWidget->setColor(color); +} + +void Window::updateShape(int shape) +{ + displayWidget->setShape(DisplayWidget::Shape(shape)); +} + +//! [save SVG] +void Window::saveSvg() +{ + QString newPath = QFileDialog::getSaveFileName(this, tr("Save SVG"), + path, tr("SVG files (*.svg)")); + + if (newPath.isEmpty()) + return; + + path = newPath; + +//![configure SVG generator] + QSvgGenerator generator; + generator.setFileName(path); + generator.setSize(QSize(200, 200)); + generator.setViewBox(QRect(0, 0, 200, 200)); + generator.setTitle(tr("SVG Generator Example Drawing")); + generator.setDescription(tr("An SVG drawing created by the SVG Generator " + "Example provided with Qt.")); +//![configure SVG generator] +//![begin painting] + QPainter painter; + painter.begin(&generator); +//![begin painting] + displayWidget->paint(painter); +//![end painting] + painter.end(); +//![end painting] +} +//! [save SVG] diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/C++ Class.pbfiletemplate/class.h b/examples/painting/svggenerator/window.h index c48011d4..4bc4d22 100644 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/C++ Class.pbfiletemplate/class.h +++ b/examples/painting/svggenerator/window.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,25 +38,29 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -/* - * «FILENAME» - * «PROJECTNAME» - * - * Created by «FULLUSERNAME» on «DATE». - * Copyright (c) «YEAR» «ORGANIZATIONNAME». All rights reserved. - * - */ -#ifndef «FILEBASENAME»__HEADER +#ifndef WINDOW_H +#define WINDOW_H -#include <QtGui/QtGui> +#include "ui_window.h" -class «FILEBASENAME» : public QWidget +//! [Window class definition] +class Window : public QWidget, private Ui::Window { Q_OBJECT + public: - «FILEBASENAME»(QWidget *parent=0); - ~«FILEBASENAME»(); + Window(QWidget *parent = 0); + +public slots: + void saveSvg(); + void updateBackground(int background); + void updateColor(); + void updateShape(int shape); + +private: + QString path; }; +//! [Window class definition] -#endif //«FILEBASENAME»__HEADER +#endif diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/C++ Class.pbfiletemplate/class.cpp b/examples/threads/queuedcustomtype/block.cpp index d790000..1a14f09 100644 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/C++ Class.pbfiletemplate/class.cpp +++ b/examples/threads/queuedcustomtype/block.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,24 +38,37 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -/* - * «FILENAME» - * «PROJECTNAME» - * - * Created by «FULLUSERNAME» on «DATE». - * Copyright (c) «YEAR» «ORGANIZATIONNAME». All rights reserved. - * - */ -#include "«FILEBASENAME».h" +#include <QColor> +#include <QRect> +#include "block.h" -«FILEBASENAME»::«FILEBASENAME»(QWidget *parent) : QWidget(parent) +Block::Block() { +} +Block::Block(const Block &other) +{ + m_rect = other.m_rect; + m_color = other.m_color; +} +Block::~Block() +{ } -«FILEBASENAME»::~«FILEBASENAME»() +Block::Block(const QRect &rect, const QColor &color) { + m_rect = rect; + m_color = color; +} +QColor Block::color() const +{ + return m_color; +} + +QRect Block::rect() const +{ + return m_rect; } diff --git a/util/scripts/mac-binary/package/InstallerPane/helpfulfunc.h b/examples/threads/queuedcustomtype/block.h index b774f60..2a75529 100644 --- a/util/scripts/mac-binary/package/InstallerPane/helpfulfunc.h +++ b/examples/threads/queuedcustomtype/block.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,25 +38,34 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -/* - * helpfulfunc.h - * InstallerPane - * - * Created by Trenton Schulz on 7/27/05. - * Copyright 2005 __MyCompanyName__. All rights reserved. - * - */ -#ifndef HELPFULFUNC_H -#define HELPFULFUNC_H +#ifndef BLOCK_H +#define BLOCK_H -#import <stdio.h> +#include <QColor> +#include <QDebug> +#include <QMetaType> +#include <QRect> -extern const char LicenseeString[]; -extern const char LicenseKeyExtString[]; +//! [custom type definition and meta-type declaration] +class Block +{ +public: + Block(); + Block(const Block &other); + ~Block(); -enum LicenseValues { LicenseOK = 0, InvalidLicense, InvalidProduct, InvalidPlatform, InvalidType, LicenseExpired }; + Block(const QRect &rect, const QColor &color); -int validateLicense(const char *string); + QColor color() const; + QRect rect() const; -#endif // HELPFULFUNC_H
\ No newline at end of file +private: + QRect m_rect; + QColor m_color; +}; + +Q_DECLARE_METATYPE(Block); +//! [custom type definition and meta-type declaration] + +#endif diff --git a/examples/threads/queuedcustomtype/main.cpp b/examples/threads/queuedcustomtype/main.cpp new file mode 100644 index 0000000..93dab49 --- /dev/null +++ b/examples/threads/queuedcustomtype/main.cpp @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QPainter> +#include <QTime> +#include "block.h" +#include "window.h" + +QImage createImage(int width, int height) +{ + QImage image(width, height, QImage::Format_RGB16); + QPainter painter; + QPen pen; + pen.setStyle(Qt::NoPen); + QBrush brush(Qt::blue); + + painter.begin(&image); + painter.fillRect(image.rect(), brush); + brush.setColor(Qt::white); + painter.setPen(pen); + painter.setBrush(brush); + + static const QPointF points1[3] = { + QPointF(4, 4), + QPointF(7, 4), + QPointF(5.5, 1) + }; + + static const QPointF points2[3] = { + QPointF(1, 4), + QPointF(7, 4), + QPointF(10, 10) + }; + + static const QPointF points3[3] = { + QPointF(4, 4), + QPointF(10, 4), + QPointF(1, 10) + }; + + painter.setWindow(0, 0, 10, 10); + + int x = 0; + int y = 0; + int starWidth = image.width()/3; + int starHeight = image.height()/3; + + QRect rect(x, y, starWidth, starHeight); + + for (int i = 0; i < 9; ++i) { + + painter.setViewport(rect); + painter.drawPolygon(points1, 3); + painter.drawPolygon(points2, 3); + painter.drawPolygon(points3, 3); + + if (i % 3 == 2) { + y = y + starHeight; + rect.moveTop(y); + + x = 0; + rect.moveLeft(x); + + } else { + x = x + starWidth; + rect.moveLeft(x); + } + } + + painter.end(); + return image; +} + +//! [main function] //! [main start] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); +//! [main start] //! [register meta-type for queued communications] + qRegisterMetaType<Block>(); +//! [register meta-type for queued communications] + qsrand(QTime::currentTime().elapsed()); + + Window window; + window.show(); + + window.loadImage(createImage(256, 256)); +//! [main finish] + return app.exec(); +} +//! [main finish] //! [main function] diff --git a/examples/threads/queuedcustomtype/queuedcustomtype.pro b/examples/threads/queuedcustomtype/queuedcustomtype.pro new file mode 100644 index 0000000..6f39121 --- /dev/null +++ b/examples/threads/queuedcustomtype/queuedcustomtype.pro @@ -0,0 +1,7 @@ +HEADERS = block.h \ + renderthread.h \ + window.h +SOURCES = main.cpp \ + block.cpp \ + renderthread.cpp \ + window.cpp diff --git a/examples/threads/queuedcustomtype/renderthread.cpp b/examples/threads/queuedcustomtype/renderthread.cpp new file mode 100644 index 0000000..052dd39 --- /dev/null +++ b/examples/threads/queuedcustomtype/renderthread.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "renderthread.h" + +RenderThread::RenderThread(QObject *parent) + : QThread(parent) +{ + m_abort = false; +} + +RenderThread::~RenderThread() +{ + mutex.lock(); + m_abort = true; + mutex.unlock(); + + wait(); +} + +//![processing the image (start)] +void RenderThread::processImage(const QImage &image) +{ + if (image.isNull()) + return; + + m_image = image; + m_abort = false; + start(); +} + +void RenderThread::run() +{ + int size = qMax(m_image.width()/20, m_image.height()/20); + for (int s = size; s > 0; --s) { + for (int c = 0; c < 400; ++c) { +//![processing the image (start)] + int x1 = qMax(0, (qrand() % m_image.width()) - s/2); + int x2 = qMin(x1 + s/2 + 1, m_image.width()); + int y1 = qMax(0, (qrand() % m_image.height()) - s/2); + int y2 = qMin(y1 + s/2 + 1, m_image.height()); + int n = 0; + int red = 0; + int green = 0; + int blue = 0; + for (int i = y1; i < y2; ++i) { + for (int j = x1; j < x2; ++j) { + QRgb pixel = m_image.pixel(j, i); + red += qRed(pixel); + green += qGreen(pixel); + blue += qBlue(pixel); + n += 1; + } + } +//![processing the image (finish)] + Block block(QRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1), + QColor(red/n, green/n, blue/n)); + emit sendBlock(block); + if (m_abort) + return; + msleep(10); + } + } +} +//![processing the image (finish)] + +void RenderThread::stopProcess() +{ + mutex.lock(); + m_abort = true; + mutex.unlock(); +} diff --git a/examples/threads/queuedcustomtype/renderthread.h b/examples/threads/queuedcustomtype/renderthread.h new file mode 100644 index 0000000..9c7f049 --- /dev/null +++ b/examples/threads/queuedcustomtype/renderthread.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef RENDERTHREAD_H +#define RENDERTHREAD_H + +#include <QImage> +#include <QMutex> +#include <QThread> +#include "block.h" + +//! [RenderThread class definition] +class RenderThread : public QThread +{ + Q_OBJECT + +public: + RenderThread(QObject *parent = 0); + ~RenderThread(); + + void processImage(const QImage &image); + +signals: + void sendBlock(const Block &block); + +public slots: + void stopProcess(); + +protected: + void run(); + +private: + bool m_abort; + QImage m_image; + QMutex mutex; +}; +//! [RenderThread class definition] + +#endif diff --git a/examples/threads/queuedcustomtype/window.cpp b/examples/threads/queuedcustomtype/window.cpp new file mode 100644 index 0000000..7282e0c --- /dev/null +++ b/examples/threads/queuedcustomtype/window.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include "window.h" + +//! [Window constructor start] +Window::Window() +{ + thread = new RenderThread(); +//! [Window constructor start] //! [set up widgets and connections] + + label = new QLabel(); + label->setAlignment(Qt::AlignCenter); + + loadButton = new QPushButton(tr("&Load image...")); + resetButton = new QPushButton(tr("&Stop")); + resetButton->setEnabled(false); + + connect(loadButton, SIGNAL(clicked()), this, SLOT(loadImage())); + connect(resetButton, SIGNAL(clicked()), thread, SLOT(stopProcess())); + connect(thread, SIGNAL(finished()), this, SLOT(resetUi())); +//! [set up widgets and connections] //! [connecting signal with custom type] + connect(thread, SIGNAL(sendBlock(Block)), this, SLOT(addBlock(Block))); +//! [connecting signal with custom type] + + QHBoxLayout *buttonLayout = new QHBoxLayout(); + buttonLayout->addStretch(); + buttonLayout->addWidget(loadButton); + buttonLayout->addWidget(resetButton); + buttonLayout->addStretch(); + + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(label); + layout->addLayout(buttonLayout); + +//! [Window constructor finish] + setWindowTitle(tr("Queued Custom Type")); +} +//! [Window constructor finish] + +void Window::loadImage() +{ + QStringList formats; + foreach (QByteArray format, QImageReader::supportedImageFormats()) + if (format.toLower() == format) + formats.append("*." + format); + + QString newPath = QFileDialog::getOpenFileName(this, tr("Open Image"), + path, tr("Image files (%1)").arg(formats.join(" "))); + + if (newPath.isEmpty()) + return; + + QImage image(newPath); + if (!image.isNull()) { + loadImage(image); + path = newPath; + } +} + +void Window::loadImage(const QImage &image) +{ + QDesktopWidget desktop; + QImage useImage; + QRect space = desktop.availableGeometry(); + if (image.width() > 0.75*space.width() || image.height() > 0.75*space.height()) + useImage = image.scaled(0.75*space.width(), 0.75*space.height(), + Qt::KeepAspectRatio, Qt::SmoothTransformation); + else + useImage = image; + + pixmap = QPixmap(useImage.width(), useImage.height()); + pixmap.fill(qRgb(255, 255, 255)); + label->setPixmap(pixmap); + loadButton->setEnabled(false); + resetButton->setEnabled(true); + thread->processImage(useImage); +} + +//! [Adding blocks to the display] +void Window::addBlock(const Block &block) +{ + QColor color = block.color(); + color.setAlpha(64); + + QPainter painter; + painter.begin(&pixmap); + painter.fillRect(block.rect(), color); + painter.end(); + label->setPixmap(pixmap); +} +//! [Adding blocks to the display] + +void Window::resetUi() +{ + loadButton->setEnabled(true); + resetButton->setEnabled(false); +} diff --git a/examples/threads/queuedcustomtype/window.h b/examples/threads/queuedcustomtype/window.h new file mode 100644 index 0000000..c0ed280 --- /dev/null +++ b/examples/threads/queuedcustomtype/window.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WINDOW_H +#define WINDOW_H + +#include <QWidget> +#include "renderthread.h" + +class QLabel; +class QPushButton; + +//! [Window class definition] +class Window : public QWidget +{ + Q_OBJECT + +public: + Window(); + void loadImage(const QImage &image); + +public slots: + void addBlock(const Block &block); + +private slots: + void loadImage(); + void resetUi(); + +private: + QLabel *label; + QPixmap pixmap; + QPushButton *loadButton; + QPushButton *resetButton; + QString path; + RenderThread *thread; +}; +//! [Window class definition] + +#endif diff --git a/examples/tools/customtype/customtype.pro b/examples/tools/customtype/customtype.pro new file mode 100644 index 0000000..3079964 --- /dev/null +++ b/examples/tools/customtype/customtype.pro @@ -0,0 +1,3 @@ +HEADERS = message.h +SOURCES = main.cpp \ + message.cpp diff --git a/util/scripts/mac-binary/package/keydecoder/main.cpp b/examples/tools/customtype/main.cpp index 3aa37f9..e8f4265 100644 --- a/util/scripts/mac-binary/package/keydecoder/main.cpp +++ b/examples/tools/customtype/main.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,17 +38,37 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <cstdio> -#include "../InstallerPane/keydec.h" -int main(int argc, char **argv) +#include <QCoreApplication> +#include <QVariant> +#include "message.h" + +int main(int argc, char *argv[]) { - if (argc != 2) - return 1; - KeyDecoder key(argv[1]); - if (!key.IsValid()) - return 2; - CDate date = key.getExpiryDate(); - fprintf(stdout, "%04d-%02d-%02d\n", date.year(), date.month(), date.day()); + QCoreApplication app(argc, argv); + QStringList headers; + headers << "Subject: Hello World" + << "From: qt-info@nokia.com"; + QString body = "This is a test.\r\n"; + +//! [printing a custom type] + Message message(body, headers); + qDebug() << "Original:" << message; +//! [printing a custom type] + +//! [storing a custom value] + QVariant stored; + stored.setValue(message); +//! [storing a custom value] + + qDebug() << "Stored:" << stored; + +//! [retrieving a custom value] + Message retrieved = stored.value<Message>(); + qDebug() << "Retrieved:" << retrieved; + retrieved = qVariantValue<Message>(stored); + qDebug() << "Retrieved:" << retrieved; +//! [retrieving a custom value] + return 0; } diff --git a/examples/tools/customtype/message.cpp b/examples/tools/customtype/message.cpp new file mode 100644 index 0000000..b6fd536 --- /dev/null +++ b/examples/tools/customtype/message.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "message.h" + +//! [Message class implementation] +Message::Message() +{ +} + +Message::Message(const Message &other) +{ + m_body = other.m_body; + m_headers = other.m_headers; +} + +Message::~Message() +{ +} +//! [Message class implementation] + +Message::Message(const QString &body, const QStringList &headers) +{ + m_body = body; + m_headers = headers; +} + +//! [custom type streaming operator] +QDebug &operator<<(QDebug &dbg, const Message &message) +{ + QStringList pieces = message.body().split("\r\n", QString::SkipEmptyParts); + if (pieces.isEmpty()) + dbg.nospace() << "Message()"; + else if (pieces.size() == 1) + dbg.nospace() << "Message(" << pieces.first() << ")"; + else + dbg.nospace() << "Message(" << pieces.first() << " ...)"; + return dbg.maybeSpace(); +} +//! [custom type streaming operator] + +//! [getter functions] +QString Message::body() const +{ + return m_body; +} + +QStringList Message::headers() const +{ + return m_headers; +} +//! [getter functions] diff --git a/examples/tools/customtype/message.h b/examples/tools/customtype/message.h new file mode 100644 index 0000000..2620557 --- /dev/null +++ b/examples/tools/customtype/message.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MESSAGE_H +#define MESSAGE_H + +#include <QDebug> +#include <QMetaType> +#include <QStringList> + +//! [custom type definition] +class Message +{ +public: + Message(); + Message(const Message &other); + ~Message(); + + Message(const QString &body, const QStringList &headers); + + QString body() const; + QStringList headers() const; + +private: + QString m_body; + QStringList m_headers; +}; +//! [custom type definition] + +//! [custom type meta-type declaration] +Q_DECLARE_METATYPE(Message); +//! [custom type meta-type declaration] + +//! [custom type streaming operator] +QDebug &operator<<(QDebug &dbg, const Message &message); +//! [custom type streaming operator] + +#endif diff --git a/examples/tools/customtypesending/customtypesending.pro b/examples/tools/customtypesending/customtypesending.pro new file mode 100644 index 0000000..b8b2aaf --- /dev/null +++ b/examples/tools/customtypesending/customtypesending.pro @@ -0,0 +1,5 @@ +HEADERS = message.h \ + window.h +SOURCES = main.cpp \ + message.cpp \ + window.cpp diff --git a/examples/tools/customtypesending/main.cpp b/examples/tools/customtypesending/main.cpp new file mode 100644 index 0000000..336f3d8 --- /dev/null +++ b/examples/tools/customtypesending/main.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include "message.h" +#include "window.h" + +//! [main function] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + Window window1; + QStringList headers; + headers << "Subject: Hello World" + << "From: qt-info@nokia.com"; + QString body = "This is a test.\r\n"; + Message message(body, headers); + window1.setMessage(message); + + Window window2; + QObject::connect(&window1, SIGNAL(messageSent(Message)), + &window2, SLOT(setMessage(Message))); + QObject::connect(&window2, SIGNAL(messageSent(Message)), + &window1, SLOT(setMessage(Message))); + window1.show(); + window2.show(); + return app.exec(); +} +//! [main function] diff --git a/util/scripts/mac-binary/package/InstallerPane/InstallerSecionSection.h b/examples/tools/customtypesending/message.cpp index 6b3abbe..6992804 100644 --- a/util/scripts/mac-binary/package/InstallerPane/InstallerSecionSection.h +++ b/examples/tools/customtypesending/message.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,19 +38,35 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -// -// InstallerSecionSection.h -// InstallerPane -// -// Created by Trenton Schulz on 7/27/05. -// Copyright 2005 __MyCompanyName__. All rights reserved. -// -#import <Cocoa/Cocoa.h> -#include <InstallerPlugins/InstallerSection.h> +#include "message.h" -@interface InstallerSecionSection : InstallerSection { +Message::Message() +{ +} + +Message::Message(const Message &other) +{ + m_body = other.m_body; + m_headers = other.m_headers; +} + +Message::~Message() +{ +} + +Message::Message(const QString &body, const QStringList &headers) +{ + m_body = body; + m_headers = headers; +} +QString Message::body() const +{ + return m_body; } -@end +QStringList Message::headers() const +{ + return m_headers; +} diff --git a/examples/tools/customtypesending/message.h b/examples/tools/customtypesending/message.h new file mode 100644 index 0000000..55f9568 --- /dev/null +++ b/examples/tools/customtypesending/message.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MESSAGE_H +#define MESSAGE_H + +#include <QDebug> +#include <QMetaType> +#include <QStringList> + +//! [custom type definition] +class Message +{ +public: + Message(); + Message(const Message &other); + ~Message(); + + Message(const QString &body, const QStringList &headers); + + QString body() const; + QStringList headers() const; + +private: + QString m_body; + QStringList m_headers; +}; +//! [custom type definition] + +//! [custom type meta-type declaration] +Q_DECLARE_METATYPE(Message); +//! [custom type meta-type declaration] + +#endif diff --git a/util/scripts/win-binary/nsis/qtnsisext/binpatch.h b/examples/tools/customtypesending/window.cpp index 7cbc6a5..be79518 100644 --- a/util/scripts/win-binary/nsis/qtnsisext/binpatch.h +++ b/examples/tools/customtypesending/window.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,44 +38,43 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef BINPATCH_H -#define BINPATCH_H -#include <string.h> +#include <QtGui> +#include "window.h" -typedef unsigned long ulong; -typedef unsigned int uint; - -class BinPatch +//! [Window constructor] +Window::Window() { -public: - BinPatch(const char *file) - : useLength(false), insertReplace(false) - { - strcpy(endTokens, ""); - strcpy(fileName, file); - } + editor = new QTextEdit(); + QPushButton *sendButton = new QPushButton(tr("&Send message")); - void enableUseLength(bool enabled) - { useLength = enabled; } - void enableInsertReplace(bool enabled) - { insertReplace = enabled; } - void setEndTokens(const char *tokens) - { strcpy(endTokens, tokens); } + connect(sendButton, SIGNAL(clicked()), this, SLOT(sendMessage())); - bool patch(const char *oldstr, const char *newstr); + QHBoxLayout *buttonLayout = new QHBoxLayout(); + buttonLayout->addStretch(); + buttonLayout->addWidget(sendButton); + buttonLayout->addStretch(); -private: - long getBufferStringLength(char *data, char *end); - bool endsWithTokens(const char *data); + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(editor); + layout->addLayout(buttonLayout); - bool patchHelper(char *inbuffer, const char *oldstr, - const char *newstr, size_t len, long *rw); + setWindowTitle(tr("Custom Type Sending")); +} +//! [Window constructor] - bool useLength; - bool insertReplace; - char endTokens[1024]; - char fileName[1024]; -}; +//! [sending a message] +void Window::sendMessage() +{ + thisMessage = Message(editor->toPlainText(), thisMessage.headers()); + emit messageSent(thisMessage); +} +//! [sending a message] -#endif
\ No newline at end of file +//! [receiving a message] +void Window::setMessage(const Message &message) +{ + thisMessage = message; + editor->setPlainText(thisMessage.body()); +} +//! [receiving a message] diff --git a/examples/tools/customtypesending/window.h b/examples/tools/customtypesending/window.h new file mode 100644 index 0000000..cbe9775 --- /dev/null +++ b/examples/tools/customtypesending/window.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WINDOW_H +#define WINDOW_H + +#include <QWidget> +#include "message.h" + +class QTextEdit; + +//! [Window class definition] +class Window : public QWidget +{ + Q_OBJECT + +public: + Window(); + +signals: + void messageSent(const Message &message); + +public slots: + void setMessage(const Message &message); + +private slots: + void sendMessage(); + +private: + Message thisMessage; + QTextEdit *editor; +}; +//! [Window class definition] + +#endif diff --git a/examples/tutorials/addressbook/README b/examples/tutorials/addressbook/README index 2d528b5..9b7f908 100644 --- a/examples/tutorials/addressbook/README +++ b/examples/tutorials/addressbook/README @@ -4,7 +4,7 @@ Qt documentation, which can be viewed using Qt Assistant or a Web browser. The tutorial is also available online at -http://doc.trolltech.com/4.4/tutorial.html +http://doc.trolltech.com/tutorial.html All programs corresponding to the chapters in the tutorial should automatically be built when Qt is compiled, or will be provided as diff --git a/examples/widgets/movie/movie.pro b/examples/widgets/movie/movie.pro index b5f0a7a..1c7cbae 100644 --- a/examples/widgets/movie/movie.pro +++ b/examples/widgets/movie/movie.pro @@ -4,6 +4,6 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/movie -sources.files = $$SOURCES $$HEADERS $$RESOURCES movie.pro movies +sources.files = $$SOURCES $$HEADERS $$RESOURCES movie.pro animation.mng sources.path = $$[QT_INSTALL_EXAMPLES]/widgets/movie INSTALLS += target sources diff --git a/examples/xml/xmlstreamlint/main.cpp b/examples/xml/xmlstreamlint/main.cpp index e006c82..6063b84 100644 --- a/examples/xml/xmlstreamlint/main.cpp +++ b/examples/xml/xmlstreamlint/main.cpp @@ -46,7 +46,7 @@ #include <QXmlStreamReader> /* - This class exists for the solve purpose of creating a translation context. + This class exists for the sole purpose of creating a translation context. */ class XmlStreamLint { diff --git a/examples/xmlpatterns/trafficinfo/mainwindow.cpp b/examples/xmlpatterns/trafficinfo/mainwindow.cpp index c4ca731..1f754d5 100644 --- a/examples/xmlpatterns/trafficinfo/mainwindow.cpp +++ b/examples/xmlpatterns/trafficinfo/mainwindow.cpp @@ -71,7 +71,7 @@ MainWindow::MainWindow() QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateTimeInformation())); - timer->start(1000*60); + timer->start(1000*60*5); const QSettings settings("Qt Software", "trafficinfo"); m_station = StationInformation(settings.value("stationId", "03012130").toString(), diff --git a/mkspecs/features/include_source_dir.prf b/mkspecs/features/include_source_dir.prf new file mode 100644 index 0000000..8794998 --- /dev/null +++ b/mkspecs/features/include_source_dir.prf @@ -0,0 +1 @@ +!equals(_PRO_FILE_PWD_, $$OUT_PWD):INCLUDEPATH *= . diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index faa9871..7c4ff28 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -8,31 +8,46 @@ isEmpty(MOC_DIR):MOC_DIR = . isEmpty(QMAKE_H_MOD_MOC):QMAKE_H_MOD_MOC = moc_ isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc -# This function on Windows puts the includes into a .inc file which moc will read, if the project -# has more than 30 includes. We do this to overcome a command-line limit on Win < XP -# Otherwise the function simply returns the normal command-line for moc -defineReplace(mocCmd) { - win32:count($$list($$INCPATH), 40, >) { - EOC = $$escape_expand(\n\t) +# On Windows, put the includes into a .inc file which moc will read, if the project +# has too many includes. We do this to overcome a command-line limit on Win < XP +INCLUDETEMP= +WIN_INCLUDETEMP= +win32:count($$list($$INCPATH), 40, >) { + INCLUDETEMP = $$MOC_DIR/mocinclude.tmp + + # Remove any existing mocinclude.tmp when qmake runs + WIN_INCLUDETEMP=$$INCLUDETEMP + WIN_INCLUDETEMP~=s,/,\,g + system($$QMAKE_DEL_FILE $$WIN_INCLUDETEMP > NUL 2>&1) + + EOC = $$escape_expand(\n\t) + + if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { + # the VCPROJ generator will replace the \r\h with the coded \r\n: 
 + # No other generator understands the \h + if(win32-msvc.net|win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\r\h) + else: EOC = $$escape_expand(\\)$$escape_expand(\n\t) + } + + unset(INCFILELIST) + RET = + for(incfile, $$list($$INCPATH)) { + INCFILELIST = -I$$incfile + isEmpty(RET): RET += @echo $$INCFILELIST> $$WIN_INCLUDETEMP $$EOC + else: RET += @echo $$INCFILELIST>> $$WIN_INCLUDETEMP $$EOC + } + !isEmpty(INCFILELIST):RET += @echo $$INCFILELIST>> $$WIN_INCLUDETEMP $$EOC - if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { - # the VCPROJ generator will replace the \r\h with the coded \r\n: 
 - # No other generator understands the \h - if(win32-msvc.net|win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\r\h) - else: EOC = $$escape_expand(\\)$$escape_expand(\n\t) - } + build_pass|isEmpty(BUILDS) { + mocinclude.target = $$INCLUDETEMP + mocinclude.commands = $$RET + QMAKE_EXTRA_TARGETS += mocinclude + } +} - INCLUDETEMP = mocinclude.tmp - unset(INCFILELIST) - RET = - for(incfile, $$list($$INCPATH)) { - INCFILELIST = -I$$incfile - isEmpty(RET): RET += @echo $$INCFILELIST> $$INCLUDETEMP $$EOC - else: RET += @echo $$INCFILELIST>> $$INCLUDETEMP $$EOC - } - !isEmpty(INCFILELIST):RET += @echo $$INCFILELIST>> $$INCLUDETEMP $$EOC - RET += $$QMAKE_MOC $(DEFINES) @$$INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2 - return($$RET) +defineReplace(mocCmd) { + !isEmpty(WIN_INCLUDETEMP) { + return($$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2) } return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2) } @@ -45,6 +60,7 @@ moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAK moc_header.input = HEADERS moc_header.variable_out = SOURCES moc_header.name = MOC ${QMAKE_FILE_IN} +!isEmpty(INCLUDETEMP):moc_header.depends += $$INCLUDETEMP silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands QMAKE_EXTRA_COMPILERS += moc_header INCREDIBUILD_XGE += moc_header @@ -56,12 +72,23 @@ moc_source.commands = ${QMAKE_FUNC_mocCmd} moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC} moc_source.input = SOURCES OBJECTIVE_SOURCES moc_source.name = MOC ${QMAKE_FILE_IN} +!isEmpty(INCLUDETEMP):moc_source.depends += $$INCLUDETEMP silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands QMAKE_EXTRA_COMPILERS += moc_source INCREDIBUILD_XGE += moc_source #make sure we can include these files -INCLUDEPATH += $$MOC_DIR +moc_dir_short = $$MOC_DIR +win32:moc_dir_short ~= s,^.:,/, +contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH += $$MOC_DIR +else:INCLUDEPATH += $$OUT_PWD/$$MOC_DIR + +# Backwards compatibility: Make shadow builds with default MOC_DIR work +# if the user did not add the source dir explicitly. +equals(MOC_DIR, .) { + CONFIG -= include_source_dir + CONFIG = include_source_dir $$CONFIG +} #auto depend on moc unix:!no_mocdepend { diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf index 885fad7..0c7fb1b 100644 --- a/mkspecs/features/uic.prf +++ b/mkspecs/features/uic.prf @@ -34,7 +34,17 @@ isEmpty(QMAKE_MOD_UIC):QMAKE_MOD_UIC = ui_ INCREDIBUILD_XGE += uic } -INCLUDEPATH += $$UI_HEADERS_DIR +ui_dir_short = $$UI_HEADERS_DIR +win32:ui_dir_short ~= s,^.:,/, +contains(ui_dir_short, ^[/\\\\].*):INCLUDEPATH += $$UI_HEADERS_DIR +else:INCLUDEPATH += $$OUT_PWD/$$UI_HEADERS_DIR + +# Backwards compatibility: Make shadow builds with default UI_DIR work +# if the user did not add the source dir explicitly. +equals(UI_DIR, .) { + CONFIG -= include_source_dir + CONFIG = include_source_dir $$CONFIG +} uic3 { isEmpty(FORMS3) { diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index daaae4c..473a625 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -719,6 +719,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) for(QStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) mkt << " " << "-I" << escapeFilePath((*incit)); } + if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS")) + mkt << " " << var("QMAKE_FRAMEWORKPATH_FLAGS"); mkt << endl; mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl; diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 24e030e..67e5bfb 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1492,7 +1492,7 @@ MakefileGenerator::replaceExtraCompilerVariables(const QString &orig_var, const val += project->values(varname); } if(val.isEmpty() && var.startsWith(QLatin1String("QMAKE_VAR_FIRST_"))) { - const QString varname = var.mid(12); + const QString varname = var.mid(16); val += project->first(varname); } @@ -2735,16 +2735,9 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q ret.prepend(pwd); ret = Option::fixPathToTargetOS(ret, false, canon); } else { //fix it.. - QString qfile(Option::fixPathToLocalOS(ret, true, canon)), in_dir(in_d), out_dir(out_d); + QString out_dir = QDir(Option::output_dir).absoluteFilePath(out_d); + QString in_dir = QDir(pwd).absoluteFilePath(in_d); { - if(out_dir.isNull() || QDir::isRelativePath(out_dir)) - out_dir.prepend(Option::output_dir + "/"); - else if(out_dir == ".") - out_dir = pwd; - if(in_dir.isEmpty() || QDir::isRelativePath(in_dir)) - in_dir.prepend(pwd); - else if(in_dir == ".") - in_dir = pwd; QFileInfo in_fi(fileInfo(in_dir)); if(in_fi.exists()) in_dir = in_fi.canonicalFilePath(); @@ -2753,6 +2746,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q out_dir = out_fi.canonicalFilePath(); } + QString qfile(Option::fixPathToLocalOS(ret, true, canon)); QFileInfo qfileinfo(fileInfo(qfile)); if(out_dir != in_dir || !qfileinfo.isRelative()) { if(qfileinfo.isRelative()) { @@ -2806,7 +2800,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q } if(ret.isEmpty()) ret = "."; - debug_msg(3, "Fixed[%d] %s :: to :: %s [%s::%s] [%s::%s]", fix, orig_file.toLatin1().constData(), + debug_msg(3, "Fixed[%d,%d] %s :: to :: %s [%s::%s] [%s::%s]", fix, canon, orig_file.toLatin1().constData(), ret.toLatin1().constData(), in_d.toLatin1().constData(), out_d.toLatin1().constData(), pwd.toLatin1().constData(), Option::output_dir.toLatin1().constData()); cache->insert(cacheKey, ret); diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index a26a247..cf09a6a 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -109,7 +109,7 @@ protected: struct SubTarget { QString name; - QString in_directory, out_directory; + QString in_directory, out_directory; QString profile, target, makefile; QStringList depends; }; @@ -183,8 +183,8 @@ protected: void filterIncludedFiles(const QString &); virtual void processSources() { - filterIncludedFiles("SOURCES"); - filterIncludedFiles("GENERATED_SOURCES"); + filterIncludedFiles("SOURCES"); + filterIncludedFiles("GENERATED_SOURCES"); } //for cross-platform dependent directories diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index f0683a7..3f60791 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -360,7 +360,7 @@ SubdirsMetaMakefileGenerator::init() } --recurseDepth; - Option::output.setFileName(old_output); + Option::output.setFileName(old_output); Option::output_dir = old_output_dir; qmake_setpwd(oldpwd); } diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index c845b86..585ab55 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -740,7 +740,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString src = fileFixify(files[file], FileFixifyAbsolute); if (!QFile::exists(src)) src = files[file]; - const QString dst = path + Option::dir_sep + fileInfo(files[file]).fileName(); + src = escapeFilePath(src); + const QString dst = escapeFilePath(path + Option::dir_sep + fileInfo(files[file]).fileName()); t << dst << ": " << src << "\n\t" << mkdir_p_asstring(path) << "\n\t"; QFileInfo fi(fileInfo(files[file])); diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 4b1b66d..b5904cc 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -244,14 +244,14 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) project->variables().remove("QMAKE_RUN_CC"); QHash<QString, void*> source_directories; - source_directories.insertMulti(".", (void*)1); + source_directories.insert(".", (void*)1); QString directories[] = { QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString() }; for(int y = 0; !directories[y].isNull(); y++) { QString dirTemp = project->first(directories[y]); if (dirTemp.endsWith("\\")) dirTemp.truncate(dirTemp.length()-1); if(!dirTemp.isEmpty()) - source_directories.insertMulti(dirTemp, (void*)1); + source_directories.insert(dirTemp, (void*)1); } QString srcs[] = { QString("SOURCES"), QString("GENERATED_SOURCES"), QString() }; for(int x = 0; !srcs[x].isNull(); x++) { @@ -262,7 +262,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) sep = "/"; QString dir = (*sit).section(sep, 0, -2); if(!dir.isEmpty() && !source_directories[dir]) - source_directories.insertMulti(dir, (void*)1); + source_directories.insert(dir, (void*)1); } } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 08159b0..8901289 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1030,7 +1030,6 @@ void VcprojGenerator::initCompilerTool() conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS")); if(project->isActiveConfig("debug")){ // Debug version - conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS")); conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_DEBUG")); if((projectTarget == Application) || (projectTarget == StaticLib)) conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DBG")); @@ -1038,7 +1037,6 @@ void VcprojGenerator::initCompilerTool() conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLLDBG")); } else { // Release version - conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS")); conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_RELEASE")); conf.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; conf.compiler.PreprocessorDefinitions += "NDEBUG"; diff --git a/qmake/project.cpp b/qmake/project.cpp index 8d49788..eef32db 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1105,7 +1105,7 @@ QMakeProject::parse(const QString &t, QMap<QString, QStringList> &place, int num } } } - } else if(!parens && *(d+d_off) == QLatin1Char('}')) { + } else if(!parens && *(d+d_off) == QLatin1Char('}')) { if(start_block) { --start_block; } else if(!scope_blocks.count()) { diff --git a/src/3rdparty/phonon/gstreamer/audiooutput.cpp b/src/3rdparty/phonon/gstreamer/audiooutput.cpp index fcadac2..138a7e4 100644 --- a/src/3rdparty/phonon/gstreamer/audiooutput.cpp +++ b/src/3rdparty/phonon/gstreamer/audiooutput.cpp @@ -42,6 +42,7 @@ AudioOutput::AudioOutput(Backend *backend, QObject *parent) static int count = 0; m_name = "AudioOutput" + QString::number(count++); if (m_backend->isValid()) { + g_set_application_name(qApp->applicationName().toUtf8()); m_audioBin = gst_bin_new (NULL); gst_object_ref (GST_OBJECT (m_audioBin)); gst_object_sink (GST_OBJECT (m_audioBin)); diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 5398f0c..74fc1b4 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -14,7 +14,6 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. */ - #include <cmath> #include <gst/interfaces/propertyprobe.h> #include "common.h" @@ -24,7 +23,6 @@ #include "backend.h" #include "streamreader.h" #include "phononsrc.h" - #include <QtCore> #include <QtCore/QTimer> #include <QtCore/QVector> @@ -78,6 +76,9 @@ MediaObject::MediaObject(Backend *backend, QObject *parent) , m_videoGraph(0) , m_previousTickTime(-1) , m_resetNeeded(false) + , m_autoplayTitles(true) + , m_availableTitles(0) + , m_currentTitle(1) { qRegisterMetaType<GstCaps*>("GstCaps*"); qRegisterMetaType<State>("State"); @@ -902,8 +903,13 @@ void MediaObject::setSource(const MediaSource &source) break; case MediaSource::Disc: // CD tracks can be specified by setting the url in the following way uri=cdda:4 - m_backend->logMessage("Source type Disc not currently supported", Backend::Warning, this); - setError(tr("Could not open media source."), Phonon::NormalError); + { + QUrl cdurl(QLatin1String("cdda://")); + if (createPipefromURL(cdurl)) + m_loading = true; + else + setError(tr("Could not open media source.")); + } break; default: @@ -954,6 +960,19 @@ void MediaObject::getStreamInfo() m_hasVideo = m_videoStreamFound; emit hasVideoChanged(m_hasVideo); } + + m_availableTitles = 1; + gint64 titleCount; + GstFormat format = gst_format_get_by_nick("track"); + if (gst_element_query_duration (m_pipeline, &format, &titleCount)) { + int oldAvailableTitles = m_availableTitles; + m_availableTitles = (int)titleCount; + if (m_availableTitles != oldAvailableTitles) { + emit availableTitlesChanged(m_availableTitles); + m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); + } + } + } void MediaObject::setPrefinishMark(qint32 newPrefinishMark) @@ -1351,6 +1370,13 @@ void MediaObject::handleEndOfStream() if (!m_seekable) m_atEndOfStream = true; + if (m_autoplayTitles && + m_availableTitles > 1 && + m_currentTitle < m_availableTitles) { + _iface_setCurrentTitle(m_currentTitle + 1); + return; + } + if (m_nextSource.type() != MediaSource::Invalid && m_nextSource.type() != MediaSource::Empty) { // We only emit finish when the queue is actually empty QTimer::singleShot (qMax(0, transitionTime()), this, SLOT(beginPlay())); @@ -1379,6 +1405,72 @@ void MediaObject::notifyStateChange(Phonon::State newstate, Phonon::State oldsta notify(&event); } +#ifndef QT_NO_PHONON_MEDIACONTROLLER +//interface management +bool MediaObject::hasInterface(Interface iface) const +{ + return iface == AddonInterface::TitleInterface; +} + +QVariant MediaObject::interfaceCall(Interface iface, int command, const QList<QVariant> ¶ms) +{ + if (hasInterface(iface)) { + + switch (iface) + { + case TitleInterface: + switch (command) + { + case availableTitles: + return _iface_availableTitles(); + case title: + return _iface_currentTitle(); + case setTitle: + _iface_setCurrentTitle(params.first().toInt()); + break; + case autoplayTitles: + return m_autoplayTitles; + case setAutoplayTitles: + m_autoplayTitles = params.first().toBool(); + break; + } + break; + default: + break; + } + } + return QVariant(); +} +#endif + +int MediaObject::_iface_availableTitles() const +{ + return m_availableTitles; +} + +int MediaObject::_iface_currentTitle() const +{ + return m_currentTitle; +} + +void MediaObject::_iface_setCurrentTitle(int title) +{ + GstFormat trackFormat = gst_format_get_by_nick("track"); + m_backend->logMessage(QString("setCurrentTitle %0").arg(title), Backend::Info, this); + if ((title == m_currentTitle) || (title < 1) || (title > m_availableTitles)) + return; + + m_currentTitle = title; + + //let's seek to the beginning of the song + if (gst_element_seek_simple(m_pipeline, trackFormat, GST_SEEK_FLAG_FLUSH, m_currentTitle - 1)) { + updateTotalTime(); + m_atEndOfStream = false; + emit titleChanged(title); + emit totalTimeChanged(totalTime()); + } +} + } // ns Gstreamer } // ns Phonon diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.h b/src/3rdparty/phonon/gstreamer/mediaobject.h index 4dc3f12..64b3510 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.h +++ b/src/3rdparty/phonon/gstreamer/mediaobject.h @@ -21,7 +21,6 @@ #include "backend.h" #include "common.h" #include "medianode.h" - #include <phonon/mediaobjectinterface.h> #include <phonon/addoninterface.h> @@ -32,7 +31,6 @@ #include <QtCore/QDate> #include <QtCore/QEvent> #include <QtCore/QUrl> - #include <gst/gst.h> QT_BEGIN_NAMESPACE @@ -50,11 +48,20 @@ class AudioPath; class VideoPath; class AudioOutput; -class MediaObject : public QObject, public MediaObjectInterface, public AddonInterface, public MediaNode +class MediaObject : public QObject, public MediaObjectInterface +#ifndef QT_NO_PHONON_MEDIACONTROLLER + , public AddonInterface +#endif + , public MediaNode { friend class Stream; Q_OBJECT - Q_INTERFACES(Phonon::MediaObjectInterface Phonon::AddonInterface Phonon::Gstreamer::MediaNode) + Q_INTERFACES(Phonon::MediaObjectInterface +#ifndef QT_NO_PHONON_MEDIACONTROLLER + Phonon::AddonInterface +#endif + Phonon::Gstreamer::MediaNode + ) public: @@ -93,16 +100,10 @@ public: MediaSource source() const; // No additional interfaces currently supported - bool hasInterface(Interface) const - { - return false; - } - - QVariant interfaceCall(Interface, int, const QList<QVariant> &) - { - return QVariant(); - } - +#ifndef QT_NO_PHONON_MEDIACONTROLLER + bool hasInterface(Interface) const; + QVariant interfaceCall(Interface, int, const QList<QVariant> &); +#endif bool isLoading() { return m_loading; @@ -176,6 +177,19 @@ Q_SIGNALS: QMultiMap<QString, QString> metaData(); void setMetaData(QMultiMap<QString, QString> newData); + // AddonInterface: + void titleChanged(int); + void availableTitlesChanged(int); + + // Not implemented + void chapterChanged(int); + void availableChaptersChanged(int); + void angleChanged(int); + void availableAnglesChanged(int); + + void availableSubtitlesChanged(); + void availableAudioChannelsChanged(); + protected: void beginLoad(); void loadingComplete(); @@ -219,6 +233,10 @@ private: void updateSeekable(); qint64 getPipelinePos() const; + int _iface_availableTitles() const; + int _iface_currentTitle() const; + void _iface_setCurrentTitle(int title); + bool m_resumeState; State m_oldState; quint64 m_oldPos; @@ -264,6 +282,9 @@ private: bool m_resetNeeded; QStringList m_missingCodecs; QMultiMap<QString, QString> m_metaData; + bool m_autoplayTitles; + int m_availableTitles; + int m_currentTitle; }; } } //namespace Phonon::Gstreamer diff --git a/src/3rdparty/phonon/gstreamer/x11renderer.cpp b/src/3rdparty/phonon/gstreamer/x11renderer.cpp index 1de58b6..73877a8 100644 --- a/src/3rdparty/phonon/gstreamer/x11renderer.cpp +++ b/src/3rdparty/phonon/gstreamer/x11renderer.cpp @@ -137,6 +137,7 @@ void X11Renderer::scaleModeChanged(Phonon::VideoWidget::ScaleMode) void X11Renderer::movieSizeChanged(const QSize &movieSize) { + Q_UNUSED(movieSize); if (m_renderWidget) { m_renderWidget->setGeometry(m_videoWidget->calculateDrawFrameRect()); } diff --git a/src/3rdparty/phonon/qt7/audionode.mm b/src/3rdparty/phonon/qt7/audionode.mm index cb9e82f..961230c 100644 --- a/src/3rdparty/phonon/qt7/audionode.mm +++ b/src/3rdparty/phonon/qt7/audionode.mm @@ -68,13 +68,15 @@ void AudioNode::createAndConnectAUNodes() << QString(!FindNextComponent(0, &description) ? "ERROR: COMPONENT NOT FOUND!" : "OK!")) OSStatus err = noErr; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) - err = AUGraphAddNode(m_audioGraph->audioGraphRef(), &description, &m_auNode); - else -#endif - err = AUGraphNewNode(m_audioGraph->audioGraphRef(), &description, 0, 0, &m_auNode); - + + // The proper function to call here is AUGraphAddNode() but the type has + // changed between 10.5 and 10.6. it's still OK to call this function, but + // if we want to use the proper thing we need to move over to + // AudioComponentDescription everywhere, which is very similar to the + // ComponentDescription, but a different size. however, + // AudioComponentDescription only exists on 10.6+. More fun than we need to + // deal with at the moment, so we'll take the "deprecated" warning instead. + err = AUGraphNewNode(m_audioGraph->audioGraphRef(), &description, 0, 0, &m_auNode); BACKEND_ASSERT2(err != kAUGraphErr_OutputNodeErr, "A MediaObject can only be connected to one audio output device.", FATAL_ERROR) BACKEND_ASSERT2(err == noErr, "Could not create new AUNode.", FATAL_ERROR) } diff --git a/src/3rdparty/phonon/qt7/backendinfo.mm b/src/3rdparty/phonon/qt7/backendinfo.mm index e173f05..0d51db0 100644 --- a/src/3rdparty/phonon/qt7/backendinfo.mm +++ b/src/3rdparty/phonon/qt7/backendinfo.mm @@ -22,6 +22,7 @@ #include <AudioUnit/AudioUnit.h> #include <CoreServices/CoreServices.h> +#include <QtGui/qmacdefines_mac.h> #import <QTKit/QTMovie.h> #ifdef QUICKTIME_C_API_AVAILABLE diff --git a/src/3rdparty/phonon/qt7/quicktimevideoplayer.h b/src/3rdparty/phonon/qt7/quicktimevideoplayer.h index 0b3aec2..b80570a 100644 --- a/src/3rdparty/phonon/qt7/quicktimevideoplayer.h +++ b/src/3rdparty/phonon/qt7/quicktimevideoplayer.h @@ -20,6 +20,7 @@ #include "backendheader.h" +#include <QtGui/qmacdefines_mac.h> #import <QTKit/QTDataReference.h> #import <QTKit/QTMovie.h> diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 5bb8a51..bfaefa2 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 0ba3dbe8c83850cd3c3874e3dca95b35b45fd86e + 450331808bfe11b1472c213a8cb311190355c2de diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 2e2ce52..9be6e72 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,159 @@ +2009-02-04 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Qt build fix. + + Changed ASSERT(image) to ASSERT(!image.isNull()). + + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::ImageBuffer::getImageData): + +2009-02-03 Dirk Schulze <krit@webkit.org> + + Reviewed by Sam Weinig. + + This is a follow up of r40546. Call toImage() once speeds up ImageBuffer::getImageData() + + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::ImageBuffer::getImageData): + +2009-02-03 Dirk Schulze <krit@webkit.org> + + Reviewed by Sam Weinig and Oliver Hunt. + + Added getImageData() support for QtWebKit. + + [QT] lacks getImageData / putImageData support in Canvas + https://bugs.webkit.org/show_bug.cgi?id=22186 + + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::ImageBuffer::getImageData): + +2009-04-14 Benjamin C Meyer <benjamin.meyer@torchmobile.com> + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=25099 + + When creating a QNetworkRequest make sure to populate the + CacheLoadControlAttribute with the value set by the ResourceRequest::cachePolicy() so that the cache will be used as WebKit expects. + + * WebKit/qt/tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::requestCache): + + * platform/network/qt/ResourceRequestQt.cpp: + (WebCore::ResourceRequest::toNetworkRequest): + +2009-04-07 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler + + While working on <rdar://problem/5968249>, noticed some glaring problems with LocalStorage. + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::localStorage): Return the cached m_localStorage object if it exists to + avoid creating multiple representations for the same underlying StorageArea. + * page/DOMWindow.h: + (WebCore::DOMWindow::optionalLocalStorage): Return m_localStorage, not m_sessionStorage. + +2009-04-06 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Don't show and hide the platformPluginWidget, as it's our QWebView + + * plugins/mac/PluginViewMac.cpp: + (WebCore::PluginView::show): + (WebCore::PluginView::hide): + (WebCore::PluginView::setParentVisible): + +2009-04-06 Mike Belshe <mike@belshe.com> + + Reviewed by Eric Seidel. + + HTMLCanvasElement crash when ImageBuffer creation fails. + https://bugs.webkit.org/show_bug.cgi?id=23212 + + Check for NULL before using the ImageBuffer as we might + be low on memory and creation may have failed. + + Test case creation blocked by: + https://bugs.webkit.org/show_bug.cgi?id=25055 + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::createImageBuffer): + +2009-04-05 Erik L. Bunce <elbunce@xendom.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=25050 + + Fix an assert failure when dropping an 'empty' text/uri-list on a QWebView. + + * platform/qt/DragDataQt.cpp: + (WebCore::DragData::asURL): + +2009-03-27 Zack Rusin <zack@kde.org> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=24280 + + Fix propagation of fill rules when rendering paths in the Qt build. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::toQtFillRule): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + +2009-03-27 Zack Rusin <zack@kde.org> + + Reviewed by Tor Arne Vestbø. + + https://bugs.webkit.org/show_bug.cgi?id=24275 + + Fix text field theming in the Qt build with the KDE 4 Oxygen + style by adjusting the size vertically and horizontally to + set padding on the element equal to the width of the style painted border. + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::RenderThemeQt): + (WebCore::RenderThemeQt::computeSizeBasedOnStyle): + (WebCore::RenderThemeQt::adjustTextFieldStyle): + (WebCore::RenderThemeQt::paintTextField): + * platform/qt/RenderThemeQt.h: + +2009-02-06 Dirk Schulze <krit@webkit.org> + + Reviewed by Simon Hausmann. + + Fix bug in clearRect(). Use fillRect() instead of eraseRect() to get + the context transparent. + + [QT] clearRect fill's a given rect with white + https://bugs.webkit.org/show_bug.cgi?id=23728 + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::clearRect): + +2009-03-19 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Fixed support for doing calls from JavaScript into NPAPI Plugins for the Qt port on Windows. + + Removed dead code for distinguishing between Widget and PluginView in the Qt port. + + * bindings/js/ScriptControllerQt.cpp: + (WebCore::ScriptController::createScriptInstanceForWidget): Removed incorrect isNPAPI check. + * plugins/PluginView.cpp: + (WebCore::PluginView::PluginView): Removed m_isNPAPIPlugin variable. + * plugins/PluginView.h: Removed setter/getter. + * plugins/mac/PluginViewMac.cpp: + (WebCore::PluginView::init): Removed call to setIsNPAPIPlugin. + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::init): Ditto. + 2009-02-26 Benjamin Meyer <benjamin.meyer@torchmobile.com> Reviewed by George Staikos. diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp index 15593fc..6b14190 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp @@ -50,9 +50,7 @@ PassRefPtr<JSC::Bindings::Instance> ScriptController::createScriptInstanceForWid { if (widget->isPluginView()) { PluginView* pluginView = static_cast<PluginView*>(widget); - if (pluginView->isNPAPIPlugin()) - return pluginView->bindingInstance(); - return 0; + return pluginView->bindingInstance(); } QWidget* platformWidget = widget->platformWidget(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp index fb6d9fe..76c3202 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp @@ -257,6 +257,10 @@ void HTMLCanvasElement::createImageBuffer() const return; m_imageBuffer.set(ImageBuffer::create(size, false).release()); + // The convertLogicalToDevice MaxCanvasArea check should prevent common cases + // where ImageBuffer::create() returns NULL, however we could still be low on memory. + if (!m_imageBuffer) + return; m_imageBuffer->context()->scale(FloatSize(size.width() / unscaledSize.width(), size.height() / unscaledSize.height())); m_imageBuffer->context()->setShadowsIgnoreTransforms(true); } diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp index 42d2e90..dd14fb9 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp @@ -333,6 +333,9 @@ Storage* DOMWindow::sessionStorage() const Storage* DOMWindow::localStorage() const { + if (m_localStorage) + return m_localStorage.get(); + Document* document = this->document(); if (!document) return 0; diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.h b/src/3rdparty/webkit/WebCore/page/DOMWindow.h index 0277441..e7fab18 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.h +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.h @@ -265,7 +265,7 @@ namespace WebCore { Location* optionalLocation() const { return m_location.get(); } #if ENABLE(DOM_STORAGE) Storage* optionalSessionStorage() const { return m_sessionStorage.get(); } - Storage* optionalLocalStorage() const { return m_sessionStorage.get(); } + Storage* optionalLocalStorage() const { return m_localStorage.get(); } #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) DOMApplicationCache* optionalApplicationCache() const { return m_applicationCache.get(); } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 80a6390..936c1ea 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -168,6 +168,18 @@ static inline QGradient applySpreadMethod(QGradient gradient, GradientSpreadMeth return gradient; } +static inline Qt::FillRule toQtFillRule(WindRule rule) +{ + switch(rule) { + case RULE_EVENODD: + return Qt::OddEvenFill; + case RULE_NONZERO: + return Qt::WindingFill; + } + qDebug("Qt: unrecognized wind rule!"); + return Qt::OddEvenFill; +} + struct TransparencyLayer { TransparencyLayer(const QPainter* p, const QRect &rect) @@ -541,6 +553,7 @@ void GraphicsContext::fillPath() QPainter *p = m_data->p(); QPainterPath path = m_data->currentPath; + path.setFillRule(toQtFillRule(fillRule())); switch (m_common->state.fillColorSpace) { case SolidColorSpace: @@ -569,6 +582,7 @@ void GraphicsContext::strokePath() QPainter *p = m_data->p(); QPen pen = p->pen(); QPainterPath path = m_data->currentPath; + path.setFillRule(toQtFillRule(fillRule())); switch (m_common->state.strokeColorSpace) { case SolidColorSpace: @@ -815,7 +829,7 @@ void GraphicsContext::clearRect(const FloatRect& rect) QPainter::CompositionMode currentCompositionMode = p->compositionMode(); if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) p->setCompositionMode(QPainter::CompositionMode_Source); - p->eraseRect(rect); + p->fillRect(rect, Qt::transparent); if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) p->setCompositionMode(currentCompositionMode); } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp index d4ab59f..d1009b5 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -35,6 +35,8 @@ #include "StillImageQt.h" #include <QBuffer> +#include <QColor> +#include <QImage> #include <QImageWriter> #include <QPainter> #include <QPixmap> @@ -79,10 +81,57 @@ Image* ImageBuffer::image() const return m_image.get(); } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect&) const +PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const { - notImplemented(); - return 0; + PassRefPtr<ImageData> result = ImageData::create(rect.width(), rect.height()); + unsigned char* data = result->data()->data(); + + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > m_size.width() || (rect.y() + rect.height()) > m_size.height()) + memset(data, 0, result->data()->length()); + + int originx = rect.x(); + int destx = 0; + if (originx < 0) { + destx = -originx; + originx = 0; + } + int endx = rect.x() + rect.width(); + if (endx > m_size.width()) + endx = m_size.width(); + int numColumns = endx - originx; + + int originy = rect.y(); + int desty = 0; + if (originy < 0) { + desty = -originy; + originy = 0; + } + int endy = rect.y() + rect.height(); + if (endy > m_size.height()) + endy = m_size.height(); + int numRows = endy - originy; + + QImage image = m_data.m_pixmap.toImage(); + if (image.format() != QImage::Format_ARGB32) + image = image.convertToFormat(QImage::Format_ARGB32); + ASSERT(!image.isNull()); + + unsigned destBytesPerRow = 4 * rect.width(); + unsigned char* destRows = data + desty * destBytesPerRow + destx * 4; + for (int y = 0; y < numRows; ++y) { + for (int x = 0; x < numColumns; x++) { + QRgb value = image.pixel(x + originx, y + originy); + int basex = x * 4; + + destRows[basex] = qRed(value); + destRows[basex + 1] = qGreen(value); + destRows[basex + 2] = qBlue(value); + destRows[basex + 3] = qAlpha(value); + } + destRows += destBytesPerRow; + } + + return result; } void ImageBuffer::putImageData(ImageData*, const IntRect&, const IntPoint&) diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp index 9308878..c8f6ad5 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -41,6 +41,22 @@ QNetworkRequest ResourceRequest::toNetworkRequest() const request.setRawHeader(name, value); } + switch (cachePolicy()) { + case ReloadIgnoringCacheData: + request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork); + break; + case ReturnCacheDataElseLoad: + request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); + break; + case ReturnCacheDataDontLoad: + request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache); + break; + case UseProtocolCachePolicy: + // QNetworkRequest::PreferNetwork + default: + break; + } + return request; } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp index 9d95373..218f7be 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/DragDataQt.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -126,6 +126,10 @@ String DragData::asURL(String* title) const if (!m_platformDragData) return String(); QList<QUrl> urls = m_platformDragData->urls(); + + if (urls.isEmpty()) + return String(); + return urls.first().toString(); } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index cc9d314..a9da76b 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -41,6 +41,7 @@ #include <QWidget> #include <QPainter> #include <QPushButton> +#include <QLineEdit> #include <QStyleFactory> #include <QStyleOptionButton> #include <QStyleOptionFrameV2> @@ -123,6 +124,12 @@ RenderThemeQt::RenderThemeQt() #endif m_fallbackStyle = 0; + + // this will need to be regenerated when the style changes + QLineEdit lineEdit; + QStyleOptionFrameV2 opt; + m_frameLineWidth = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, + &opt, &lineEdit); } RenderThemeQt::~RenderThemeQt() @@ -268,7 +275,7 @@ int RenderThemeQt::minimumMenuListSize(RenderStyle*) const return 7 * fm.width(QLatin1Char('x')); } -static void computeSizeBasedOnStyle(RenderStyle* renderStyle) +void RenderThemeQt::computeSizeBasedOnStyle(RenderStyle* renderStyle) const { // If the width and height are both specified, then we have nothing to do. if (!renderStyle->width().isIntrinsicOrAuto() && !renderStyle->height().isAuto()) @@ -335,13 +342,15 @@ static void computeSizeBasedOnStyle(RenderStyle* renderStyle) int h = qMax(fm.lineSpacing(), 14) + 2*verticalMargin; int w = fm.width(QLatin1Char('x')) * 17 + 2*horizontalMargin; QStyleOptionFrameV2 opt; - opt.lineWidth = applicationStyle->pixelMetric(QStyle::PM_DefaultFrameWidth, - &opt, 0); + opt.lineWidth = m_frameLineWidth; QSize sz = applicationStyle->sizeFromContents(QStyle::CT_LineEdit, - &opt, - QSize(w, h).expandedTo(QApplication::globalStrut()), - 0); + &opt, + QSize(w, h).expandedTo(QApplication::globalStrut()), + 0); size.setHeight(sz.height()); + + renderStyle->setPaddingLeft(Length(opt.lineWidth, Fixed)); + renderStyle->setPaddingRight(Length(opt.lineWidth, Fixed)); break; } default: @@ -482,6 +491,9 @@ void RenderThemeQt::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, { style->setBackgroundColor(Color::transparent); style->setColor(QApplication::palette().text().color()); + style->resetBorder(); + style->resetPadding(); + computeSizeBasedOnStyle(style); } bool RenderThemeQt::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) @@ -495,7 +507,7 @@ bool RenderThemeQt::paintTextField(RenderObject* o, const RenderObject::PaintInf panel.initFrom(p.widget); panel.rect = r; - panel.lineWidth = p.style->pixelMetric(QStyle::PM_DefaultFrameWidth, &panel, p.widget); + panel.lineWidth = m_frameLineWidth; panel.state |= QStyle::State_Sunken; panel.features = QStyleOptionFrameV2::None; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h index b4a5064..5c78a72 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h @@ -128,6 +128,7 @@ private: void paintMediaBackground(QPainter* painter, const IntRect& r) const; QColor getMediaControlForegroundColor(RenderObject* o = 0) const; #endif + void computeSizeBasedOnStyle(RenderStyle* renderStyle) const; private: bool supportsFocus(ControlPart) const; @@ -144,6 +145,8 @@ private: QStyle* m_fallbackStyle; QStyle* fallbackStyle(); + + int m_frameLineWidth; }; class StylePainter diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp index dbc090f..61d3157 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp @@ -559,9 +559,6 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p #if PLATFORM(GTK) || defined(Q_WS_X11) , m_needsXEmbed(false) #endif -#if PLATFORM(QT) - , m_isNPAPIPlugin(false) -#endif #if PLATFORM(WIN_OS) && !PLATFORM(WX) && ENABLE(NETSCAPE_PLUGIN_API) , m_pluginWndProc(0) , m_lastMessage(0) diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.h b/src/3rdparty/webkit/WebCore/plugins/PluginView.h index 0fe352f..44f2146 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginView.h +++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.h @@ -187,11 +187,6 @@ namespace WebCore { static bool isCallingPlugin(); -#if PLATFORM(QT) - bool isNPAPIPlugin() const { return m_isNPAPIPlugin; } - void setIsNPAPIPlugin(bool b) { m_isNPAPIPlugin = b; } -#endif - private: PluginView(Frame* parentFrame, const IntSize&, PluginPackage*, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually); @@ -257,10 +252,6 @@ namespace WebCore { bool m_isTransparent; bool m_haveInitialized; -#if PLATFORM(QT) - bool m_isNPAPIPlugin; -#endif - #if PLATFORM(GTK) || defined(Q_WS_X11) bool m_needsXEmbed; #endif diff --git a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp index c95e854..1d7d570 100644 --- a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp @@ -158,8 +158,6 @@ void PluginView::init() m_npWindow.clipRect.right = 0; m_npWindow.clipRect.bottom = 0; - setIsNPAPIPlugin(true); - show(); m_status = PluginStatusLoadedSuccessfully; @@ -301,9 +299,6 @@ void PluginView::show() setSelfVisible(true); - if (isParentVisible() && platformPluginWidget()) - platformPluginWidget()->setVisible(true); - Widget::show(); } @@ -313,9 +308,6 @@ void PluginView::hide() setSelfVisible(false); - if (isParentVisible() && platformPluginWidget()) - platformPluginWidget()->setVisible(false); - Widget::hide(); } @@ -347,9 +339,6 @@ void PluginView::setParentVisible(bool visible) return; Widget::setParentVisible(visible); - - if (isSelfVisible() && platformPluginWidget()) - platformPluginWidget()->setVisible(visible); } void PluginView::setNPWindowRect(const IntRect&) diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index 4982d08..5aa8933 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -459,7 +459,6 @@ void PluginView::init() if (m_needsXEmbed) { setPlatformWidget(new QX11EmbedContainer(m_parentFrame->view()->hostWindow()->platformWindow())); - setIsNPAPIPlugin(true); } else { notImplemented(); m_status = PluginStatusCanNotLoadPlugin; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h index f4c368a..4e832bb 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h @@ -26,7 +26,7 @@ namespace WebCore { class DatabaseDetails; -}; +} class QWebDatabasePrivate; class QWebSecurityOrigin; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index ae71356..5dc6363 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -534,6 +534,8 @@ void QWebFrame::load(const QNetworkRequest &req, Sets the content of this frame to \a html. \a baseUrl is optional and used to resolve relative URLs in the document, such as referenced images or stylesheets. + The \a html is loaded immediately; external objects are loaded asynchronously. + When using this method WebKit assumes that external resources such as JavaScript programs or style sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external script can be specified through the charset attribute of the HTML script tag. It is also possible @@ -558,6 +560,8 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) External objects referenced in the content are located relative to \a baseUrl. + The \a data is loaded immediately; external objects are loaded asynchronously. + \sa toHtml() */ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 0e5b5da..e17306d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -451,60 +451,35 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action) case QWebPage::Reload: enabled = !loader->isLoading(); break; - case QWebPage::Cut: - enabled = editor->canCut(); - break; - case QWebPage::Copy: - enabled = editor->canCopy(); - break; - case QWebPage::Paste: - enabled = editor->canPaste(); - break; #ifndef QT_NO_UNDOSTACK case QWebPage::Undo: case QWebPage::Redo: // those two are handled by QUndoStack break; #endif // QT_NO_UNDOSTACK - case QWebPage::MoveToNextChar: - case QWebPage::MoveToPreviousChar: - case QWebPage::MoveToNextWord: - case QWebPage::MoveToPreviousWord: - case QWebPage::MoveToNextLine: - case QWebPage::MoveToPreviousLine: - case QWebPage::MoveToStartOfLine: - case QWebPage::MoveToEndOfLine: - case QWebPage::MoveToStartOfBlock: - case QWebPage::MoveToEndOfBlock: - case QWebPage::MoveToStartOfDocument: - case QWebPage::MoveToEndOfDocument: - case QWebPage::SelectNextChar: - case QWebPage::SelectPreviousChar: - case QWebPage::SelectNextWord: - case QWebPage::SelectPreviousWord: - case QWebPage::SelectNextLine: - case QWebPage::SelectPreviousLine: - case QWebPage::SelectStartOfLine: - case QWebPage::SelectEndOfLine: - case QWebPage::SelectStartOfBlock: - case QWebPage::SelectEndOfBlock: - case QWebPage::SelectStartOfDocument: - case QWebPage::SelectEndOfDocument: - case QWebPage::DeleteStartOfWord: - case QWebPage::DeleteEndOfWord: + case QWebPage::SelectAll: // editor command is always enabled + break; case QWebPage::SetTextDirectionDefault: case QWebPage::SetTextDirectionLeftToRight: case QWebPage::SetTextDirectionRightToLeft: - case QWebPage::ToggleBold: - case QWebPage::ToggleItalic: - case QWebPage::ToggleUnderline: - enabled = editor->canEditRichly(); - if (enabled) - checked = editor->command(editorCommandForWebActions(action)).state() != FalseTriState; - else - checked = false; + enabled = editor->canEdit(); + checked = false; + break; + default: { + // see if it's an editor command + const char* commandName = editorCommandForWebActions(action); + + // if it's an editor command, let it's logic determine state + if (commandName) { + Editor::Command command = editor->command(commandName); + enabled = command.isEnabled(); + if (enabled) + checked = command.state() != FalseTriState; + else + checked = false; + } break; - default: break; + } } a->setEnabled(enabled); @@ -558,6 +533,8 @@ void QWebPagePrivate::updateEditorActions() updateAction(QWebPage::ToggleBold); updateAction(QWebPage::ToggleItalic); updateAction(QWebPage::ToggleUnderline); + updateAction(QWebPage::InsertParagraphSeparator); + updateAction(QWebPage::InsertLineSeparator); } void QWebPagePrivate::timerEvent(QTimerEvent *ev) @@ -919,14 +896,14 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) return; } - if (!ev->preeditString().isEmpty()) { + if (!ev->commitString().isEmpty()) + editor->confirmComposition(ev->commitString()); + else { QString preedit = ev->preeditString(); // ### FIXME: use the provided QTextCharFormat (use color at least) Vector<CompositionUnderline> underlines; underlines.append(CompositionUnderline(0, preedit.length(), Color(0,0,0), false)); editor->setComposition(preedit, underlines, preedit.length(), 0); - } else if (!ev->commitString().isEmpty()) { - editor->confirmComposition(ev->commitString()); } ev->accept(); } @@ -1116,8 +1093,13 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const \enum QWebPage::WebAction This enum describes the types of action which can be performed on the web page. - Actions which are related to text editing, cursor movement, and text selection - only have an effect if \l contentEditable is true. + + Actions only have an effect when they are applicable. The availability of + actions can be be determined by checking \l{QAction::}{enabled()} on the + action returned by \l{QWebPage::}{action()}. + + One method of enabling the text editing, cursor movement, and text selection actions + is by setting \l contentEditable to true. \value NoWebAction No action is triggered. \value OpenLink Open the current link. @@ -1737,6 +1719,9 @@ QAction *QWebPage::action(WebAction action) const case MoveToEndOfDocument: text = tr("Move the cursor to the end of the document"); break; + case SelectAll: + text = tr("Select all"); + break; case SelectNextChar: text = tr("Select to the next character"); break; @@ -1809,6 +1794,13 @@ QAction *QWebPage::action(WebAction action) const text = contextMenuItemTagInspectElement(); break; + case InsertParagraphSeparator: + text = tr("Insert a new paragraph"); + break; + case InsertLineSeparator: + text = tr("Insert a new line"); + break; + case NoWebAction: return 0; } @@ -2336,7 +2328,8 @@ QWebPluginFactory *QWebPage::pluginFactory() const \list \o %Platform% and %Subplatform% are expanded to the windowing system and the operation system. \o %Security% expands to U if SSL is enabled, otherwise N. SSL is enabled if QSslSocket::supportsSsl() returns true. - \o %Locale% is replaced with QLocale::name(). + \o %Locale% is replaced with QLocale::name(). The locale is determined from the view of the QWebPage. If no view is set on the QWebPage, + then a default constructed QLocale is used instead. \o %WebKitVersion% currently expands to 527+ \o %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version. \endlist @@ -2524,7 +2517,7 @@ void QWebPagePrivate::_q_onLoadProgressChanged(int) { \sa bytesReceived() */ quint64 QWebPage::totalBytes() const { - return d->m_bytesReceived; + return d->m_totalBytes; } @@ -2534,7 +2527,7 @@ quint64 QWebPage::totalBytes() const { \sa totalBytes() */ quint64 QWebPage::bytesReceived() const { - return d->m_totalBytes; + return d->m_bytesReceived; } /*! diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h index ebe4a77..b52194d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h @@ -28,7 +28,7 @@ namespace WebCore { class SecurityOrigin; class ChromeClientQt; -}; +} class QWebSecurityOriginPrivate; class QWebDatabase; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index ea503a1..a843eba 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -289,6 +289,8 @@ void QWebView::load(const QNetworkRequest &request, External objects such as stylesheets or images referenced in the HTML document are located relative to \a baseUrl. + The \a html is loaded immediately; external objects are loaded asynchronously. + When using this method, WebKit assumes that external resources such as JavaScript programs or style sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external script can be specified @@ -309,6 +311,8 @@ void QWebView::setHtml(const QString &html, const QUrl &baseUrl) External objects referenced in the content are located relative to \a baseUrl. + The \a data is loaded immediately; external objects are loaded asynchronously. + \sa load(), setHtml(), QWebFrame::toHtml() */ void QWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 8e0b50a..5a23200 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,122 @@ +2009-03-07 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by Cameron Zwarich. + + These methods are clearly returning the wrong values as the two were + returning swapped information. + + * Api/qwebpage.cpp: + (QWebPage::totalBytes): + (QWebPage::bytesReceived): + +2009-04-02 Takumi Asaki <takumi.asaki@nokia.com> + + Reviewed by Simon Hausmann. + + Fix pre-edit handling of text fields with input methods. + + The input method sends an empty preeditString() if all characters of + the preedit should be deleted. So inputMethodEvent() has to use + preeditString() if it's empty. + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + +2009-03-30 Simon Hausmann <simon.hausmann@nokia.com> + + Rubber-stamped by Tor Arne Vestbø. + + Document that setHtml/setContent loads only the html/data immediately, not external objects. + + * Api/qwebframe.cpp: + * Api/qwebview.cpp: + +2009-03-26 Simon Hausmann <simon.hausmann@nokia.com> + + Rubber-stamped by Tor Arne Vestbø. + + Fix the documentation of the QLocale usage in userAgentForUrl. + + * Api/qwebpage.cpp: + +2009-03-20 Erik L. Bunce <elbunce@xendom.com> + + Reviewed by Simon Hausmann. + + Fix for InsertParagraphSeparator and InsertLineSeparator so that + QWebPage::action() creates QActions for them. Also make sure they get + updated appropriately. + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateEditorActions): + (QWebPage::action): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textEditing): + +2009-03-20 Erik L. Bunce <elbunce@xendom.com> + + Reviewed by Tor Arne Vestbø. + + Fix QWebPage::WebActions action states to more closely match when they are + actually applicable and remove erroneous documentation. + + * Most WebActions implemented using editor commands now use the + Editor::Command::isEnabled() to control their availability. + * SelectAll is always enabled (since it's editor command is). + * SetTextDirection{} family of WebActions are available when canEdit() is true + and not just canEditRichly(). + + Fix and clarify documentation about the availability of various web actions. + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateAction): + (QWebPagePrivate::updateEditorActions): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textSelection): + +2009-03-19 Ariya Hidayat <ariya.hidayat@trolltech.com> + + Reviewed by Simon Hausmann. + + Fixes pedantic compilation in QtWebKit. + + There are no semi-colons after namespace declarations. + + * Api/qwebdatabase.h: + * Api/qwebsecurityorigin.h: + +2009-03-19 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + Doc: Removed obsolete warning about Flash and other plugins. + + * Api/qwebsettings.cpp: + +2009-03-19 Paul Olav Tvete <paul.tvete@nokia.com> + + Reviewed by Simon Hausmann. + + Properly escape tooltip text + + ManualTest: http://xkcd.com/554/ + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::setToolTip): + +2009-03-03 Ariya Hidayat <ariya.hidayat@trolltech.com> + + Rubber-stamped by Simon Hausmann. + + [Qt] Create and update the action for SelectAll. + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateAction): + (QWebPagePrivate::updateEditorActions): + (QWebPage::action): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textSelection): + 2009-02-25 Kavindra Palaraja <kavindra.palaraja@nokia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 6f2ce3b..fe74fac 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -106,6 +106,8 @@ private slots: void textSelection(); void textEditing(); + void requestCache(); + private: @@ -879,6 +881,7 @@ void tst_QWebPage::textSelection() QCOMPARE(page->selectedText().trimmed(), QString::fromLatin1("The quick brown fox")); // these actions must exist + QVERIFY(page->action(QWebPage::SelectAll) != 0); QVERIFY(page->action(QWebPage::SelectNextChar) != 0); QVERIFY(page->action(QWebPage::SelectPreviousChar) != 0); QVERIFY(page->action(QWebPage::SelectNextWord) != 0); @@ -906,10 +909,14 @@ void tst_QWebPage::textSelection() QCOMPARE(page->action(QWebPage::SelectStartOfDocument)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectEndOfDocument)->isEnabled(), false); + // ..but SelectAll is awalys enabled + QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true); + // make it editable before navigating the cursor page->setContentEditable(true); // here the actions are enabled after contentEditable is true + QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), true); @@ -951,6 +958,8 @@ void tst_QWebPage::textEditing() QVERIFY(page->action(QWebPage::ToggleBold) != 0); QVERIFY(page->action(QWebPage::ToggleItalic) != 0); QVERIFY(page->action(QWebPage::ToggleUnderline) != 0); + QVERIFY(page->action(QWebPage::InsertParagraphSeparator) != 0); + QVERIFY(page->action(QWebPage::InsertLineSeparator) != 0); // right now they are disabled because contentEditable is false QCOMPARE(page->action(QWebPage::DeleteStartOfWord)->isEnabled(), false); @@ -961,6 +970,8 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::ToggleBold)->isEnabled(), false); QCOMPARE(page->action(QWebPage::ToggleItalic)->isEnabled(), false); QCOMPARE(page->action(QWebPage::ToggleUnderline)->isEnabled(), false); + QCOMPARE(page->action(QWebPage::InsertParagraphSeparator)->isEnabled(), false); + QCOMPARE(page->action(QWebPage::InsertLineSeparator)->isEnabled(), false); // make it editable before navigating the cursor page->setContentEditable(true); @@ -974,10 +985,38 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::ToggleBold)->isEnabled(), true); QCOMPARE(page->action(QWebPage::ToggleItalic)->isEnabled(), true); QCOMPARE(page->action(QWebPage::ToggleUnderline)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::InsertParagraphSeparator)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::InsertLineSeparator)->isEnabled(), true); delete page; } +void tst_QWebPage::requestCache() +{ + TestPage page; + QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); + + page.mainFrame()->setUrl(QString("data:text/html,<a href=\"data:text/html,Reached\" target=\"_blank\">Click me</a>")); + QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE(page.navigations.count(), 1); + + page.mainFrame()->setUrl(QString("data:text/html,<a href=\"data:text/html,Reached\" target=\"_blank\">Click me2</a>")); + QTRY_COMPARE(loadSpy.count(), 2); + QTRY_COMPARE(page.navigations.count(), 2); + + page.triggerAction(QWebPage::Stop); + QVERIFY(page.history()->canGoBack()); + page.triggerAction(QWebPage::Back); + + QTRY_COMPARE(loadSpy.count(), 3); + QTRY_COMPARE(page.navigations.count(), 3); + QCOMPARE(page.navigations.at(0).request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt(), + (int)QNetworkRequest::PreferNetwork); + QCOMPARE(page.navigations.at(1).request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt(), + (int)QNetworkRequest::PreferNetwork); + QCOMPARE(page.navigations.at(2).request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt(), + (int)QNetworkRequest::PreferCache); +} QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index b9d73a1..f3e1dff 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -4457,11 +4457,24 @@ bool QAxServerBase::eventFilter(QObject *o, QEvent *e) case QEvent::Resize: updateMask(); break; - case QEvent::WindowBlocked: + case QEvent::WindowBlocked: { if (!m_spInPlaceFrame) break; m_spInPlaceFrame->EnableModeless(FALSE); + MSG msg; + // Visual Basic 6.0 posts the message WM_USER+3078 from the EnableModeless(). + // While handling this message, VB will disable all current top-levels. After + // this we have to re-enable the Qt modal widget to receive input events. + if (PeekMessage(&msg, 0, WM_USER+3078, WM_USER+3078, PM_REMOVE)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + QWidget *modalWidget = QApplication::activeModalWidget(); + if (modalWidget && modalWidget->isVisible() && modalWidget->isEnabled() + && !IsWindowEnabled(modalWidget->effectiveWinId())) + EnableWindow(modalWidget->effectiveWinId(), TRUE); + } break; + } case QEvent::WindowUnblocked: if (!m_spInPlaceFrame) break; diff --git a/src/corelib/concurrent/qtconcurrentreducekernel.h b/src/corelib/concurrent/qtconcurrentreducekernel.h index e863b63..2dad519 100644 --- a/src/corelib/concurrent/qtconcurrentreducekernel.h +++ b/src/corelib/concurrent/qtconcurrentreducekernel.h @@ -51,6 +51,7 @@ #include <QtCore/qmap.h> #include <QtCore/qmutex.h> #include <QtCore/qthread.h> +#include <QtCore/qthreadpool.h> #include <QtCore/qvector.h> QT_BEGIN_HEADER @@ -107,7 +108,7 @@ class ReduceKernel const ReduceOptions reduceOptions; QMutex mutex; - int progress, resultsMapSize; + int progress, resultsMapSize, threadCount; ResultsMap resultsMap; bool canReduce(int begin) const @@ -140,7 +141,8 @@ class ReduceKernel public: ReduceKernel(ReduceOptions _reduceOptions) - : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0) + : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0), + threadCount(QThreadPool::globalInstance()->maxThreadCount()) { } void runReduce(ReduceFunctor &reduce, @@ -210,12 +212,12 @@ public: inline bool shouldThrottle() { - return (resultsMapSize > (ReduceQueueThrottleLimit * QThread::idealThreadCount())); + return (resultsMapSize > (ReduceQueueThrottleLimit * threadCount)); } inline bool shouldStartThread() { - return (resultsMapSize <= (ReduceQueueStartLimit * QThread::idealThreadCount())); + return (resultsMapSize <= (ReduceQueueStartLimit * threadCount)); } }; diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index c26c274..40ccb15 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -3,28 +3,28 @@ Feature: PROPERTIES Description: Supports scripting Qt-based applications. Section: Kernel -Requires: +Requires: Name: Properties SeeAlso: ??? Feature: TEXTHTMLPARSER Description: Parser for HTML Section: Kernel -Requires: +Requires: Name: HtmlParser SeeAlso: ??? Feature: TEXTODFWRITER Description: Provides an ODF writer Section: Kernel -Requires: XMLSTREAMWRITER +Requires: XMLSTREAMWRITER Name: OdfWriter SeeAlso: ??? Feature: CSSPARSER Description: Parser for Style Sheets Section: Kernel -Requires: +Requires: Name: CssParser SeeAlso: ??? @@ -52,21 +52,21 @@ SeeAlso: ??? Feature: SESSIONMANAGER Description: Supports session management. Section: Kernel -Requires: +Requires: Name: Session Manager SeeAlso: ??? Feature: SHORTCUT Description: Supports keyboard accelerators and shortcuts. Section: Kernel -Requires: +Requires: Name: QShortcut SeeAlso: ??? Feature: ACTION Description: Supports widget actions. Section: Kernel -Requires: +Requires: Name: QAction SeeAlso: ??? @@ -129,8 +129,8 @@ SeeAlso: ??? Feature: XMLSTREAM Description: Provides a simple streaming API for XML. Section: Kernel -Requires: -Name: +Requires: +Name: SeeAlso: ??? Feature: XMLSTREAMREADER @@ -159,14 +159,14 @@ SeeAlso: ??? Feature: QUUID_STRING Description: Supports convertion between UUID and strings. Section: Data structures -Requires: +Requires: Name: Universally Unique Identifier Convertion SeeAlso: ??? Feature: TEXTDATE Description: Supports month and day names in dates. Section: Data structures -Requires: +Requires: Name: Text Date SeeAlso: ??? @@ -210,7 +210,7 @@ SeeAlso: ??? Feature: SETTINGS Description: Supports persistent application settings. Section: File I/O -Requires: TEXTSTREAM +Requires: TEXTSTREAM Name: QSettings SeeAlso: ??? @@ -229,7 +229,7 @@ Name: QFileSystemModel SeeAlso: ??? Feature: FILESYSTEMWATCHER -Description: Provides an interface for monitoring files and directories +Description: Provides an interface for monitoring files and directories for modications. Section: File I/O Requires: THREAD @@ -239,7 +239,7 @@ SeeAlso: ??? # Widgets Feature: TREEWIDGET -Description: Supports views using tree models. +Description: Supports views using tree models. Section: Widgets Requires: TREEVIEW Name: QTreeWidget @@ -283,7 +283,7 @@ SeeAlso: ??? Feature: SPLASHSCREEN Description: Supports splash screens that can be shown during application startup. Section: Widgets -Requires: +Requires: Name: Splash screen widget SeeAlso: ??? @@ -295,7 +295,7 @@ Name: QSplitter SeeAlso: ??? Feature: LCDNUMBER -Description: Supports LCD-like digits. +Description: Supports LCD-like digits. Section: Widgets Requires: Name: QLCDNumber @@ -381,7 +381,7 @@ SeeAlso: ??? Feature: BUTTONGROUP Description: Supports organizing groups of button widgets. Section: Widgets -Requires: GROUPBOX +Requires: GROUPBOX Name: QButtonGroup SeeAlso: ??? @@ -393,7 +393,7 @@ Name: QMainWindow SeeAlso: ??? Feature: DOCKWIDGET -Description: Supports docking widgets inside a QMainWindow or floated as +Description: Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop. Section: Widgets Requires: RUBBERBAND MAINWINDOW @@ -401,7 +401,7 @@ Name: QDockwidget SeeAlso: ??? Feature: WORKSPACE -Description: Supports workspace windows, e.g. used in an MDI application. +Description: Supports workspace windows, e.g. used in an MDI application. Section: Widgets Requires: SCROLLBAR RESIZEHANDLER MENU TOOLBUTTON MAINWINDOW TOOLBAR MENUBAR Name: QWorkSpace @@ -457,8 +457,8 @@ Name: QSlider SeeAlso: ??? Feature: SCROLLBAR -Description: Supports scrollbars allowing the user access parts of a -document that is larger than the widget used to display it. +Description: Supports scrollbars allowing the user access parts of a +document that is larger than the widget used to display it. Section: Widgets Requires: SLIDER Name: QScrollBar @@ -500,7 +500,7 @@ Name: QTextEdit SeeAlso: ??? Feature: SYNTAXHIGHLIGHTER -Description: Supports custom syntax highlighting. +Description: Supports custom syntax highlighting. Section: Widgets Requires: TEXTEDIT Name: QSyntaxHighlighter @@ -556,7 +556,7 @@ Name: QSizeGrip SeeAlso: ??? Feature: CALENDARWIDGET -Description: Provides a monthly based calendar widget allowing the user to select +Description: Provides a monthly based calendar widget allowing the user to select a date. Section: Widgets Requires: TABLEVIEW MENU TEXTDATE SPINBOX TOOLBUTTON @@ -567,14 +567,14 @@ Feature: PRINTPREVIEWWIDGET Description: Provides a widget for previewing page layouts for printer output. a date. Section: Widgets -Requires: GRAPHICSVIEW PRINTER PICTURE +Requires: GRAPHICSVIEW PRINTER Name: QPrintPreviewWidget SeeAlso: ??? # Dialogs Feature: MESSAGEBOX -Description: Supports message boxes displaying +Description: Supports message boxes displaying informative messages and simple questions. Section: Dialogs Requires: @@ -589,7 +589,7 @@ Name: QColorDialog SeeAlso: ??? Feature: FILEDIALOG -Description: Supports a dialog widget for selecting files or directories. +Description: Supports a dialog widget for selecting files or directories. Section: Dialogs Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET FILESYSTEMMODEL Name: QFileDialog @@ -654,7 +654,7 @@ SeeAlso: ??? # ItemViews Feature: ITEMVIEWS -Description: Supports the model/view architecture managing the relationship +Description: Supports the model/view architecture managing the relationship between data and the way it is presented to the user. Section: ItemViews Requires: RUBBERBAND SCROLLAREA @@ -683,8 +683,8 @@ Name: QAbstractProxyModel SeeAlso: ??? Feature: SORTFILTERPROXYMODEL -Description: Supports sorting and filtering of data passed between -another model and a view. +Description: Supports sorting and filtering of data passed between +another model and a view. Section: ItemViews Requires: PROXYMODEL Name: QSortFilterProxyModel @@ -705,9 +705,9 @@ Name: QListView SeeAlso: ??? Feature: TABLEVIEW -Description: Supports a default model/view implementation of a table view. +Description: Supports a default model/view implementation of a table view. Section: ItemViews -Requires: ITEMVIEWS +Requires: ITEMVIEWS Name: QTableView SeeAlso: ??? @@ -735,21 +735,21 @@ SeeAlso: ??? # Styles Feature: STYLE_WINDOWS -Description: Supports a Microsoft Windows-like look and feel. +Description: Supports a Microsoft Windows-like look and feel. Section: Styles Requires: Name: QWindowsStyle SeeAlso: ??? Feature: STYLE_MOTIF -Description: Supports a Motif look and feel. +Description: Supports a Motif look and feel. Section: Styles Requires: Name: QMotifStyle SeeAlso: ??? Feature: STYLE_CDE -Description: Supports a CDE look and feel. +Description: Supports a CDE look and feel. Section: Styles Requires: STYLE_MOTIF Name: QCDEStyle @@ -798,7 +798,7 @@ Name: QWindowsMobileStyle SeeAlso: ??? Feature: STYLE_STYLESHEET -Description: +Description: Section: Styles Requires: STYLE_WINDOWS PROPERTIES CSSPARSER Name: QStyleSheetStyle @@ -809,14 +809,14 @@ SeeAlso: ??? Feature: IMAGEFORMATPLUGIN Description: Supports writing an image format plugin. Section: Images -Requires: +Requires: Name: QImageIOPlugin SeeAlso: ??? Feature: ICON Description: Supports scalable icons in different modes and states. Section: Images -Requires: +Requires: Name: QIcon SeeAlso: ??? @@ -837,14 +837,14 @@ SeeAlso: ??? Feature: IMAGEFORMAT_PPM Description: Supports the Portable Pixmap image file format. Section: Images -Requires: +Requires: Name: PPM Image Format SeeAlso: ??? Feature: IMAGEFORMAT_XBM Description: Supports the X11 Bitmap image file format. Section: Images -Requires: +Requires: Name: XBM Image Format SeeAlso: ??? @@ -858,14 +858,14 @@ SeeAlso: ??? Feature: IMAGEFORMAT_PNG Description: Supports the Portable Network Graphics image file format. Section: Images -Requires: +Requires: Name: PNG Image Format SeeAlso: ??? Feature: IMAGEFORMAT_JPEG Description: Supports the Joint Photographic Experts Group image file format. Section: Images -Requires: +Requires: Name: JPEG Image Format SeeAlso: ??? @@ -895,7 +895,7 @@ SeeAlso: ??? Feature: PICTURE Description: Supports recording and replaying QPainter commands. Section: Painting -Requires: +Requires: Name: QPicture SeeAlso: ??? @@ -908,9 +908,9 @@ Name: Color Names SeeAlso: ??? Feature: PRINTER -Description: Supports printing +Description: Supports printing Section: Painting -Requires: TEXTSTREAM +Requires: TEXTSTREAM PICTURE Name: QPrinter SeeAlso: ??? @@ -952,7 +952,7 @@ Name: Freetype Font Engine SeeAlso: ??? Feature: QWS_QPF -Description: Supports Qt's pre-rendered fonts, a light-weight non-scalable font format +Description: Supports Qt's pre-rendered fonts, a light-weight non-scalable font format specific to Qt for Embedded Linux. Section: Fonts Requires: @@ -960,7 +960,7 @@ Name: Qt Prerendered Font Format SeeAlso: ??? Feature: QWS_QPF2 -Description: Supports Qt's second generation of pre-rendered fonts, a light-weight +Description: Supports Qt's second generation of pre-rendered fonts, a light-weight non-scalable font format specific to Qt for Embedded Linux. Section: Fonts Requires: @@ -987,7 +987,7 @@ Feature: TRANSLATION_UTF8 Description: Supports translations using QObject::trUtf8(). Section: Internationalization Requires: TRANSLATION TEXTCODEC -Name: Translation (UTF-8 representation) +Name: Translation (UTF-8 representation) SeeAlso: ??? Feature: TEXTCODEC @@ -1007,14 +1007,14 @@ SeeAlso: ??? Feature: BIG_CODECS Description: Supports big codecs, e.g. CJK. Section: Internationalization -Requires: +Requires: Name: Big Codecs SeeAlso: ??? Feature: QWS_INPUTMETHODS Description: Supports international input methods. Section: Internationalization -Requires: +Requires: Name: QWSInputMethod SeeAlso: ??? @@ -1023,14 +1023,14 @@ SeeAlso: ??? Feature: URLINFO Description: Supports storage of URL information. Section: Networking -Requires: +Requires: Name: QUrlInfo SeeAlso: ??? Feature: HOSTINFO Description: Supports host name lookups. Section: Networking -Requires: TEXTSTREAM +Requires: TEXTSTREAM Name: QHostInfo SeeAlso: ??? @@ -1051,14 +1051,14 @@ SeeAlso: ??? Feature: UDPSOCKET Description: Supports User Datagram Protocol sockets. Section: Networking -Requires: +Requires: Name: QUdpSocket SeeAlso: ??? Feature: NETWORKPROXY Description: Supports configuring network layer proxy support to the Qt network classes. Section: Networking -Requires: +Requires: Name: QNetworkProxy SeeAlso: ??? @@ -1123,7 +1123,7 @@ Name: QUndoStack SeeAlso: ??? Feature: UNDOGROUP -Description: +Description: Section: Utilities Requires: UNDOCOMMAND UNDOSTACK Name: QUndoGroup @@ -1181,7 +1181,7 @@ Name: QSvgRenderer SeeAlso: ??? Feature: SVGWIDGET -Description: Provides a widget that is used to display the contents of SVG files. +Description: Provides a widget that is used to display the contents of SVG files. Section: SVG Requires: SVGRENDERER Name: QSvgWidget @@ -1233,21 +1233,21 @@ Name: Manager SeeAlso: ??? Feature: QWS_DECORATION_DEFAULT -Description: Supports default decoration of the top level windows. +Description: Supports default decoration of the top level windows. Section: Qt for Embedded Linux -Requires: +Requires: Name: Decoration SeeAlso: ??? Feature: QWS_DECORATION_WINDOWS -Description: Supports a "Windows" style decoration of the top level windows. +Description: Supports a "Windows" style decoration of the top level windows. Section: Qt for Embedded Linux Requires: QWS_DECORATION_DEFAULT Name: Decoration (Windows Style) SeeAlso: ??? Feature: QWS_DECORATION_STYLED -Description: Supports styled decoration of the top level windows. +Description: Supports styled decoration of the top level windows. Section: Qt for Embedded Linux Requires: QWS_DECORATION_DEFAULT Name: Decoration (Styled) @@ -1395,13 +1395,13 @@ SeeAlso: ??? Feature: PHONON_MEDIACONTROLLER Description: Support for the MediaController class Section: Phonon -Requires: +Requires: Name: Phonon::MediaController SeeAlso: ??? Feature: PHONON_ABSTRACTMEDIASTREAM Description: Support for streaming of raw data (QIODevice...) Section: Phonon -Requires: +Requires: Name: Phonon::AbstractMediaStream SeeAlso: ??? diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b9c2bee..8324d05 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1054,6 +1054,7 @@ bool qSharedBuild() \value WV_XP Windows XP (operating system version 5.1) \value WV_2003 Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2) \value WV_VISTA Windows Vista, Windows Server 2008 (operating system version 6.0) + \value WV_WINDOWS7 Windows 7 (operating system version 6.1) Alternatively, you may use the following macros which correspond directly to the Windows operating system version number: @@ -1062,6 +1063,7 @@ bool qSharedBuild() \value WV_5_1 Operating system version 5.1, corresponds to Windows XP \value WV_5_2 Operating system version 5.2, corresponds to Windows Server 2003, Windows Server 2003 R2, Windows Home Server, and Windows XP Professional x64 Edition \value WV_6_0 Operating system version 6.0, corresponds to Windows Vista and Windows Server 2008 + \value WV_6_1 Operating system version 6.1, corresponds to Windows 7 CE-based versions: @@ -1095,6 +1097,7 @@ bool qSharedBuild() \value MV_10_3 Mac OS X 10.3 \value MV_10_4 Mac OS X 10.4 \value MV_10_5 Mac OS X 10.5 + \value MV_10_6 Mac OS X 10.6 \value MV_Unknown An unknown and currently unsupported platform \value MV_CHEETAH Apple codename for MV_10_0 @@ -1103,6 +1106,7 @@ bool qSharedBuild() \value MV_PANTHER Apple codename for MV_10_3 \value MV_TIGER Apple codename for MV_10_4 \value MV_LEOPARD Apple codename for MV_10_5 + \value MV_SNOWLEOPARD Apple codename for MV_10_6 \sa WinVersion */ @@ -1631,16 +1635,19 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() default: // VER_PLATFORM_WIN32_NT if (osver.dwMajorVersion < 5) { winver = QSysInfo::WV_NT; - } else if (osver.dwMajorVersion == 6) { - winver = QSysInfo::WV_VISTA; - } else if (osver.dwMinorVersion == 0) { + } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0) { winver = QSysInfo::WV_2000; - } else if (osver.dwMinorVersion == 1) { + } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 1) { winver = QSysInfo::WV_XP; - } else if (osver.dwMinorVersion == 2) { + } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 2) { winver = QSysInfo::WV_2003; + } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 0) { + winver = QSysInfo::WV_VISTA; + } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 1) { + winver = QSysInfo::WV_WINDOWS7; } else { - qWarning("Qt: Untested Windows version detected!"); + qWarning("Qt: Untested Windows version %d.%d detected!", + osver.dwMajorVersion, osver.dwMinorVersion); winver = QSysInfo::WV_NT_based; } } @@ -1667,6 +1674,8 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() winver = QSysInfo::WV_XP; else if (override == "VISTA") winver = QSysInfo::WV_VISTA; + else if (override == "WINDOWS7") + winver = QSysInfo::WV_WINDOWS7; } #endif @@ -1925,9 +1934,11 @@ QString qt_error_string(int errorCode) The message handler is a function that prints out debug messages, warnings, critical and fatal error messages. The Qt library (debug - version) contains hundreds of warning messages that are printed + mode) contains hundreds of warning messages that are printed when internal errors (usually invalid function arguments) - occur. If you implement your own message handler, you get total + occur. Qt built in release mode also contains such warnings unless + QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during + compilation. If you implement your own message handler, you get total control of these messages. The default message handler prints the message to the standard @@ -2022,7 +2033,8 @@ void qt_message_output(QtMsgType msgType, const char *buf) during compilation. If you pass the function a format string and a list of arguments, - it works in similar way to the C printf() function. + it works in similar way to the C printf() function. The format + should be a Latin-1 string. Example: @@ -2033,11 +2045,12 @@ void qt_message_output(QtMsgType msgType, const char *buf) \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 25 - This syntax automatically puts a single space between each item, - and outputs a newline at the end. It supports many C++ and Qt - types. + With this syntax, the function returns a QDebug object that is + configured to use the QtDebugMsg message type. It automatically + puts a single space between each item, and outputs a newline at + the end. It supports many C++ and Qt types. - To supress the output at runtime, install your own message handler + To suppress the output at run-time, install your own message handler with qInstallMsgHandler(). \sa qWarning(), qCritical(), qFatal(), qInstallMsgHandler(), @@ -2067,7 +2080,8 @@ void qDebug(const char *msg, ...) QT_FATAL_WARNINGS is defined. This function takes a format string and a list of arguments, - similar to the C printf() function. + similar to the C printf() function. The format should be a Latin-1 + string. Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 26 @@ -2105,8 +2119,9 @@ void qWarning(const char *msg, ...) message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. - This function takes a format string and a list of arguments, similar - to the C printf() function. + This function takes a format string and a list of arguments, + similar to the C printf() function. The format should be a Latin-1 + string. Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 28 @@ -2930,6 +2945,11 @@ bool QInternal::callFunction(InternalFunction func, void **args) Compares the floating point value \a p1 and \a p2 and returns \c true if they are considered equal, otherwise \c false. + Note that comparing values where either \a p1 or \a p2 is 0.0 will not work. + The solution to this is to compare against values greater than or equal to 1.0. + + \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 46 + The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are. */ @@ -2961,4 +2981,24 @@ bool QInternal::callFunction(InternalFunction func, void **args) \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 4 */ +/*! + \macro Q_DECL_EXPORT + \relates <QtGlobal> + + This macro marks a symbol for shared library export (see + \l{sharedlibrary.html}{Creating Shared Libraries}). + + \sa Q_DECL_IMPORT +*/ + +/*! + \macro Q_DECL_IMPORT + \relates <QtGlobal> + + This macro declares a symbol to be an import from a shared library (see + \l{sharedlibrary.html}{Creating Shared Libraries}). + + \sa Q_DECL_EXPORT +*/ + QT_END_NAMESPACE diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5f7f262..025442a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -289,6 +289,9 @@ namespace QtExperimental {} #ifdef AUTODETECT_COCOA # ifdef Q_OS_MAC64 # define QT_MAC_USE_COCOA 1 +# define QT_BUILD_KEY QT_BUILD_KEY_COCOA +# else +# define QT_BUILD_KEY QT_BUILD_KEY_CARBON # endif #endif @@ -1322,6 +1325,7 @@ public: WV_XP = 0x0030, WV_2003 = 0x0040, WV_VISTA = 0x0080, + WV_WINDOWS7 = 0x0090, WV_NT_based = 0x00f0, /* version numbers */ @@ -1330,6 +1334,7 @@ public: WV_5_1 = WV_XP, WV_5_2 = WV_2003, WV_6_0 = WV_VISTA, + WV_6_1 = WV_WINDOWS7, WV_CE = 0x0100, WV_CENET = 0x0200, @@ -1353,6 +1358,7 @@ public: MV_10_3 = 0x0005, MV_10_4 = 0x0006, MV_10_5 = 0x0007, + MV_10_6 = 0x0008, /* codenames */ MV_CHEETAH = MV_10_0, @@ -1360,7 +1366,8 @@ public: MV_JAGUAR = MV_10_2, MV_PANTHER = MV_10_3, MV_TIGER = MV_10_4, - MV_LEOPARD = MV_10_5 + MV_LEOPARD = MV_10_5, + MV_SNOWLEOPARD = MV_10_6 }; static const MacVersion MacintoshVersion; #endif diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index fb7fa0c..a519f4a 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -280,9 +280,7 @@ public: WindowStaysOnTopHint = 0x00040000, // reserved for Qt3Support: // WMouseNoMask = 0x00080000, - WindowOkButtonHint = 0x00080000, // WDestructiveClose = 0x00100000, - WindowCancelButtonHint = 0x00100000, // WStaticContents = 0x00200000, // WGroupLeader = 0x00400000, // WShowModal = 0x00800000, @@ -291,7 +289,9 @@ public: WindowStaysOnBottomHint = 0x04000000, WindowCloseButtonHint = 0x08000000, MacWindowToolBarButtonHint = 0x10000000, - BypassGraphicsProxyWidget = 0x20000000 + BypassGraphicsProxyWidget = 0x20000000, + WindowOkButtonHint = 0x00080000, + WindowCancelButtonHint = 0x00100000 #ifdef QT3_SUPPORT , diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 0fa31f8..611b19a 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -49,3 +49,260 @@ #include "qdebug.h" // This file is needed to force compilation of QDebug into the kernel library. + +/*! + \class QDebug + \ingroup io + \mainclass + \brief The QDebug class provides an output stream for debugging information. + + QDebug is used whenever the developer needs to write out debugging or tracing + information to a device, file, string or console. + + \section1 Basic Use + + In the common case, it is useful to call the qDebug() function to obtain a + default QDebug object to use for writing debugging information. + + \snippet doc/src/snippets/qdebug/qdebugsnippet.cpp 1 + + This constructs a QDebug object using the constructor that accepts a QtMsgType + value of QtDebugMsg. Similarly, the qWarning(), qCritical() and qFatal() + functions also return QDebug objects for the corresponding message types. + + The class also provides several constructors for other situations, including + a constructor that accepts a QFile or any other QIODevice subclass that is + used to write debugging information to files and other devices. The constructor + that accepts a QString is used to write to a string for display or serialization. + + \section1 Writing Custom Types to a Stream + + Many standard types can be written to QDebug objects, and Qt provides support for + most Qt value types. To add support for custom types, you need to implement a + streaming operator, as in the following example: + + \snippet doc/src/snippets/qdebug/qdebugsnippet.cpp 0 + + This is described in the \l{Debugging Techniques} and + \l{Creating Custom Qt Types#Making the Type Printable}{Creating Custom Qt Types} + documents. +*/ + +/*! + \fn QDebug::QDebug(QIODevice *device) + + Constructs a debug stream that writes to the given \a device. +*/ + +/*! + \fn QDebug::QDebug(QString *string) + + Constructs a debug stream that writes to the given \a string. +*/ + +/*! + \fn QDebug::QDebug(QtMsgType type) + + Constructs a debug stream that writes to the handler for the message type specified by \a type. +*/ + +/*! + \fn QDebug::QDebug(const QDebug &other) + + Constructs a copy of the \a other debug stream. +*/ + +/*! + \fn QDebug &QDebug::operator=(const QDebug &other) + + Assigns the \a other debug stream to this stream and returns a reference to + this stream. +*/ + +/*! + \fn QDebug::~QDebug() + + Flushes any pending data to be written and destroys the debug stream. +*/ + +/*! + \fn QDebug &QDebug::space() + + Writes a space character to the debug stream and returns a reference to + the stream. + + The stream will record that the last character sent to the stream was a + space. + + \sa nospace(), maybeSpace() +*/ + +/*! + \fn QDebug &QDebug::nospace() + + Clears the stream's internal flag that records whether the last character + was a space and returns a reference to the stream. + + \sa space(), maybeSpace() +*/ + +/*! + \fn QDebug &QDebug::maybeSpace() + + Writes a space character to the debug stream, depending on the last + character sent to the stream, and returns a reference to the stream. + + If the last character was a space character, this function writes a space + character to the stream; otherwise, no characters are written to the stream. + + \sa space(), nospace() +*/ + +/*! + \fn QDebug &QDebug::operator<<(QChar t) + + Writes the character, \a t, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(QBool t) + \internal + + Writes the boolean value, \a t, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(bool t) + + Writes the boolean value, \a t, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(char t) + + Writes the character, \a t, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(signed short i) + + Writes the signed short integer, \a i, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(unsigned short i) + + Writes then unsigned short integer, \a i, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(signed int i) + + Writes the signed integer, \a i, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(unsigned int i) + + Writes then unsigned integer, \a i, to the stream and returns a reference to + the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(signed long l) + + Writes the signed long integer, \a l, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(unsigned long l) + + Writes then unsigned long integer, \a l, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(qint64 i) + + Writes the signed 64-bit integer, \a i, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(quint64 i) + + Writes then unsigned 64-bit integer, \a i, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(float f) + + Writes the 32-bit floating point number, \a f, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(double f) + + Writes the 64-bit floating point number, \a f, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const char *s) + + Writes the '\0'-terminated string, \a s, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const QString &s) + + Writes the string, \a s, to the stream and returns a reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const QStringRef &s) + + Writes the string reference, \a s, to the stream and returns a reference to + the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const QLatin1String &s) + + Writes the Latin1-encoded string, \a s, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const QByteArray &b) + + Writes the byte array, \a b, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const void *p) + + Writes a pointer, \a p, to the stream and returns a reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(QTextStreamFunction f) + \internal +*/ + +/*! + \fn QDebug &QDebug::operator<<(QTextStreamManipulator m) + \internal +*/ diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 46c7dd8..b14f436 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -116,7 +116,9 @@ public: QAbstractFileEngine *engine; QStack<QAbstractFileEngineIterator *> fileEngineIterators; QString path; - QFileInfo fileInfo; + QFileInfo nextFileInfo; + //This fileinfo is the current that we will return from the public API + QFileInfo currentFileInfo; QString currentFilePath; QDirIterator::IteratorFlags iteratorFlags; QDir::Filters filters; @@ -140,8 +142,8 @@ QDirIteratorPrivate::QDirIteratorPrivate(const QString &path, const QStringList this->filters = filters; this->nameFilters = nameFilters; - fileInfo.setFile(path); - pushSubDirectory(fileInfo.isSymLink() ? fileInfo.canonicalFilePath() : path, + nextFileInfo.setFile(path); + pushSubDirectory(nextFileInfo.isSymLink() ? nextFileInfo.canonicalFilePath() : path, nameFilters, filters); } @@ -160,12 +162,12 @@ void QDirIteratorPrivate::pushSubDirectory(const QString &path, const QStringLis QDir::Filters filters) { if (iteratorFlags & QDirIterator::FollowSymlinks) { - if (fileInfo.filePath() != path) - fileInfo.setFile(path); - if (fileInfo.isSymLink()) { - visitedLinks << fileInfo.canonicalFilePath(); + if (nextFileInfo.filePath() != path) + nextFileInfo.setFile(path); + if (nextFileInfo.isSymLink()) { + visitedLinks << nextFileInfo.canonicalFilePath(); } else { - visitedLinks << fileInfo.absoluteFilePath(); + visitedLinks << nextFileInfo.absoluteFilePath(); } } @@ -199,8 +201,8 @@ void QDirIteratorPrivate::advance() QString subDir = it->currentFilePath(); #ifdef Q_OS_WIN - if (fileInfo.isSymLink()) - subDir = fileInfo.canonicalFilePath(); + if (currentFileInfo.isSymLink()) + subDir = currentFileInfo.canonicalFilePath(); #endif pushSubDirectory(subDir, it->nameFilters(), it->filters()); } @@ -213,15 +215,16 @@ void QDirIteratorPrivate::advance() while (it->hasNext()) { it->next(); if (matchesFilters(it)) { - fileInfo = it->currentFileInfo(); + currentFileInfo = nextFileInfo; + nextFileInfo = it->currentFileInfo(); // Signal that we want to follow this entry. - followNextDir = shouldFollowDirectory(fileInfo); - + followNextDir = shouldFollowDirectory(nextFileInfo); //We found a matching entry. return; } else if (iteratorFlags & QDirIterator::Subdirectories) { QFileInfo fileInfo = it->currentFileInfo(); + if (!shouldFollowDirectory(fileInfo)) continue; QString subDir = it->currentFilePath(); @@ -238,6 +241,7 @@ void QDirIteratorPrivate::advance() if (!foundDirectory) delete fileEngineIterators.pop(); } + currentFileInfo = nextFileInfo; done = true; } @@ -518,9 +522,7 @@ bool QDirIterator::hasNext() const */ QString QDirIterator::fileName() const { - if (d->fileInfo.path() != d->currentFilePath) - d->fileInfo.setFile(d->currentFilePath); - return d->fileInfo.fileName(); + return d->currentFileInfo.fileName(); } /*! @@ -543,9 +545,7 @@ QString QDirIterator::filePath() const */ QFileInfo QDirIterator::fileInfo() const { - if (d->fileInfo.filePath() != d->currentFilePath) - d->fileInfo.setFile(d->currentFilePath); - return d->fileInfo; + return d->currentFileInfo; } /*! diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index d8f08c9..d7da800 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -712,6 +712,9 @@ QFile::rename(const QString &newName) if(error() == QFile::NoError) { if (fileEngine()->rename(newName)) { unsetError(); + // engine was able to handle the new name so we just reset it + fileEngine()->setFileName(newName); + d->fileName = newName; return true; } @@ -731,10 +734,18 @@ QFile::rename(const QString &newName) } if (read == -1) { d->setError(QFile::RenameError, in.errorString()); - return true; + error = true; + } + if(!error) { + if (!in.remove()) { + d->setError(QFile::RenameError, tr("Cannot remove source file")); + error = true; + } } - if(!error) - in.remove(); + if (error) + out.remove(); + else + setFileName(newName); return !error; } } @@ -889,7 +900,10 @@ QFile::copy(const QString &newName) error = true; d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName)); } -#ifndef QT_NO_TEMPORARYFILE +#ifdef QT_NO_TEMPORARYFILE + if (error) + out.remove(); +#else if (!error) out.setAutoRemove(false); #endif diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index a062317..96e0f82 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -145,7 +145,7 @@ void QFileInfoPrivate::initFileEngine(const QString &file) bool QFileInfoPrivate::hasAccess(Access access) const { - if (!(data->fileEngine->fileFlags() & QAbstractFileEngine::LocalDiskFlag)) { + if (!(getFileFlags(QAbstractFileEngine::FileInfoAll) & QAbstractFileEngine::LocalDiskFlag)) { switch (access) { case ReadAccess: return getFileFlags(QAbstractFileEngine::ReadUserPerm); diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 4445e3c..fa44531 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -316,7 +316,7 @@ void QInotifyFileSystemWatcherEngine::readFromInotify() // qDebug() << "QInotifyFileSystemWatcherEngine::readFromInotify"; int buffSize = 0; - ioctl(inotifyFd, FIONREAD, &buffSize); + ioctl(inotifyFd, FIONREAD, (char *) &buffSize); QVarLengthArray<char, 4096> buffer(buffSize); buffSize = read(inotifyFd, buffer.data(), buffSize); const char *at = buffer.data(); diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 612f916..522be20 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -485,7 +485,7 @@ QString QFSFileEnginePrivate::longFileName(const QString &path) QString absPath = nativeAbsoluteFilePath(path); #if !defined(Q_OS_WINCE) QString prefix = QLatin1String("\\\\?\\"); - if (isUncPath(path)) { + if (isUncPath(absPath)) { prefix = QLatin1String("\\\\?\\UNC\\"); absPath.remove(0, 2); } diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a9d8ee2..a128482 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1476,11 +1476,15 @@ QByteArray QProcess::readAllStandardError() } /*! - Starts the program \a program in a new process, passing the - command line arguments in \a arguments. The OpenMode is set to \a - mode. QProcess will immediately enter the Starting state. If the - process starts successfully, QProcess will emit started(); - otherwise, error() will be emitted. + Starts the program \a program in a new process, if one is not already + running, passing the command line arguments in \a arguments. The OpenMode + is set to \a mode. + + The QProcess object will immediately enter the Starting state. If the + process starts successfully, QProcess will emit started(); otherwise, + error() will be emitted. If the QProcess object is already running a + process, a warning may be printed at the console, and the existing + process will continue running. Note that arguments that contain spaces are not passed to the process as separate arguments. @@ -1577,10 +1581,10 @@ static QStringList parseCombinedArgString(const QString &program) /*! \overload - Starts the program \a program in a new process. \a program is a - single string of text containing both the program name and its - arguments. The arguments are separated by one or more - spaces. For example: + Starts the program \a program in a new process, if one is not already + running. \a program is a single string of text containing both the + program name and its arguments. The arguments are separated by one or + more spaces. For example: \snippet doc/src/snippets/code/src_corelib_io_qprocess.cpp 5 @@ -1589,6 +1593,9 @@ static QStringList parseCombinedArgString(const QString &program) \snippet doc/src/snippets/code/src_corelib_io_qprocess.cpp 6 + If the QProcess object is already running a process, a warning may be + printed at the console, and the existing process will continue running. + Note that, on Windows, quotes need to be both escaped and quoted. For example, the above code would be specified in the following way to ensure that \c{"My Documents"} is used as the argument to @@ -1601,6 +1608,13 @@ static QStringList parseCombinedArgString(const QString &program) void QProcess::start(const QString &program, OpenMode mode) { QStringList args = parseCombinedArgString(program); + if (args.isEmpty()) { + Q_D(QProcess); + d->processError = QProcess::FailedToStart; + setErrorString(tr("No program defined")); + emit error(d->processError); + return; + } QString prog = args.first(); args.removeFirst(); @@ -1769,6 +1783,8 @@ bool QProcess::startDetached(const QString &program, bool QProcess::startDetached(const QString &program) { QStringList args = parseCombinedArgString(program); + if (args.isEmpty()) + return false; QString prog = args.first(); args.removeFirst(); diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 37173c8..33d4a47 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -850,10 +850,10 @@ bool QProcessPrivate::processStarted() qint64 QProcessPrivate::bytesAvailableFromStdout() const { - size_t nbytes = 0; + int nbytes = 0; qint64 available = 0; if (::ioctl(stdoutChannel.pipe[0], FIONREAD, (char *) &nbytes) >= 0) - available = (qint64) *((int *) &nbytes); + available = (qint64) nbytes; #if defined (QPROCESS_DEBUG) qDebug("QProcessPrivate::bytesAvailableFromStdout() == %lld", available); #endif @@ -862,10 +862,10 @@ qint64 QProcessPrivate::bytesAvailableFromStdout() const qint64 QProcessPrivate::bytesAvailableFromStderr() const { - size_t nbytes = 0; + int nbytes = 0; qint64 available = 0; if (::ioctl(stderrChannel.pipe[0], FIONREAD, (char *) &nbytes) >= 0) - available = (qint64) *((int *) &nbytes); + available = (qint64) nbytes; #if defined (QPROCESS_DEBUG) qDebug("QProcessPrivate::bytesAvailableFromStderr() == %lld", available); #endif diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 62b4ed5..484e79a 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2330,6 +2330,10 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \o \c{HKEY_LOCAL_MACHINE\Software\MySoft} \endlist + \note On Windows, for 32-bit programs running in WOW64 mode, settings are + stored in the following registry path: + \c{HKEY_LOCAL_MACHINE\Software\WOW6432node}. + If the file format is IniFormat, the following files are used on Unix and Mac OS X: diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 67d2eeb..a08c969 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -548,12 +548,13 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa case REG_EXPAND_SZ: case REG_SZ: { QString s; - QT_WA( { - s = QString::fromUtf16(((const ushort*)data.constData())); - }, { - s = QString::fromLocal8Bit(data.constData()); - } ); - + if (dataSize) { + QT_WA( { + s = QString::fromUtf16(((const ushort*)data.constData())); + }, { + s = QString::fromLocal8Bit(data.constData()); + } ); + } if (value != 0) *value = stringToVariant(s); break; @@ -561,19 +562,21 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa case REG_MULTI_SZ: { QStringList l; - int i = 0; - for (;;) { - QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData() + i); - }, { - s = QString::fromLocal8Bit(data.constData() + i); - } ); - i += s.length() + 1; + if (dataSize) { + int i = 0; + for (;;) { + QString s; + QT_WA( { + s = QString::fromUtf16((const ushort*)data.constData() + i); + }, { + s = QString::fromLocal8Bit(data.constData() + i); + } ); + i += s.length() + 1; - if (s.isEmpty()) - break; - l.append(s); + if (s.isEmpty()) + break; + l.append(s); + } } if (value != 0) *value = stringListToVariantList(l); @@ -583,11 +586,13 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa case REG_NONE: case REG_BINARY: { QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); - }, { - s = QString::fromLocal8Bit(data.constData(), data.size()); - } ); + if (dataSize) { + QT_WA( { + s = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); + }, { + s = QString::fromLocal8Bit(data.constData(), data.size()); + } ); + } if (value != 0) *value = stringToVariant(s); break; diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 3cfce83..6a7b067 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -268,11 +268,13 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen) /*NOTREACHED*/ } +#ifndef Q_WS_WIN static int qt_mkstemps(char *path, int slen) { int fd = 0; return (_gettemp(path, &fd, 0, slen) ? fd : -1); } +#endif //************* QTemporaryFileEngine class QTemporaryFileEngine : public QFSFileEngine diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 5227d4f..ed9d0aa 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -1370,7 +1370,7 @@ QTextStream::FieldAlignment QTextStream::fieldAlignment() const \snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 5 - Output: + The string \c s contains: \snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 6 diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index b3f9f1a..a23b2dd 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -377,6 +377,14 @@ QString qAppName() QLibrary) can be retrieved with libraryPaths() and manipulated by setLibraryPaths(), addLibraryPath(), and removeLibraryPath(). + On Unix/Linux Qt is configured to use the system local settings by + default. This can cause a conflict when using POSIX functions, for + instance, when converting between data types such as floats and + strings, since the notation may differ between locales. To get + around this problem call the POSIX function setlocale(LC_NUMERIC,"C") + right after initializing QApplication or QCoreApplication to reset + the locale that is used for number formatting to "C"-locale. + \sa QApplication, QAbstractEventDispatcher, QEventLoop, {Semaphores Example}, {Wait Conditions Example} */ diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 1bddbe5..5e76976 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -267,6 +267,7 @@ public: GrabKeyboard = 188, UngrabKeyboard = 189, CocoaRequestModal = 190, // Internal for requesting an application modal Cocoa Window + MacGLClearDrawable = 191, // Internal Cocoa, the window has changed, so we must clear Signal = 191, StateFinished = 192, diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 20548de..3fd768a 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -242,6 +242,7 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs, sizeof(GPostEventSource))); + postEventSource->serialNumber = 1; g_source_set_can_recurse(&postEventSource->source, true); g_source_attach(&postEventSource->source, mainContext); diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 880e95c..c4061f4 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -1059,11 +1059,20 @@ bool QEventDispatcherWin32::event(QEvent *e) QZeroTimerEvent *zte = static_cast<QZeroTimerEvent*>(e); WinTimerInfo *t = d->timerDict.value(zte->timerId()); if (t) { + t->inTimerEvent = true; + QTimerEvent te(zte->timerId()); QCoreApplication::sendEvent(t->obj, &te); - WinTimerInfo *tn = d->timerDict.value(zte->timerId()); - if (tn && t == tn) - QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId())); + + t = d->timerDict.value(zte->timerId()); + if (t) { + if (t->interval == 0 && t->inTimerEvent) { + // post the next zero timer event as long as the timer was not restarted + QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId())); + } + + t->inTimerEvent = false; + } } return true; } else if (e->type() == QEvent::Timer) { diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 719398c..b65f956 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1007,6 +1007,11 @@ enum { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value a QEvent will be sent and the member is invoked as soon as the application enters the main event loop. + \o If \a type is Qt::BlockingQueuedConnection, the method will be invoked in + the same way as for Qt::QueuedConnection, except that the current thread + will block until the event is delivered. Using this connection type to + communicate between objects in the same thread will lead to deadlocks. + \o If \a type is Qt::AutoConnection, the member is invoked synchronously if \a obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously. @@ -1897,6 +1902,12 @@ static QByteArray qualifiedName(const QMetaEnum &e) \ingroup objectmodel + Property meta-data is obtained from an object's meta-object. See + QMetaObject::property() and QMetaObject::propertyCount() for + details. + + \section1 Property Meta-Data + A property has a name() and a type(), as well as various attributes that specify its behavior: isReadable(), isWritable(), isDesignable(), isScriptable(), and isStored(). @@ -1912,9 +1923,10 @@ static QByteArray qualifiedName(const QMetaEnum &e) functions. See QObject::setProperty() and QObject::property() for details. - You get property meta-data through an object's meta-object. See - QMetaObject::property() and QMetaObject::propertyCount() for - details. + \section1 Copying and Assignment + + QMetaProperty objects can be copied by value. However, each copy will + refer to the same underlying property meta-data. \sa QMetaObject, QMetaEnum, QMetaMethod, {Qt's Property System} */ diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index be60055..ce10bae 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -75,9 +75,9 @@ QT_BEGIN_NAMESPACE \relates QMetaType This macro makes the type \a Type known to QMetaType as long as it - provides a public default constructor, a public copy constructor, - and a public destructor. It is needed to use the type \a Type as a - custom type in QVariant. + provides a public default constructor, a public copy constructor and + a public destructor. + It is needed to use the type \a Type as a custom type in QVariant. Ideally, this macro should be placed below the declaration of the class or struct. If that is not possible, it can be put in @@ -1255,9 +1255,9 @@ void QMetaType::destroy(int type, void *data) \relates QMetaType \threadsafe - Registers the type name \a typeName to the type \c{T}. Returns + Registers the type name \a typeName for the type \c{T}. Returns the internal ID used by QMetaType. Any class or struct that has a - public constructor, a public copy constructor, and a public + public default constructor, a public copy constructor and a public destructor can be registered. After a type has been registered, you can create and destroy diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 55cf464..05015c0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1121,13 +1121,13 @@ bool QObject::event(QEvent *e) QThreadData *threadData = d->threadData; QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher; if (eventDispatcher) { - // set inThreadChangeEvent to true to tell the dispatcher not to release out timer ids - // back to the pool (since the timer ids are moving to a new thread). - d->inThreadChangeEvent = true; QList<QPair<int, int> > timers = eventDispatcher->registeredTimers(this); - d->inThreadChangeEvent = false; if (!timers.isEmpty()) { + // set inThreadChangeEvent to true to tell the dispatcher not to release out timer ids + // back to the pool (since the timer ids are moving to a new thread). + d->inThreadChangeEvent = true; eventDispatcher->unregisterTimers(this); + d->inThreadChangeEvent = false; QMetaObject::invokeMethod(this, "_q_reregisterTimers", Qt::QueuedConnection, Q_ARG(void*, (new QList<QPair<int, int> >(timers)))); } diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index cdddf36..77d6599 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -95,8 +95,7 @@ static bool match(const uchar* found, const char* target, uint len) // (normalize it to be without the zero-terminating symbol) if (len > 0 && found[len-1] == '\0') --len; - // 0 means anything, "" means empty - return !found || (qstrncmp((const char *)found, target, len) == 0 && target[len] == '\0'); + return (memcmp(found, target, len) == 0 && target[len] == '\0'); } static uint elfHash(const char *name) @@ -765,8 +764,6 @@ void QTranslatorPrivate::clear() } /*! - \since 4.5 - Returns the translation for the key (\a context, \a sourceText, \a disambiguation). If none is found, also tries (\a context, \a sourceText, ""). If that still fails, returns an empty string. diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index 44c4482..f426feb 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -56,7 +56,8 @@ \section1 Non-atomic convenience operators For convenience, QAtomicInt provides integer comparison, cast, and - assignment operators. Note that these operators are \e not atomic. + assignment operators. Note that a combination of these operators + is \e not an atomic operation. \section1 The Atomic API diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index 71ecab5..96a9940 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -96,9 +96,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (true)) QMutexPool is destructed. */ QMutexPool::QMutexPool(bool recursive, int size) - : count(size), recurs(recursive) + : mutexes(size), count(size), recurs(recursive) { - mutexes = new QMutex*[count]; for (int index = 0; index < count; ++index) { mutexes[index] = 0; } @@ -110,13 +109,10 @@ QMutexPool::QMutexPool(bool recursive, int size) */ QMutexPool::~QMutexPool() { - QMutexLocker locker(&mutex); for (int index = 0; index < count; ++index) { delete mutexes[index]; mutexes[index] = 0; } - delete [] mutexes; - mutexes = 0; } /*! @@ -138,12 +134,9 @@ QMutex *QMutexPool::get(const void *address) if (!mutexes[index]) { // mutex not created, create one - - QMutexLocker locker(&mutex); - // we need to check once again that the mutex hasn't been created, since - // 2 threads could be trying to create a mutex at the same index... - if (!mutexes[index]) - mutexes[index] = new QMutex(recurs ? QMutex::Recursive : QMutex::NonRecursive); + QMutex *newMutex = new QMutex(recurs ? QMutex::Recursive : QMutex::NonRecursive); + if (!mutexes[index].testAndSetOrdered(0, newMutex)) + delete newMutex; } return mutexes[index]; diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h index 65a3b54..1009ebb 100644 --- a/src/corelib/thread/qmutexpool_p.h +++ b/src/corelib/thread/qmutexpool_p.h @@ -53,7 +53,9 @@ // We mean it. // +#include "QtCore/qatomic.h" #include "QtCore/qmutex.h" +#include "QtCore/qvarlengtharray.h" #ifndef QT_NO_THREAD @@ -70,8 +72,7 @@ public: static QMutex *globalInstanceGet(const void *address); private: - QMutex mutex; - QMutex **mutexes; + QVarLengthArray<QAtomicPointer<QMutex>, 128> mutexes; int count; bool recurs; }; diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 7f87897..2fb6335 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -297,6 +297,12 @@ void QAdoptedThread::run() priority parameter. If the thread is already running, this function does nothing. + The effect of the \a priority parameter is dependent on the + operating system's scheduling policy. In particular, the \a priority + will be ignored on systems that do not support thread priorities + (such as on Linux, see http://linux.die.net/man/2/sched_setscheduler + for more details). + \sa run(), terminate() */ @@ -590,6 +596,12 @@ void QThread::cleanup() The \a priority argument can be any value in the \c QThread::Priority enum except for \c InheritPriorty. + The effect of the \a priority parameter is dependent on the + operating system's scheduling policy. In particular, the \a priority + will be ignored on systems that do not support thread priorities + (such as on Linux, see http://linux.die.net/man/2/sched_setscheduler + for more details). + \sa Priority priority() start() */ diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index a3cbecc..c454224 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -652,7 +652,7 @@ QLinkedListData QLinkedListData::shared_null = { Constructs an uninitialized iterator. Functions like operator*() and operator++() should not be called - on an uninitialized iterartor. Use operator=() to assign a value + on an uninitialized iterator. Use operator=() to assign a value to it before using it. \sa QLinkedList::begin() QLinkedList::end() @@ -858,7 +858,7 @@ QLinkedListData QLinkedListData::shared_null = { Constructs an uninitialized iterator. Functions like operator*() and operator++() should not be called - on an uninitialized iterartor. Use operator=() to assign a value + on an uninitialized iterator. Use operator=() to assign a value to it before using it. \sa QLinkedList::constBegin() QLinkedList::constEnd() diff --git a/src/corelib/tools/qlistdata.cpp b/src/corelib/tools/qlistdata.cpp index 2b1c086..d7c39a7 100644 --- a/src/corelib/tools/qlistdata.cpp +++ b/src/corelib/tools/qlistdata.cpp @@ -1193,7 +1193,7 @@ void **QListData::erase(void **xi) Constructs an uninitialized iterator. Functions like operator*() and operator++() should not be called - on an uninitialized iterartor. Use operator=() to assign a value + on an uninitialized iterator. Use operator=() to assign a value to it before using it. \sa QList::begin() QList::end() @@ -1416,7 +1416,7 @@ void **QListData::erase(void **xi) Constructs an uninitialized iterator. Functions like operator*() and operator++() should not be called - on an uninitialized iterartor. Use operator=() to assign a value + on an uninitialized iterator. Use operator=() to assign a value to it before using it. \sa QList::constBegin() QList::constEnd() diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index db2fc26..559ba81 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -4399,7 +4399,8 @@ double QLocalePrivate::stringToDouble(const QString &number, bool *ok, GroupSeparatorMode group_sep_mode) const { CharBuff buff; - if (!numberToCLocale(number, group_sep_mode, &buff)) { + if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, + group_sep_mode, &buff)) { if (ok != 0) *ok = false; return 0.0; @@ -4411,7 +4412,8 @@ qlonglong QLocalePrivate::stringToLongLong(const QString &number, int base, bool *ok, GroupSeparatorMode group_sep_mode) const { CharBuff buff; - if (!numberToCLocale(number, group_sep_mode, &buff)) { + if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, + group_sep_mode, &buff)) { if (ok != 0) *ok = false; return 0; @@ -4424,7 +4426,8 @@ qulonglong QLocalePrivate::stringToUnsLongLong(const QString &number, int base, bool *ok, GroupSeparatorMode group_sep_mode) const { CharBuff buff; - if (!numberToCLocale(number, group_sep_mode, &buff)) { + if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, + group_sep_mode, &buff)) { if (ok != 0) *ok = false; return 0; diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index d8a9923..c3a989e 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -842,15 +842,19 @@ QT_BEGIN_NAMESPACE */ void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr) { - QMutexLocker lock(&knownPointers()->mutex); + KnownPointers *const kp = knownPointers(); + if (!kp) + return; // end-game: the application is being destroyed already + + QMutexLocker lock(&kp->mutex); void *actual = const_cast<void*>(ptr); - if (knownPointers()->values.contains(actual)) { + if (kp->values.contains(actual)) { printBacktrace(knownPointers()->values.value(actual)); qFatal("QSharedPointerData: internal self-check failed: pointer %p was already tracked " "by another QSharedPointerData object", actual); } - knownPointers()->values.insert(actual, saveBacktrace()); + kp->values.insert(actual, saveBacktrace()); } /*! @@ -858,9 +862,13 @@ void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr) */ void QtSharedPointer::internalSafetyCheckRemove(const volatile void *ptr) { - QMutexLocker lock(&knownPointers()->mutex); + KnownPointers *const kp = knownPointers(); + if (!kp) + return; // end-game: the application is being destroyed already + + QMutexLocker lock(&kp->mutex); void *actual = const_cast<void*>(ptr); - knownPointers()->values.remove(actual); + kp->values.remove(actual); } QT_END_NAMESPACE diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 1b29adc..375d672 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -579,7 +579,7 @@ const QString::Null QString::null = { }; '\\0' character for a null string (\e not a null pointer), and QString() compares equal to QString(""). We recommend that you always use the isEmpty() function and avoid isNull(). - + \section1 Argument Formats In member functions where an argument \e format can be specified @@ -1433,7 +1433,7 @@ QString &QString::append(QChar ch) truncated at the specified \a position. \snippet doc/src/snippets/qstring/main.cpp 37 - + \sa insert(), replace() */ QString &QString::remove(int pos, int len) @@ -1552,7 +1552,7 @@ QString &QString::replace(int pos, int len, const QChar *unicode, int size) return *this; if (pos + len > d->size) len = d->size - pos; - + uint index = pos; replace_helper(&index, 1, len, unicode, size); return *this; @@ -1561,15 +1561,13 @@ QString &QString::replace(int pos, int len, const QChar *unicode, int size) /*! \fn QString &QString::replace(int position, int n, QChar after) \overload replace() - + Replaces \a n characters beginning at index \a position with the character \a after and returns a reference to this string. */ QString &QString::replace(int pos, int len, QChar after) { - uint index = pos; - replace_helper(&index, 1, len, &after, 1); - return *this; + return replace(pos, len, &after, 1); } /*! @@ -1602,7 +1600,7 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar { if (blen == alen) { detach(); - for (int i = 0; i < nIndices; ++i) + for (int i = 0; i < nIndices; ++i) memcpy(d->data + indices[i], after, alen * sizeof(QChar)); } else if (alen < blen) { detach(); @@ -1633,7 +1631,7 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar int newLen = d->size + adjust; int moveend = d->size; resize(newLen); - + while (nIndices) { --nIndices; int movestart = indices[nIndices] + blen; @@ -1685,7 +1683,7 @@ QString &QString::replace(const QChar *before, int blen, memcpy(copy, before, blen*sizeof(QChar)); b = copy; } - + QStringMatcher matcher(b, blen, cs); int index = 0; @@ -1712,7 +1710,7 @@ QString &QString::replace(const QChar *before, int blen, // index has to be adjusted in case we get back into the loop above. index += pos*(alen-blen); } - + if (a != after) ::free((QChar *)a); if (b != before) @@ -2250,7 +2248,7 @@ int QString::indexOf(const QLatin1String &str, int from, Qt::CaseSensitivity cs) QVarLengthArray<ushort> s(len); for (int i = 0; i < len; ++i) s[i] = str.latin1()[i]; - + return qFindString(unicode(), length(), from, (const QChar *)s.data(), len, cs); } @@ -2346,7 +2344,7 @@ static int lastIndexOfHelper(const ushort *haystack, int from, const ushort *nee /* See indexOf() for explanations. */ - + const ushort *end = haystack; haystack += from; const int sl_minus_1 = sl-1; @@ -2408,7 +2406,7 @@ int QString::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) c const int sl = str.d->size; if (sl == 1) return lastIndexOf(QChar(str.d->data[0]), from, cs); - + const int l = d->size; if (from < 0) from += l; @@ -2446,7 +2444,7 @@ int QString::lastIndexOf(const QLatin1String &str, int from, Qt::CaseSensitivity const int sl = qstrlen(str.latin1()); if (sl == 1) return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs); - + const int l = d->size; if (from < 0) from += l; @@ -4864,7 +4862,8 @@ QString QString::toUpper() const a pointer to a zero-terminated array of unicode characters of type ushort (as returned by QString::utf16()). - \note This function expects a UTF-8 string for %s. + \note This function expects a UTF-8 string for %s and Latin-1 for + the format string. The format string supports most of the conversion specifiers provided by printf() in the standard C++ library. It doesn't @@ -5994,7 +5993,7 @@ QString QString::normalized(QString::NormalizationForm mode, QChar::UnicodeVersi } if (simple) return *this; - + QString s = *this; if (version != CURRENT_VERSION) { for (int i = 0; i < NumNormalizationCorrections; ++i) { @@ -6206,7 +6205,7 @@ static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int f /*! Returns a copy of this string with the lowest numbered place marker replaced by string \a a, i.e., \c %1, \c %2, ..., \c %99. - + \a fieldWidth specifies the minimum amount of space that argument \a a shall occupy. If \a a requires less space than \a fieldWidth, it is padded to \a fieldWidth with character \a fillChar. A positive @@ -6818,7 +6817,7 @@ void QString::updateProperties() const Appends the given \a ch character onto the end of this string. */ -/*! +/*! \fn std::string QString::toStdString() const Returns a std::string object with the data contained in this diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 6bea03b..3fd52ee 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -98,6 +98,8 @@ struct QVectorTypedData T array[1]; }; +class QRegion; + template <typename T> class QVector { diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index bff4e15..ff1a01f 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -2792,9 +2792,9 @@ QStringRef QXmlStreamReader::documentEncoding() const \inmodule QtXml \ingroup xml-tools - QXmlStreamWriter is the pendent to QXmlStreamReader for writing + QXmlStreamWriter is the counterpart to QXmlStreamReader for writing XML. Like its related class, it operates on a QIODevice specified - with setDevice(). The API is simple and straight forward: For every + with setDevice(). The API is simple and straightforward: for every XML token or event you want to write, the writer provides a specialized function. @@ -2814,6 +2814,15 @@ QStringRef QXmlStreamReader::documentEncoding() const writeStartElement(). A convenience method writeTextElement() can be used for writing terminal elements that contain nothing but text. + The following abridged code snippet shows the basic use of the class + to write formatted XML with indentation: + + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp start stream + \dots + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp write element + \dots + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp finish stream + QXmlStreamWriter takes care of prefixing namespaces, all you have to do is specify the \c namespaceUri when writing elements or attributes. If you must conform to certain prefixes, you can force diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 91b9cb1..8c701f5 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -137,6 +137,7 @@ static dbus_bool_t qDBusAddTimeout(DBusTimeout *timeout, void *data) if (!q_dbus_timeout_get_enabled(timeout)) return true; + QDBusWatchAndTimeoutLocker locker(AddTimeoutAction, d); if (QCoreApplication::instance() && QThread::currentThread() == d->thread()) { // correct thread return qDBusRealAddTimeout(d, timeout, q_dbus_timeout_get_interval(timeout)); @@ -152,7 +153,6 @@ static dbus_bool_t qDBusAddTimeout(DBusTimeout *timeout, void *data) static bool qDBusRealAddTimeout(QDBusConnectionPrivate *d, DBusTimeout *timeout, int ms) { - QDBusWatchAndTimeoutLocker locker(AddTimeoutAction, d); Q_ASSERT(d->timeouts.keys(timeout).isEmpty()); int timerId = d->startTimer(ms); @@ -921,10 +921,9 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) rootNode(QString(QLatin1Char('/'))) { static const bool threads = qDBusInitThreads(); - static const int debugging = qgetenv("QDBUS_DEBUG").toInt(); + static const int debugging = ::isDebugging = qgetenv("QDBUS_DEBUG").toInt(); Q_UNUSED(threads) - ::isDebugging = debugging; #ifdef QDBUS_THREAD_DEBUG if (debugging > 1) qdbusThreadDebug = qdbusDefaultThreadDebug; @@ -1036,15 +1035,16 @@ void QDBusConnectionPrivate::customEvent(QEvent *e) QDBusLockerBase::BeforeDeliver, this); switch (ev->subtype) { - case QDBusConnectionCallbackEvent::AddTimeout: + case QDBusConnectionCallbackEvent::AddTimeout: { + QDBusWatchAndTimeoutLocker locker(RealAddTimeoutAction, this); while (!timeoutsPendingAdd.isEmpty()) { QPair<DBusTimeout *, int> entry = timeoutsPendingAdd.takeFirst(); qDBusRealAddTimeout(this, entry.first, entry.second); } break; + } case QDBusConnectionCallbackEvent::KillTimer: - qDebug() << QThread::currentThread() << "RemoveTimeout: killing timer" << (ev->timerId & 0xffffff); killTimer(ev->timerId); break; diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h index 3880a7f..5ec9800 100644 --- a/src/dbus/qdbuspendingreply.h +++ b/src/dbus/qdbuspendingreply.h @@ -95,7 +95,7 @@ namespace QDBusPendingReplyTypes { enum { Total = Next::Total + 1 }; static inline void fillMetaTypes(int *p) { - *p = metaTypeFor<T1>(); + *p = metaTypeFor<T1>(0); Next::fillMetaTypes(++p); } }; @@ -171,7 +171,7 @@ public: Q_ASSERT_X(Index < count() && Index >= 0, "QDBusPendingReply::argumentAt", "Index out of bounds"); typedef typename Select<Index>::Type ResultType; - return qdbus_cast<ResultType>(argumentAt(Index)); + return qdbus_cast<ResultType>(argumentAt(Index), 0); } inline typename Select<0>::Type value() const diff --git a/src/dbus/qdbusthreaddebug_p.h b/src/dbus/qdbusthreaddebug_p.h index 715bd6f..20d819f 100644 --- a/src/dbus/qdbusthreaddebug_p.h +++ b/src/dbus/qdbusthreaddebug_p.h @@ -92,9 +92,10 @@ enum ThreadAction { PendingCallBlockAction = 28, AddTimeoutAction = 50, - RemoveTimeoutAction = 51, - KillTimerAction = 52, - TimerEventAction = 53, + RealAddTimeoutAction = 51, + RemoveTimeoutAction = 52, + KillTimerAction = 58, + TimerEventAction = 59, AddWatchAction = 60, RemoveWatchAction = 61, ToggleWatchAction = 62, diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm index b6412c2..68efb8f 100644 --- a/src/gui/accessible/qaccessible_mac.mm +++ b/src/gui/accessible/qaccessible_mac.mm @@ -72,55 +72,36 @@ typedef NSString * const QAXRoleType; #define QAXApplicationRole NSAccessibilityApplicationRole #define QAXButtonRole NSAccessibilityButtonRole #define QAXCancelAction NSAccessibilityCancelAction -#define QAXCancelAction NSAccessibilityCancelAction #define QAXCheckBoxRole NSAccessibilityCheckBoxRole #define QAXChildrenAttribute NSAccessibilityChildrenAttribute -#define QAXChildrenAttribute NSAccessibilityChildrenAttribute -#define QAXChildrenAttribute NSAccessibilityChildrenAttribute #define QAXCloseButtonAttribute NSAccessibilityCloseButtonAttribute #define QAXCloseButtonAttribute NSAccessibilityCloseButtonAttribute #define QAXColumnRole NSAccessibilityColumnRole #define QAXConfirmAction NSAccessibilityConfirmAction -#define QAXConfirmAction NSAccessibilityConfirmAction #define QAXContentsAttribute NSAccessibilityContentsAttribute -#define QAXContentsAttribute NSAccessibilityContentsAttribute -#define QAXDecrementAction NSAccessibilityDecrementAction #define QAXDecrementAction NSAccessibilityDecrementAction #define QAXDecrementArrowSubrole NSAccessibilityDecrementArrowSubrole #define QAXDecrementPageSubrole NSAccessibilityDecrementPageSubrole #define QAXDescriptionAttribute NSAccessibilityDescriptionAttribute -#define QAXDescriptionAttribute NSAccessibilityDescriptionAttribute -#define QAXDescriptionAttribute NSAccessibilityDescriptionAttribute -#define QAXDescriptionAttribute NSAccessibilityDescriptionAttribute -#define QAXEnabledAttribute NSAccessibilityEnabledAttribute #define QAXEnabledAttribute NSAccessibilityEnabledAttribute #define QAXExpandedAttribute NSAccessibilityExpandedAttribute #define QAXFocusedAttribute NSAccessibilityFocusedAttribute -#define QAXFocusedAttribute NSAccessibilityFocusedAttribute -#define QAXFocusedAttribute NSAccessibilityFocusedAttribute #define QAXFocusedUIElementChangedNotification NSAccessibilityFocusedUIElementChangedNotification #define QAXFocusedWindowChangedNotification NSAccessibilityFocusedWindowChangedNotification #define QAXGroupRole NSAccessibilityGroupRole #define QAXGrowAreaAttribute NSAccessibilityGrowAreaAttribute -#define QAXGrowAreaAttribute NSAccessibilityGrowAreaAttribute #define QAXGrowAreaRole NSAccessibilityGrowAreaRole #define QAXHelpAttribute NSAccessibilityHelpAttribute -#define QAXHelpAttribute NSAccessibilityHelpAttribute -#define QAXHelpAttribute NSAccessibilityHelpAttribute #define QAXHorizontalOrientationValue NSAccessibilityHorizontalOrientationValue #define QAXHorizontalScrollBarAttribute NSAccessibilityHorizontalScrollBarAttribute -#define QAXHorizontalScrollBarAttribute NSAccessibilityHorizontalScrollBarAttribute -#define QAXIncrementAction NSAccessibilityIncrementAction #define QAXIncrementAction NSAccessibilityIncrementAction #define QAXIncrementArrowSubrole NSAccessibilityIncrementArrowSubrole #define QAXIncrementPageSubrole NSAccessibilityIncrementPageSubrole #define QAXIncrementorRole NSAccessibilityIncrementorRole #define QAXLinkedUIElementsAttribute NSAccessibilityLinkedUIElementsAttribute -#define QAXLinkedUIElementsAttribute NSAccessibilityLinkedUIElementsAttribute #define QAXListRole NSAccessibilityListRole #define QAXMainAttribute NSAccessibilityMainAttribute #define QAXMaxValueAttribute NSAccessibilityMaxValueAttribute -#define QAXMaxValueAttribute NSAccessibilityMaxValueAttribute #define QAXMenuBarRole NSAccessibilityMenuBarRole #define QAXMenuButtonRole NSAccessibilityMenuButtonRole #define QAXMenuClosedNotification NSAccessibilityMenuClosedNotification @@ -128,151 +109,90 @@ typedef NSString * const QAXRoleType; #define QAXMenuOpenedNotification NSAccessibilityMenuOpenedNotification #define QAXMenuRole NSAccessibilityMenuRole #define QAXMinValueAttribute NSAccessibilityMinValueAttribute -#define QAXMinValueAttribute NSAccessibilityMinValueAttribute #define QAXMinimizeButtonAttribute NSAccessibilityMinimizeButtonAttribute -#define QAXMinimizeButtonAttribute NSAccessibilityMinimizeButtonAttribute -#define QAXMinimizedAttribute NSAccessibilityMinimizedAttribute #define QAXMinimizedAttribute NSAccessibilityMinimizedAttribute #define QAXNextContentsAttribute NSAccessibilityNextContentsAttribute -#define QAXNextContentsAttribute NSAccessibilityNextContentsAttribute -#define QAXOrientationAttribute NSAccessibilityOrientationAttribute -#define QAXOrientationAttribute NSAccessibilityOrientationAttribute #define QAXOrientationAttribute NSAccessibilityOrientationAttribute #define QAXParentAttribute NSAccessibilityParentAttribute #define QAXPickAction NSAccessibilityPickAction -#define QAXPickAction NSAccessibilityPickAction #define QAXPopUpButtonRole NSAccessibilityPopUpButtonRole #define QAXPositionAttribute NSAccessibilityPositionAttribute -#define QAXPositionAttribute NSAccessibilityPositionAttribute -#define QAXPressAction NSAccessibilityPressAction #define QAXPressAction NSAccessibilityPressAction #define QAXPreviousContentsAttribute NSAccessibilityPreviousContentsAttribute -#define QAXPreviousContentsAttribute NSAccessibilityPreviousContentsAttribute -#define QAXPreviousContentsAttribute NSAccessibilityPreviousContentsAttribute #define QAXProgressIndicatorRole NSAccessibilityProgressIndicatorRole #define QAXRadioButtonRole NSAccessibilityRadioButtonRole #define QAXRoleAttribute NSAccessibilityRoleAttribute -#define QAXRoleAttribute NSAccessibilityRoleAttribute #define QAXRoleDescriptionAttribute NSAccessibilityRoleDescriptionAttribute #define QAXRowRole NSAccessibilityRowRole #define QAXRowsAttribute NSAccessibilityRowsAttribute -#define QAXRowsAttribute NSAccessibilityRowsAttribute -#define QAXScrollAreaRole NSAccessibilityScrollAreaRole -#define QAXScrollAreaRole NSAccessibilityScrollAreaRole #define QAXScrollAreaRole NSAccessibilityScrollAreaRole #define QAXScrollBarRole NSAccessibilityScrollBarRole #define QAXSelectedAttribute NSAccessibilitySelectedAttribute #define QAXSelectedChildrenAttribute NSAccessibilitySelectedChildrenAttribute #define QAXSelectedRowsAttribute NSAccessibilitySelectedRowsAttribute -#define QAXSelectedRowsAttribute NSAccessibilitySelectedRowsAttribute -#define QAXSizeAttribute NSAccessibilitySizeAttribute #define QAXSizeAttribute NSAccessibilitySizeAttribute #define QAXSliderRole NSAccessibilitySliderRole #define QAXSplitGroupRole NSAccessibilitySplitGroupRole #define QAXSplitterRole NSAccessibilitySplitterRole -#define QAXSplitterRole NSAccessibilitySplitterRole -#define QAXSplitterRole NSAccessibilitySplitterRole -#define QAXSplittersAttribute NSAccessibilitySplittersAttribute #define QAXSplittersAttribute NSAccessibilitySplittersAttribute #define QAXStaticTextRole NSAccessibilityStaticTextRole -#define QAXStaticTextRole NSAccessibilityStaticTextRole -#define QAXSubroleAttribute NSAccessibilitySubroleAttribute #define QAXSubroleAttribute NSAccessibilitySubroleAttribute #define QAXSubroleAttribute NSAccessibilitySubroleAttribute #define QAXTabGroupRole NSAccessibilityTabGroupRole -#define QAXTabGroupRole NSAccessibilityTabGroupRole #define QAXTableRole NSAccessibilityTableRole #define QAXTabsAttribute NSAccessibilityTabsAttribute -#define QAXTabsAttribute NSAccessibilityTabsAttribute #define QAXTextFieldRole NSAccessibilityTextFieldRole -#define QAXTextFieldRole NSAccessibilityTextFieldRole -#define QAXTitleAttribute NSAccessibilityTitleAttribute -#define QAXTitleAttribute NSAccessibilityTitleAttribute #define QAXTitleAttribute NSAccessibilityTitleAttribute -#define QAXTitleAttribute NSAccessibilityTitleAttribute -#define QAXTitleUIElementAttribute NSAccessibilityTitleUIElementAttribute #define QAXTitleUIElementAttribute NSAccessibilityTitleUIElementAttribute #define QAXToolbarButtonAttribute NSAccessibilityToolbarButtonAttribute -#define QAXToolbarButtonAttribute NSAccessibilityToolbarButtonAttribute #define QAXToolbarRole NSAccessibilityToolbarRole #define QAXTopLevelUIElementAttribute NSAccessibilityTopLevelUIElementAttribute -#define QAXTopLevelUIElementAttribute NSAccessibilityTopLevelUIElementAttribute -#define QAXTopLevelUIElementAttribute NSAccessibilityTopLevelUIElementAttribute -#define QAXUnknownRole NSAccessibilityUnknownRole #define QAXUnknownRole NSAccessibilityUnknownRole #define QAXValueAttribute NSAccessibilityValueAttribute -#define QAXValueAttribute NSAccessibilityValueAttribute -#define QAXValueAttribute NSAccessibilityValueAttribute -#define QAXValueAttribute NSAccessibilityValueAttribute #define QAXValueChangedNotification NSAccessibilityValueChangedNotification #define QAXValueIndicatorRole NSAccessibilityValueIndicatorRole #define QAXVerticalOrientationValue NSAccessibilityVerticalOrientationValue #define QAXVerticalScrollBarAttribute NSAccessibilityVerticalScrollBarAttribute -#define QAXVerticalScrollBarAttribute NSAccessibilityVerticalScrollBarAttribute #define QAXVisibleRowsAttribute NSAccessibilityVisibleRowsAttribute -#define QAXVisibleRowsAttribute NSAccessibilityVisibleRowsAttribute -#define QAXWindowAttribute NSAccessibilityWindowAttribute -#define QAXWindowAttribute NSAccessibilityWindowAttribute #define QAXWindowAttribute NSAccessibilityWindowAttribute #define QAXWindowCreatedNotification NSAccessibilityWindowCreatedNotification #define QAXWindowMovedNotification NSAccessibilityWindowMovedNotification #define QAXWindowRole NSAccessibilityWindowRole #define QAXZoomButtonAttribute NSAccessibilityZoomButtonAttribute -#define QAXZoomButtonAttribute NSAccessibilityZoomButtonAttribute #else typedef CFStringRef const QAXRoleType; #define QAXApplicationRole kAXApplicationRole #define QAXButtonRole kAXButtonRole #define QAXCancelAction kAXCancelAction -#define QAXCancelAction kAXCancelAction #define QAXCheckBoxRole kAXCheckBoxRole #define QAXChildrenAttribute kAXChildrenAttribute -#define QAXChildrenAttribute kAXChildrenAttribute -#define QAXChildrenAttribute kAXChildrenAttribute -#define QAXCloseButtonAttribute kAXCloseButtonAttribute #define QAXCloseButtonAttribute kAXCloseButtonAttribute #define QAXColumnRole kAXColumnRole #define QAXConfirmAction kAXConfirmAction -#define QAXConfirmAction kAXConfirmAction #define QAXContentsAttribute kAXContentsAttribute -#define QAXContentsAttribute kAXContentsAttribute -#define QAXDecrementAction kAXDecrementAction #define QAXDecrementAction kAXDecrementAction #define QAXDecrementArrowSubrole kAXDecrementArrowSubrole #define QAXDecrementPageSubrole kAXDecrementPageSubrole #define QAXDescriptionAttribute kAXDescriptionAttribute -#define QAXDescriptionAttribute kAXDescriptionAttribute -#define QAXDescriptionAttribute kAXDescriptionAttribute -#define QAXDescriptionAttribute kAXDescriptionAttribute -#define QAXEnabledAttribute kAXEnabledAttribute #define QAXEnabledAttribute kAXEnabledAttribute #define QAXExpandedAttribute kAXExpandedAttribute #define QAXFocusedAttribute kAXFocusedAttribute -#define QAXFocusedAttribute kAXFocusedAttribute -#define QAXFocusedAttribute kAXFocusedAttribute #define QAXFocusedUIElementChangedNotification kAXFocusedUIElementChangedNotification #define QAXFocusedWindowChangedNotification kAXFocusedWindowChangedNotification #define QAXGroupRole kAXGroupRole #define QAXGrowAreaAttribute kAXGrowAreaAttribute -#define QAXGrowAreaAttribute kAXGrowAreaAttribute #define QAXGrowAreaRole kAXGrowAreaRole #define QAXHelpAttribute kAXHelpAttribute -#define QAXHelpAttribute kAXHelpAttribute -#define QAXHelpAttribute kAXHelpAttribute #define QAXHorizontalOrientationValue kAXHorizontalOrientationValue #define QAXHorizontalScrollBarAttribute kAXHorizontalScrollBarAttribute -#define QAXHorizontalScrollBarAttribute kAXHorizontalScrollBarAttribute -#define QAXIncrementAction kAXIncrementAction #define QAXIncrementAction kAXIncrementAction #define QAXIncrementArrowSubrole kAXIncrementArrowSubrole #define QAXIncrementPageSubrole kAXIncrementPageSubrole #define QAXIncrementorRole kAXIncrementorRole #define QAXLinkedUIElementsAttribute kAXLinkedUIElementsAttribute -#define QAXLinkedUIElementsAttribute kAXLinkedUIElementsAttribute #define QAXListRole kAXListRole #define QAXMainAttribute kAXMainAttribute #define QAXMaxValueAttribute kAXMaxValueAttribute -#define QAXMaxValueAttribute kAXMaxValueAttribute #define QAXMenuBarRole kAXMenuBarRole #define QAXMenuButtonRole kAXMenuButtonRole #define QAXMenuClosedNotification kAXMenuClosedNotification @@ -280,97 +200,55 @@ typedef CFStringRef const QAXRoleType; #define QAXMenuOpenedNotification kAXMenuOpenedNotification #define QAXMenuRole kAXMenuRole #define QAXMinValueAttribute kAXMinValueAttribute -#define QAXMinValueAttribute kAXMinValueAttribute #define QAXMinimizeButtonAttribute kAXMinimizeButtonAttribute -#define QAXMinimizeButtonAttribute kAXMinimizeButtonAttribute -#define QAXMinimizedAttribute kAXMinimizedAttribute #define QAXMinimizedAttribute kAXMinimizedAttribute #define QAXNextContentsAttribute kAXNextContentsAttribute -#define QAXNextContentsAttribute kAXNextContentsAttribute -#define QAXOrientationAttribute kAXOrientationAttribute -#define QAXOrientationAttribute kAXOrientationAttribute #define QAXOrientationAttribute kAXOrientationAttribute #define QAXParentAttribute kAXParentAttribute #define QAXPickAction kAXPickAction -#define QAXPickAction kAXPickAction #define QAXPopUpButtonRole kAXPopUpButtonRole #define QAXPositionAttribute kAXPositionAttribute -#define QAXPositionAttribute kAXPositionAttribute -#define QAXPressAction kAXPressAction #define QAXPressAction kAXPressAction #define QAXPreviousContentsAttribute kAXPreviousContentsAttribute -#define QAXPreviousContentsAttribute kAXPreviousContentsAttribute -#define QAXPreviousContentsAttribute kAXPreviousContentsAttribute #define QAXProgressIndicatorRole kAXProgressIndicatorRole #define QAXRadioButtonRole kAXRadioButtonRole #define QAXRoleAttribute kAXRoleAttribute -#define QAXRoleAttribute kAXRoleAttribute #define QAXRoleDescriptionAttribute kAXRoleDescriptionAttribute #define QAXRowRole kAXRowRole #define QAXRowsAttribute kAXRowsAttribute -#define QAXRowsAttribute kAXRowsAttribute -#define QAXScrollAreaRole kAXScrollAreaRole -#define QAXScrollAreaRole kAXScrollAreaRole #define QAXScrollAreaRole kAXScrollAreaRole #define QAXScrollBarRole kAXScrollBarRole #define QAXSelectedAttribute kAXSelectedAttribute #define QAXSelectedChildrenAttribute kAXSelectedChildrenAttribute #define QAXSelectedRowsAttribute kAXSelectedRowsAttribute -#define QAXSelectedRowsAttribute kAXSelectedRowsAttribute -#define QAXSizeAttribute kAXSizeAttribute #define QAXSizeAttribute kAXSizeAttribute #define QAXSliderRole kAXSliderRole #define QAXSplitGroupRole kAXSplitGroupRole #define QAXSplitterRole kAXSplitterRole -#define QAXSplitterRole kAXSplitterRole -#define QAXSplitterRole kAXSplitterRole -#define QAXSplittersAttribute kAXSplittersAttribute #define QAXSplittersAttribute kAXSplittersAttribute #define QAXStaticTextRole kAXStaticTextRole -#define QAXStaticTextRole kAXStaticTextRole -#define QAXSubroleAttribute kAXSubroleAttribute #define QAXSubroleAttribute kAXSubroleAttribute -#define QAXSubroleAttribute kAXSubroleAttribute -#define QAXTabGroupRole kAXTabGroupRole #define QAXTabGroupRole kAXTabGroupRole #define QAXTableRole kAXTableRole #define QAXTabsAttribute kAXTabsAttribute -#define QAXTabsAttribute kAXTabsAttribute -#define QAXTextFieldRole kAXTextFieldRole #define QAXTextFieldRole kAXTextFieldRole #define QAXTitleAttribute kAXTitleAttribute -#define QAXTitleAttribute kAXTitleAttribute -#define QAXTitleAttribute kAXTitleAttribute -#define QAXTitleAttribute kAXTitleAttribute #define QAXTitleUIElementAttribute kAXTitleUIElementAttribute -#define QAXTitleUIElementAttribute kAXTitleUIElementAttribute -#define QAXToolbarButtonAttribute kAXToolbarButtonAttribute #define QAXToolbarButtonAttribute kAXToolbarButtonAttribute #define QAXToolbarRole kAXToolbarRole #define QAXTopLevelUIElementAttribute kAXTopLevelUIElementAttribute -#define QAXTopLevelUIElementAttribute kAXTopLevelUIElementAttribute -#define QAXTopLevelUIElementAttribute kAXTopLevelUIElementAttribute #define QAXUnknownRole kAXUnknownRole -#define QAXUnknownRole kAXUnknownRole -#define QAXValueAttribute kAXValueAttribute -#define QAXValueAttribute kAXValueAttribute -#define QAXValueAttribute kAXValueAttribute #define QAXValueAttribute kAXValueAttribute #define QAXValueChangedNotification kAXValueChangedNotification #define QAXValueIndicatorRole kAXValueIndicatorRole #define QAXVerticalOrientationValue kAXVerticalOrientationValue #define QAXVerticalScrollBarAttribute kAXVerticalScrollBarAttribute -#define QAXVerticalScrollBarAttribute kAXVerticalScrollBarAttribute -#define QAXVisibleRowsAttribute kAXVisibleRowsAttribute #define QAXVisibleRowsAttribute kAXVisibleRowsAttribute #define QAXWindowAttribute kAXWindowAttribute -#define QAXWindowAttribute kAXWindowAttribute -#define QAXWindowAttribute kAXWindowAttribute #define QAXWindowCreatedNotification kAXWindowCreatedNotification #define QAXWindowMovedNotification kAXWindowMovedNotification #define QAXWindowRole kAXWindowRole #define QAXZoomButtonAttribute kAXZoomButtonAttribute -#define QAXZoomButtonAttribute kAXZoomButtonAttribute #endif diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp index 4b2b2ab..753ac57 100644 --- a/src/gui/accessible/qaccessiblewidget.cpp +++ b/src/gui/accessible/qaccessiblewidget.cpp @@ -131,9 +131,16 @@ QString Q_GUI_EXPORT qt_accHotKey(const QString &text) int fa = 0; QChar ac; while ((fa = text.indexOf(QLatin1Char('&'), fa)) != -1) { - if (fa == text.length() - 1 || text.at(fa+1) != QLatin1Char('&')) { - ac = text.at(fa+1); - break; + ++fa; + if (fa < text.length()) { + // ignore "&&" + if (text.at(fa) == QLatin1Char('&')) { + ++fa; + continue; + } else { + ac = text.at(fa); + break; + } } } if (ac.isNull()) diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index b744dca..3aa04f6 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -1523,10 +1523,10 @@ static const Qt::WindowFlags DefaultWindowFlags = If you require a modeless dialog, use the QColorDialog constructor. \endomit - The static getColor() function shows the dialog, and allows the - user to specify a color. The getRgba() function does the same, but - also allows the user to specify a color with an alpha channel - (transparency) value. + The static getColor() function shows the dialog, and allows the user to + specify a color. This function can also be used to let users choose a + color with a level of transparency: pass the ShowAlphaChannel option as + an additional argument. The user can store customCount() different custom colors. The custom colors are shared by all color dialogs, and remembered diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 9a03f2d..f70669c 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -780,6 +780,13 @@ void QFileDialog::selectFile(const QString &filename) if (QFileInfo(filename).isAbsolute()) { QString current = d->rootPath(); text.remove(current); + if (text.at(0) == QDir::separator() +#ifdef Q_OS_WIN + //On Windows both cases can happen + || text.at(0) == QLatin1Char('/') +#endif + ) + text = text.remove(0,1); } if (!isVisible() || !d->lineEdit()->hasFocus()) d->lineEdit()->setText(text); @@ -950,25 +957,29 @@ void QFileDialog::setNameFilters(const QStringList &filters) { Q_D(QFileDialog); d->defaultFileTypes = (filters == QStringList(QFileDialog::tr("All Files (*)"))); - d->nameFilters = filters; + QStringList cleanedFilters; + for (int i = 0; i < filters.count(); ++i) { + cleanedFilters << filters[i].simplified(); + } + d->nameFilters = cleanedFilters; if (d->nativeDialogInUse){ - d->setNameFilters_sys(filters); + d->setNameFilters_sys(cleanedFilters); return; } d->qFileDialogUi->fileTypeCombo->clear(); - if (filters.isEmpty()) + if (cleanedFilters.isEmpty()) return; if (testOption(HideNameFilterDetails)) { QStringList strippedFilters; - for (int i = 0; i < filters.count(); ++i) { - strippedFilters.append(filters[i].mid(0, filters[i].indexOf(QLatin1String(" (")))); + for (int i = 0; i < cleanedFilters.count(); ++i) { + strippedFilters.append(cleanedFilters[i].mid(0, cleanedFilters[i].indexOf(QLatin1String(" (")))); } d->qFileDialogUi->fileTypeCombo->addItems(strippedFilters); } else { - d->qFileDialogUi->fileTypeCombo->addItems(filters); + d->qFileDialogUi->fileTypeCombo->addItems(cleanedFilters); } d->_q_useNameFilter(0); } @@ -1582,7 +1593,12 @@ QString QFileDialog::getOpenFileName(QWidget *parent, args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - args.selection = QFileDialogPrivate::initialSelection(dir); + //If workingDirectory returned a different path than the initial one, + //it means that the initial path was invalid. There is no point to try select a file + if (args.directory != QFileInfo(dir).path()) + args.selection = QString(); + else + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = ExistingFile; args.options = options; @@ -1667,7 +1683,12 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - args.selection = QFileDialogPrivate::initialSelection(dir); + //If workingDirectory returned a different path than the initial one, + //it means that the initial path was invalid. There is no point to try select a file + if (args.directory != QFileInfo(dir).path()) + args.selection = QString(); + else + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = ExistingFiles; args.options = options; @@ -1753,7 +1774,12 @@ QString QFileDialog::getSaveFileName(QWidget *parent, args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - args.selection = QFileDialogPrivate::initialSelection(dir); + //If workingDirectory returned a different path than the initial one, + //it means that the initial path was invalid. There is no point to try select a file + if (args.directory != QFileInfo(dir).path()) + args.selection = QString(); + else + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = AnyFile; args.options = options; @@ -2117,6 +2143,7 @@ void QFileDialogPrivate::createWidgets() #ifndef QT_NO_COMPLETER completer = new QFSCompletor(model, q); qFileDialogUi->fileNameEdit->setCompleter(completer); + completer->sourceModel = model; QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_autoCompleteFileName(QString))); #endif // QT_NO_COMPLETER @@ -2239,12 +2266,21 @@ void QFileDialog::setProxyModel(QAbstractProxyModel *proxyModel) proxyModel->setSourceModel(d->model); d->qFileDialogUi->listView->setModel(d->proxyModel); d->qFileDialogUi->treeView->setModel(d->proxyModel); +#ifndef QT_NO_COMPLETER + d->completer->setModel(d->proxyModel); + d->completer->proxyModel = d->proxyModel; +#endif connect(d->proxyModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(_q_rowsInserted(const QModelIndex &))); } else { d->proxyModel = 0; d->qFileDialogUi->listView->setModel(d->model); d->qFileDialogUi->treeView->setModel(d->model); +#ifndef QT_NO_COMPLETER + d->completer->setModel(d->model); + d->completer->sourceModel = d->model; + d->completer->proxyModel = 0; +#endif connect(d->model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(_q_rowsInserted(const QModelIndex &))); } @@ -2757,8 +2793,9 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index) { Q_Q(QFileDialog); // My Computer or a directory - QString path = index.data(QFileSystemModel::FilePathRole).toString(); - if (path.isEmpty() || model->isDir(index)) { + QModelIndex sourceIndex = mapToSource(index); + QString path = sourceIndex.data(QFileSystemModel::FilePathRole).toString(); + if (path.isEmpty() || model->isDir(sourceIndex)) { q->setDirectory(path); emit q->directoryEntered(path); if (fileMode == QFileDialog::Directory @@ -3132,7 +3169,11 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e) QString QFSCompletor::pathFromIndex(const QModelIndex &index) const { - const QFileSystemModel *dirModel = static_cast<const QFileSystemModel *>(model()); + const QFileSystemModel *dirModel; + if (proxyModel) + dirModel = qobject_cast<const QFileSystemModel *>(proxyModel->sourceModel()); + else + dirModel = sourceModel; QString currentLocation = dirModel->rootPath(); QString path = index.data(QFileSystemModel::FilePathRole).toString(); if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { @@ -3178,7 +3219,11 @@ QStringList QFSCompletor::splitPath(const QString &path) const bool startsFromRoot = path[0] == sep[0]; #endif if (parts.count() == 1 || (parts.count() > 1 && !startsFromRoot)) { - const QFileSystemModel *dirModel = static_cast<const QFileSystemModel *>(model()); + const QFileSystemModel *dirModel; + if (proxyModel) + dirModel = qobject_cast<const QFileSystemModel *>(proxyModel->sourceModel()); + else + dirModel = sourceModel; QString currentLocation = QDir::toNativeSeparators(dirModel->rootPath()); if (currentLocation.contains(sep) && path != currentLocation) { QStringList currentLocationList = splitPath(currentLocation); diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 4c13d01..90af9fc 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -278,7 +278,7 @@ QT_USE_NAMESPACE { Q_UNUSED(sender); QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename); - QFileInfo info(qtFileName); + QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C))); QString path = info.absolutePath(); if (path != *mLastFilterCheckPath){ *mLastFilterCheckPath = path; diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 8cb2cb0..dc24390 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -91,6 +91,26 @@ class QCompleter; class QHBoxLayout; class Ui_QFileDialog; +#ifndef QT_NO_COMPLETER +/*! + QCompleter that can deal with QFileSystemModel + */ +class QFSCompletor : public QCompleter { +public: + QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(0) + { +#ifdef Q_OS_WIN + setCaseSensitivity(Qt::CaseInsensitive); +#endif + } + QString pathFromIndex(const QModelIndex &index) const; + QStringList splitPath(const QString& path) const; + + QAbstractProxyModel *proxyModel; + QFileSystemModel *sourceModel; +}; +#endif // QT_NO_COMPLETER + struct QFileDialogArgs { QFileDialogArgs() : parent(0), mode(QFileDialog::AnyFile) {} @@ -255,7 +275,7 @@ public: // data QStringList watching; QFileSystemModel *model; - QCompleter *completer; + QFSCompletor *completer; QFileDialog::FileMode fileMode; QFileDialog::AcceptMode acceptMode; @@ -434,23 +454,6 @@ inline QString QFileDialogPrivate::rootPath() const { inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return QString(); } #endif -#ifndef QT_NO_COMPLETER -/*! - QCompleter that can deal with QFileSystemModel - */ -class QFSCompletor : public QCompleter { -public: - QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent) - { -#ifdef Q_OS_WIN - setCaseSensitivity(Qt::CaseInsensitive); -#endif - } - QString pathFromIndex(const QModelIndex &index) const; - QStringList splitPath(const QString& path) const; -}; -#endif // QT_NO_COMPLETER - QT_END_NAMESPACE #endif // QT_NO_FILEDIALOG diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 3fe64ff..23a2cbc 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -168,6 +168,20 @@ void QFileInfoGatherer::clear() } /* + Remove a \a path from the watcher + + \sa listed() +*/ +void QFileInfoGatherer::removePath(const QString &path) +{ +#ifndef QT_NO_FILESYSTEMWATCHER + mutex.lock(); + watcher->removePath(path); + mutex.unlock(); +#endif +} + +/* List all files in \a directoryPath \sa listed() @@ -286,15 +300,9 @@ QString QFileInfoGatherer::translateDriveName(const QFileInfo &drive) const void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &files) { #ifndef QT_NO_FILESYSTEMWATCHER - //### We test here if the path still exist before adding it in the watcher - //### because sometime the file is deleted just before enter here so QStringList files is not up to date - //### It is not a proper fix, perhaps in 4.6 we should have a better way to avoid that - //### to ensure the gatherer have fresh information - QFileInfo info(path); if (files.isEmpty() && !watcher->directories().contains(path) && !path.isEmpty() - && info.exists() && !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) { watcher->addPath(path); } diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h index eac0d46..60b9d5f 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -161,6 +161,7 @@ public: ~QFileInfoGatherer(); void clear(); + void removePath(const QString &path); QExtendedInformation getInfo(const QFileInfo &info) const; public Q_SLOTS: diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 5f375b5..012d3a1 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -166,6 +166,8 @@ bool QFileSystemModel::remove(const QModelIndex &aindex) const { //### TODO optim QString path = filePath(aindex); + QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func()); + d->fileInfoGatherer.removePath(path); QDirIterator it(path, QDir::AllDirs | QDir:: Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); @@ -375,7 +377,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS if (!info.exists()) return rootNode; QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this); - p->addNode(rootNode, host); + p->addNode(rootNode, host,info); p->addVisibleFiles(rootNode, QStringList(host)); } r = rootNode->visibleLocation(host); @@ -395,6 +397,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS #endif QFileSystemModelPrivate::QFileSystemNode *parent = node(index); + for (int i = 0; i < pathElements.count(); ++i) { QString element = pathElements.at(i); #ifdef Q_OS_WIN @@ -423,7 +426,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS if (!info.exists()) return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root); QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this); - node = p->addNode(parent, element); + node = p->addNode(parent, element,info); #ifndef QT_NO_FILESYSTEMWATCHER node->populate(fileInfoGatherer.getInfo(info)); #endif @@ -843,7 +846,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent; int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName); - d->addNode(parentNode, newName); + d->addNode(parentNode, newName,indexNode->info->fileInfo()); parentNode->visibleChildren.removeAt(visibleLocation); QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName); parentNode->children[newName] = oldValue; @@ -1076,11 +1079,10 @@ private: /* \internal - Sort all of the children of parent (including their children) + Sort all of the children of parent */ -void QFileSystemModelPrivate::sortChildren(int column, Qt::SortOrder order, const QModelIndex &parent) +void QFileSystemModelPrivate::sortChildren(int column, const QModelIndex &parent) { - Q_Q(QFileSystemModel); QFileSystemModelPrivate::QFileSystemNode *indexNode = node(parent); if (indexNode->children.count() == 0) return; @@ -1104,9 +1106,6 @@ void QFileSystemModelPrivate::sortChildren(int column, Qt::SortOrder order, cons indexNode->visibleChildren.append(values.at(i).first->fileName); values.at(i).first->isVisible = true; } - - for (int i = 0; i < q->rowCount(parent); ++i) - sortChildren(column, order, q->index(i, 0, parent)); } /*! @@ -1128,7 +1127,7 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order) if (!(d->sortColumn == column && d->sortOrder != order && !d->forceSort)) { //we sort only from where we are, don't need to sort all the model - d->sortChildren(column, order, index(rootPath())); + d->sortChildren(column, index(rootPath())); d->sortColumn = column; d->forceSort = false; } @@ -1286,7 +1285,7 @@ QModelIndex QFileSystemModel::mkdir(const QModelIndex &parent, const QString &na if (!dir.mkdir(name)) return QModelIndex(); QFileSystemModelPrivate::QFileSystemNode *parentNode = d->node(parent); - d->addNode(parentNode, name); + d->addNode(parentNode, name, QFileInfo()); Q_ASSERT(parentNode->children.contains(name)); QFileSystemModelPrivate::QFileSystemNode *node = parentNode->children[name]; node->populate(d->fileInfoGatherer.getInfo(QFileInfo(dir.absolutePath() + QDir::separator() + name))); @@ -1431,7 +1430,10 @@ void QFileSystemModel::setFilter(QDir::Filters filters) } /*! - Returns the filter specification for the directory model. + Returns the filter specified for the directory model. + + If a filter has not been set, the default filter is QDir::AllEntries | + QDir::NoDotAndDotDot | QDir::AllDirs. \sa QDir::Filters */ @@ -1605,10 +1607,13 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons *WARNING* this will change the count of children */ -QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFileSystemNode *parentNode, const QString &fileName) +QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFileSystemNode *parentNode, const QString &fileName, const QFileInfo& info) { // In the common case, itemLocation == count() so check there first QFileSystemModelPrivate::QFileSystemNode *node = new QFileSystemModelPrivate::QFileSystemNode(fileName, parentNode); +#ifndef QT_NO_FILESYSTEMWATCHER + node->populate(info); +#endif parentNode->children.insert(fileName, node); return node; } @@ -1726,7 +1731,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QL QExtendedInformation info = fileInfoGatherer.getInfo(updates.at(i).second); bool previouslyHere = parentNode->children.contains(fileName); if (!previouslyHere) { - addNode(parentNode, fileName); + addNode(parentNode, fileName, info.fileInfo()); } QFileSystemModelPrivate::QFileSystemNode * node = parentNode->children.value(fileName); bool isCaseSensitive = parentNode->caseSensitive(); diff --git a/src/gui/dialogs/qfilesystemmodel_p.h b/src/gui/dialogs/qfilesystemmodel_p.h index 95fbe20..77c35a2 100644 --- a/src/gui/dialogs/qfilesystemmodel_p.h +++ b/src/gui/dialogs/qfilesystemmodel_p.h @@ -182,7 +182,7 @@ public: QList<QString> visibleChildren; QFileSystemNode *parent; - private: + QExtendedInformation *info; }; @@ -216,10 +216,10 @@ public: bool filtersAcceptsNode(const QFileSystemNode *node) const; bool passNameFilters(const QFileSystemNode *node) const; void removeNode(QFileSystemNode *parentNode, const QString &name); - QFileSystemNode* addNode(QFileSystemNode *parentNode, const QString &fileName); + QFileSystemNode* addNode(QFileSystemNode *parentNode, const QString &fileName, const QFileInfo &info); void addVisibleFiles(QFileSystemNode *parentNode, const QStringList &newFiles); void removeVisibleFile(QFileSystemNode *parentNode, int visibleLocation); - void sortChildren(int column, Qt::SortOrder order, const QModelIndex &parent); + void sortChildren(int column, const QModelIndex &parent); inline int translateVisibleLocation(QFileSystemNode *parent, int row) const { return (sortOrder == Qt::AscendingOrder) ? row : parent->visibleChildren.count() - row - 1; diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index b63c8ee..78d99e3 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -424,26 +424,27 @@ void QInputDialogPrivate::_q_currentRowChanged(const QModelIndex &newIndex, /*! \class QInputDialog - \brief The QInputDialog class provides a simple convenience dialog to get a single value from the user. + \brief The QInputDialog class provides a simple convenience dialog to get a + single value from the user. \ingroup dialogs \mainclass - The input value can be a string, a number or an item from a list. A - label must be set to tell the user what they should enter. + The input value can be a string, a number or an item from a list. A label + must be set to tell the user what they should enter. - Four static convenience functions are provided: - getText(), getInt(), getDouble(), and getItem(). All the - functions can be used in a similar way, for example: + Four static convenience functions are provided: getText(), getInt(), + getDouble(), and getItem(). All the functions can be used in a similar way, + for example: \snippet examples/dialogs/standarddialogs/dialog.cpp 3 - The \c ok variable is set to true if the user clicks \gui OK; - otherwise it is set to false. + The \c ok variable is set to true if the user clicks \gui OK; otherwise it + is set to false. \img inputdialogs.png Input Dialogs - The \l{dialogs/standarddialogs}{Standard Dialogs} example shows - how to use QInputDialog as well as other built-in Qt dialogs. + The \l{dialogs/standarddialogs}{Standard Dialogs} example shows how to use + QInputDialog as well as other built-in Qt dialogs. \sa QMessageBox, {Standard Dialogs Example} */ @@ -452,11 +453,13 @@ void QInputDialogPrivate::_q_currentRowChanged(const QModelIndex &newIndex, \enum QInputDialog::InputMode \since 4.5 - This enum describes the different modes of input that can be selected for the dialog. + This enum describes the different modes of input that can be selected for + the dialog. \value TextInput Used to input text strings. \value IntInput Used to input integers. - \value DoubleInput Used to input floating point numbers with double precision accuracy. + \value DoubleInput Used to input floating point numbers with double + precision accuracy. \sa inputMode */ @@ -487,7 +490,8 @@ QInputDialog::~QInputDialog() \brief the mode used for input - This property help determines which widget is used for entering input into the dialog. + This property help determines which widget is used for entering input into + the dialog. */ void QInputDialog::setInputMode(InputMode mode) { @@ -1104,15 +1108,18 @@ void QInputDialog::done(int result) } /*! - Static convenience function to get a string from the user. \a - title is the text which is displayed in the title bar of the - dialog. \a label is the text which is shown to the user (it should - say what should be entered). \a text is the default text which is - placed in the line edit. The \a mode is the echo mode the line - edit will use. If \a ok is nonnull \e *\a ok will be set to true - if the user pressed \gui OK and to false if the user pressed - \gui Cancel. The dialog's parent is \a parent. The dialog will be - modal and uses the specified widget \a flags. + Static convenience function to get a string from the user. + + \a title is the text which is displayed in the title bar of the dialog. + \a label is the text which is shown to the user (it should say what should + be entered). + \a text is the default text which is placed in the line edit. + \a mode is the echo mode the line edit will use. + + If \a ok is nonnull \e *\a ok will be set to true if the user pressed + \gui OK and to false if the user pressed \gui Cancel. The dialog's parent + is \a parent. The dialog will be modal and uses the specified widget + \a flags. This function returns the text which has been entered in the line edit. It will not return an empty string. @@ -1121,11 +1128,11 @@ void QInputDialog::done(int result) \snippet examples/dialogs/standarddialogs/dialog.cpp 3 - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QInputDialog constructors. + \warning Do not delete \a parent during the execution of the dialog. If you + want to do this, you should create the dialog yourself using one of the + QInputDialog constructors. - \sa getInteger(), getDouble(), getItem() + \sa getInt(), getDouble(), getItem() */ QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label, @@ -1149,30 +1156,32 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri } /*! - Static convenience function to get an integer input from the - user. \a title is the text which is displayed in the title bar - of the dialog. \a label is the text which is shown to the user - (it should say what should be entered). \a value is the default - integer which the spinbox will be set to. \a min and \a - max are the minimum and maximum values the user may choose, - and \a step is the amount by which the values change as the user - presses the arrow buttons to increment or decrement the value. - - If \a ok is nonnull *\a ok will be set to true if the user - pressed \gui OK and to false if the user pressed \gui Cancel. The - dialog's parent is \a parent. The dialog will be modal and uses - the widget \a flags. - - On success, this function returns the integer which has been - entered by the user; on failure, it returns the initial \a value. + \since 4.5 + + Static convenience function to get an integer input from the user. + + \a title is the text which is displayed in the title bar of the dialog. + \a label is the text which is shown to the user (it should say what should + be entered). + \a value is the default integer which the spinbox will be set to. + \a min and \a max are the minimum and maximum values the user may choose. + \a step is the amount by which the values change as the user presses the + arrow buttons to increment or decrement the value. + + If \a ok is nonnull *\a ok will be set to true if the user pressed \gui OK + and to false if the user pressed \gui Cancel. The dialog's parent is + \a parent. The dialog will be modal and uses the widget \a flags. + + On success, this function returns the integer which has been entered by the + user; on failure, it returns the initial \a value. Use this static function like this: \snippet examples/dialogs/standarddialogs/dialog.cpp 0 - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QInputDialog constructors. + \warning Do not delete \a parent during the execution of the dialog. If you + want to do this, you should create the dialog yourself using one of the + QInputDialog constructors. \sa getText(), getDouble(), getItem() */ @@ -1198,32 +1207,32 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l } /*! - Static convenience function to get a floating point number from - the user. \a title is the text which is displayed in the title - bar of the dialog. \a label is the text which is shown to the user - (it should say what should be entered). \a value is the default - floating point number that the line edit will be set to. \a - min and \a max are the minimum and maximum values the - user may choose, and \a decimals is the maximum number of decimal - places the number may have. - - If \a ok is nonnull, *\a ok will be set to true if the user - pressed \gui OK and to false if the user pressed \gui Cancel. The - dialog's parent is \a parent. The dialog will be modal and uses - the widget \a flags. - - This function returns the floating point number which has been - entered by the user. + Static convenience function to get a floating point number from the user. + + \a title is the text which is displayed in the title bar of the dialog. + \a label is the text which is shown to the user (it should say what should + be entered). + \a value is the default floating point number that the line edit will be + set to. + \a min and \a max are the minimum and maximum values the user may choose. + \a decimals is the maximum number of decimal places the number may have. + + If \a ok is nonnull, *\a ok will be set to true if the user pressed \gui OK + and to false if the user pressed \gui Cancel. The dialog's parent is + \a parent. The dialog will be modal and uses the widget \a flags. + + This function returns the floating point number which has been entered by + the user. Use this static function like this: \snippet examples/dialogs/standarddialogs/dialog.cpp 1 - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QInputDialog constructors. + \warning Do not delete \a parent during the execution of the dialog. If you + want to do this, you should create the dialog yourself using one of the + QInputDialog constructors. - \sa getText(), getInteger(), getItem() + \sa getText(), getInt(), getItem() */ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QString &label, @@ -1248,32 +1257,34 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr } /*! - Static convenience function to let the user select an item from a - string list. \a title is the text which is displayed in the title - bar of the dialog. \a label is the text which is shown to the user (it - should say what should be entered). \a items is the - string list which is inserted into the combobox, and \a current is the number - of the item which should be the current item. If \a editable is true - the user can enter their own text; if \a editable is false the user - may only select one of the existing items. - - If \a ok is nonnull \e *\a ok will be set to true if the user - pressed \gui OK and to false if the user pressed \gui Cancel. The - dialog's parent is \a parent. The dialog will be modal and uses - the widget \a flags. - - This function returns the text of the current item, or if \a - editable is true, the current text of the combobox. + Static convenience function to let the user select an item from a string + list. + + \a title is the text which is displayed in the title bar of the dialog. + \a label is the text which is shown to the user (it should say what should + be entered). + \a items is the string list which is inserted into the combobox. + \a current is the number of the item which should be the current item. + + If \a editable is true the user can enter their own text; otherwise the + user may only select one of the existing items. + + If \a ok is nonnull \e *\a ok will be set to true if the user pressed + \gui OK and to false if the user pressed \gui Cancel. The dialog's parent + is \a parent. The dialog will be modal and uses the widget \a flags. + + This function returns the text of the current item, or if \a editable is + true, the current text of the combobox. Use this static function like this: \snippet examples/dialogs/standarddialogs/dialog.cpp 2 - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QInputDialog constructors. + \warning Do not delete \a parent during the execution of the dialog. If you + want to do this, you should create the dialog yourself using one of the + QInputDialog constructors. - \sa getText(), getInteger(), getDouble() + \sa getText(), getInt(), getDouble() */ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label, diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index f343405..1967837 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -532,11 +532,11 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button) \section2 Severity Levels and the Icon and Pixmap Properties - QMessageBox supports four predefined message severity levels, or - message types, which really only differ in the predefined icon - they each show. Specify one of the four predefined message types - by setting the \l{QMessageBox::icon} {icon} property to one of the - \l{QMessageBox::Icon} {predefined Icons}. The following rules are + QMessageBox supports four predefined message severity levels, or message + types, which really only differ in the predefined icon they each show. + Specify one of the four predefined message types by setting the + \l{QMessageBox::icon}{icon} property to one of the + \l{QMessageBox::Icon}{predefined icons}. The following rules are guidelines: \table @@ -558,17 +558,17 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button) \o For reporting critical errors. \endtable - The default value is \l{QMessageBox::NoIcon} {No Icon}. The - message boxes are otherwise the same for all cases. When using a - standard icon, use the one recommended in the table, or use the - one recommended by the style guidelines for your platform. If none - of the standard icons is right for your message box, you can use a - custom icon by setting the \l{QMessageBox::iconPixmap} {icon - pixmap} property instead of setting the \l{QMessageBox::icon} - {icon} property. - - In summary, to set an icon, use \e{either} setIcon() for one of - the standard icons, \e{or} setIconPixmap() for a custom icon. + \l{QMessageBox::Icon}{Predefined icons} are not defined by QMessageBox, but + provided by the style. The default value is \l{QMessageBox::NoIcon} + {No Icon}. The message boxes are otherwise the same for all cases. When + using a standard icon, use the one recommended in the table, or use the + one recommended by the style guidelines for your platform. If none of the + standard icons is right for your message box, you can use a custom icon by + setting the \l{QMessageBox::iconPixmap}{icon pixmap} property instead of + setting the \l{QMessageBox::icon}{icon} property. + + In summary, to set an icon, use \e{either} setIcon() for one of the + standard icons, \e{or} setIconPixmap() for a custom icon. \section1 The Static Functions API diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index fcd8ccf..32395c4 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -516,6 +516,7 @@ public: , vistaInitPending(false) , vistaState(QVistaHelper::Dirty) , vistaStateChanged(false) + , inHandleAeroStyleChange(false) #endif , minimumWidth(0) , minimumHeight(0) @@ -617,6 +618,7 @@ public: bool vistaInitPending; QVistaHelper::VistaState vistaState; bool vistaStateChanged; + bool inHandleAeroStyleChange; #endif int minimumWidth; int minimumHeight; @@ -1459,6 +1461,10 @@ void QWizardPrivate::handleAeroStyleChange() { Q_Q(QWizard); + if (inHandleAeroStyleChange) + return; // prevent recursion + inHandleAeroStyleChange = true; + vistaHelper->backButton()->disconnect(); q->removeEventFilter(vistaHelper); @@ -1493,6 +1499,8 @@ void QWizardPrivate::handleAeroStyleChange() if (q->isVisible()) vistaHelper->setWindowPosHack(); + + inHandleAeroStyleChange = false; } #endif diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp index 6f32879..6741f2c 100644 --- a/src/gui/embedded/qscreen_qws.cpp +++ b/src/gui/embedded/qscreen_qws.cpp @@ -2038,7 +2038,8 @@ QScreen::~QScreen() void QScreen::shutdownDevice() { #ifndef QT_NO_QWS_CURSOR - qt_screencursor->hide(); + if (qt_screencursor) + qt_screencursor->hide(); #endif } diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp index fed7aad..48fe881 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.cpp +++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp @@ -342,8 +342,18 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) } dw=w; dh=h; - xoff += (vinfo.xres - w)/2; - yoff += (vinfo.yres - h)/2; + int xxoff, yyoff; + if (sscanf(qwssize, "%*dx%*d+%d+%d", &xxoff, &yyoff) == 2) { + if (xxoff < 0 || xxoff + w > vinfo.xres) + xxoff = vinfo.xres - w; + if (yyoff < 0 || yyoff + h > vinfo.yres) + yyoff = vinfo.yres - h; + xoff += xxoff; + yoff += yyoff; + } else { + xoff += (vinfo.xres - w)/2; + yoff += (vinfo.yres - h)/2; + } } else { dw=w=vinfo.xres; dh=h=vinfo.yres; diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index d95b194..95b2589 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -528,25 +528,22 @@ QT_BEGIN_NAMESPACE // QRectF::intersects() returns false always if either the source or target // rectangle's width or height are 0. This works around that problem. -static QRectF _q_adjustedRect(const QRectF &rect) -{ - static const qreal p = (qreal)0.00001; - QRectF r = rect; - if (!r.width()) - r.adjust(-p, 0, p, 0); - if (!r.height()) - r.adjust(0, -p, 0, p); - return r; +static inline void _q_adjustRect(QRectF *rect) +{ + Q_ASSERT(rect); + if (!rect->width()) + rect->adjust(-0.00001, 0, 0.00001, 0); + if (!rect->height()) + rect->adjust(0, -0.00001, 0, 0.00001); } -static QRect _q_adjustedRect(const QRect &rect) +static inline void _q_adjustRect(QRect *rect) { - QRect r = rect; - if (!r.width()) - r.adjust(0, 0, 1, 0); - if (!r.height()) - r.adjust(0, 0, 0, 1); - return r; + Q_ASSERT(rect); + if (!rect->width()) + rect->adjust(0, 0, 1, 0); + if (!rect->height()) + rect->adjust(0, 0, 0, 1); } /* @@ -631,6 +628,7 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch case QGraphicsItem::ItemClipsChildrenToShape: flag = AncestorClipsChildren; enabled = flags & QGraphicsItem::ItemClipsChildrenToShape; + invalidateCachedClipPathRecursively(/*childrenOnly=*/true); break; case QGraphicsItem::ItemIgnoresTransformations: flag = AncestorIgnoresTransformations; @@ -1028,9 +1026,8 @@ void QGraphicsItem::setParentItem(QGraphicsItem *parent) } if (parent == d_ptr->parent) return; - QVariant variant; - qVariantSetValue<QGraphicsItem *>(variant, parent); - parent = qVariantValue<QGraphicsItem *>(itemChange(ItemParentChange, variant)); + const QVariant newParentVariant(itemChange(ItemParentChange, qVariantFromValue<QGraphicsItem *>(parent))); + parent = qVariantValue<QGraphicsItem *>(newParentVariant); if (parent == d_ptr->parent) return; @@ -1045,11 +1042,11 @@ void QGraphicsItem::setParentItem(QGraphicsItem *parent) // We anticipate geometry changes prepareGeometryChange(); + const QVariant thisPointerVariant(qVariantFromValue<QGraphicsItem *>(this)); if (d_ptr->parent) { // Remove from current parent qt_graphicsitem_removeChild(this, &d_ptr->parent->d_func()->children); - qVariantSetValue<QGraphicsItem *>(variant, this); - d_ptr->parent->itemChange(ItemChildRemovedChange, variant); + d_ptr->parent->itemChange(ItemChildRemovedChange, thisPointerVariant); } if ((d_ptr->parent = parent)) { @@ -1064,10 +1061,9 @@ void QGraphicsItem::setParentItem(QGraphicsItem *parent) } d_ptr->parent->d_func()->children << this; - qVariantSetValue<QGraphicsItem *>(variant, this); - d_ptr->parent->itemChange(ItemChildAddedChange, variant); + d_ptr->parent->itemChange(ItemChildAddedChange, thisPointerVariant); if (!implicitUpdate) - d_ptr->updateHelper(); + d_ptr->updateHelper(QRectF(), false, true); // Inherit ancestor flags from the new parent. d_ptr->updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1)); @@ -1096,7 +1092,7 @@ void QGraphicsItem::setParentItem(QGraphicsItem *parent) if (!d_ptr->enabled && !d_ptr->explicitlyDisabled) d_ptr->setEnabledHelper(true, /* explicit = */ false); - d_ptr->updateHelper(); + d_ptr->updateHelper(QRectF(), false, true); } if (d_ptr->scene) { @@ -1106,10 +1102,7 @@ void QGraphicsItem::setParentItem(QGraphicsItem *parent) } // Resolve opacity. - if (QGraphicsItem *p = d_ptr->parent) - d_ptr->resolveEffectiveOpacity(p->effectiveOpacity()); - else - d_ptr->resolveEffectiveOpacity(1.0); + d_ptr->updateEffectiveOpacity(); // Resolve depth. d_ptr->resolveDepth(parent ? parent->d_ptr->depth : -1); @@ -1118,7 +1111,7 @@ void QGraphicsItem::setParentItem(QGraphicsItem *parent) d_ptr->invalidateSceneTransformCache(); // Deliver post-change notification - itemChange(QGraphicsItem::ItemParentHasChanged, qVariantFromValue<QGraphicsItem *>(parent)); + itemChange(QGraphicsItem::ItemParentHasChanged, newParentVariant); } /*! @@ -1240,7 +1233,7 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) int geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations); bool fullUpdate = (flags & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask); if (fullUpdate) - d_ptr->fullUpdateHelper(); + d_ptr->fullUpdateHelper(false, true); // Keep the old flags to compare the diff. GraphicsItemFlags oldFlags = this->flags(); @@ -1250,12 +1243,8 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) // Reresolve effective opacity if the opacity flags change. static const quint32 opacityFlagsMask = ItemIgnoresParentOpacity | ItemDoesntPropagateOpacityToChildren; - if ((flags & opacityFlagsMask) != (oldFlags & opacityFlagsMask)) { - if (QGraphicsItem *p = d_ptr->parent) - d_ptr->resolveEffectiveOpacity(p->effectiveOpacity()); - else - d_ptr->resolveEffectiveOpacity(1.0); - } + if ((flags & opacityFlagsMask) != (oldFlags & opacityFlagsMask)) + d_ptr->updateEffectiveOpacity(); if (!(d_ptr->flags & ItemIsFocusable) && hasFocus()) { // Clear focus on the item if it has focus when the focusable flag @@ -1275,6 +1264,9 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) d_ptr->updateAncestorFlag(ItemClipsChildrenToShape); } + if ((flags & ItemClipsToShape) != (oldFlags & ItemClipsToShape)) + d_ptr->invalidateCachedClipPath(); + if ((flags & ItemIgnoresTransformations) != (oldFlags & ItemIgnoresTransformations)) { // Item children clipping changes. Propagate the ancestor flag to // all children. @@ -1282,7 +1274,7 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) } // ### Why updateHelper? - d_ptr->updateHelper(); + d_ptr->updateHelper(QRectF(), false, true); // Notify change. itemChange(ItemFlagsHaveChanged, quint32(flags)); @@ -1380,9 +1372,9 @@ QString QGraphicsItem::toolTip() const */ void QGraphicsItem::setToolTip(const QString &toolTip) { - QString newCursor = itemChange(ItemToolTipChange, toolTip).toString(); - d_ptr->setExtra(QGraphicsItemPrivate::ExtraToolTip, toolTip); - itemChange(ItemToolTipHasChanged, toolTip); + const QVariant toolTipVariant(itemChange(ItemToolTipChange, toolTip)); + d_ptr->setExtra(QGraphicsItemPrivate::ExtraToolTip, toolTipVariant.toString()); + itemChange(ItemToolTipHasChanged, toolTipVariant); } #endif // QT_NO_TOOLTIP @@ -1424,9 +1416,8 @@ QCursor QGraphicsItem::cursor() const */ void QGraphicsItem::setCursor(const QCursor &cursor) { - QCursor newCursor = qVariantValue<QCursor>(itemChange(ItemCursorChange, - qVariantFromValue<QCursor>(cursor))); - d_ptr->setExtra(QGraphicsItemPrivate::ExtraCursor, newCursor); + const QVariant cursorVariant(itemChange(ItemCursorChange, qVariantFromValue<QCursor>(cursor))); + d_ptr->setExtra(QGraphicsItemPrivate::ExtraCursor, qVariantValue<QCursor>(cursorVariant)); d_ptr->hasCursor = 1; if (d_ptr->scene) { foreach (QGraphicsView *view, d_ptr->scene->views()) { @@ -1443,7 +1434,7 @@ void QGraphicsItem::setCursor(const QCursor &cursor) } } } - itemChange(ItemCursorHasChanged, qVariantFromValue<QCursor>(newCursor)); + itemChange(ItemCursorHasChanged, cursorVariant); } /*! @@ -1537,14 +1528,20 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo return; // Modify the property. - newVisible = q_ptr->itemChange(QGraphicsItem::ItemVisibleChange, quint32(newVisible)).toBool(); + const QVariant newVisibleVariant(q_ptr->itemChange(QGraphicsItem::ItemVisibleChange, + quint32(newVisible))); + newVisible = newVisibleVariant.toBool(); if (visible == quint32(newVisible)) return; visible = newVisible; // Schedule redrawing - if (update) + if (update) { + QGraphicsItemCache *c = (QGraphicsItemCache *)qVariantValue<void *>(extra(ExtraCacheData)); + if (c) + c->purge(); updateHelper(QRectF(), /* force = */ true); + } // Certain properties are dropped as an item becomes invisible. if (!newVisible) { @@ -1580,9 +1577,10 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo } // Update children with explicitly = false. + const bool updateChildren = update && !(flags & QGraphicsItem::ItemClipsChildrenToShape); foreach (QGraphicsItem *child, children) { if (!newVisible || !child->d_ptr->explicitlyHidden) - child->d_ptr->setVisibleHelper(newVisible, false); + child->d_ptr->setVisibleHelper(newVisible, false, updateChildren); } // Enable subfocus @@ -1594,7 +1592,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo } // Deliver post-change notification. - q_ptr->itemChange(QGraphicsItem::ItemVisibleHasChanged, quint32(visible)); + q_ptr->itemChange(QGraphicsItem::ItemVisibleHasChanged, newVisibleVariant); } /*! @@ -1700,7 +1698,9 @@ void QGraphicsItemPrivate::setEnabledHelper(bool newEnabled, bool explicitly, bo } // Modify the property. - enabled = q_ptr->itemChange(QGraphicsItem::ItemEnabledChange, quint32(newEnabled)).toBool(); + const QVariant newEnabledVariant(q_ptr->itemChange(QGraphicsItem::ItemEnabledChange, + quint32(newEnabled))); + enabled = newEnabledVariant.toBool(); // Schedule redraw. if (update) @@ -1712,7 +1712,7 @@ void QGraphicsItemPrivate::setEnabledHelper(bool newEnabled, bool explicitly, bo } // Deliver post-change notification. - q_ptr->itemChange(QGraphicsItem::ItemEnabledHasChanged, quint32(enabled)); + q_ptr->itemChange(QGraphicsItem::ItemEnabledHasChanged, newEnabledVariant); } /*! @@ -1799,7 +1799,8 @@ void QGraphicsItem::setSelected(bool selected) selected = false; if (d_ptr->selected == selected) return; - bool newSelected = itemChange(ItemSelectedChange, quint32(selected)).toBool(); + const QVariant newSelectedVariant(itemChange(ItemSelectedChange, quint32(selected))); + bool newSelected = newSelectedVariant.toBool(); if (d_ptr->selected == newSelected) return; d_ptr->selected = newSelected; @@ -1819,7 +1820,7 @@ void QGraphicsItem::setSelected(bool selected) } // Deliver post-change notification. - itemChange(QGraphicsItem::ItemSelectedHasChanged, quint32(d_ptr->selected)); + itemChange(QGraphicsItem::ItemSelectedHasChanged, newSelectedVariant); } /*! @@ -1863,6 +1864,9 @@ qreal QGraphicsItem::opacity() const */ qreal QGraphicsItem::effectiveOpacity() const { + if (!d_ptr->hasEffectiveOpacity) + return qreal(1.0); + QVariant effectiveOpacity = d_ptr->extra(QGraphicsItemPrivate::ExtraEffectiveOpacity); return effectiveOpacity.isNull() ? qreal(1.0) : qreal(effectiveOpacity.toDouble()); } @@ -1892,7 +1896,8 @@ qreal QGraphicsItem::effectiveOpacity() const void QGraphicsItem::setOpacity(qreal opacity) { // Notify change. - qreal newOpacity = itemChange(ItemOpacityChange, double(opacity)).toDouble(); + const QVariant newOpacityVariant(itemChange(ItemOpacityChange, double(opacity))); + qreal newOpacity = newOpacityVariant.toDouble(); // Normalize. newOpacity = qBound<qreal>(0.0, newOpacity, 1.0); @@ -2350,19 +2355,22 @@ QPointF QGraphicsItem::scenePos() const the item is also updated; otherwise it is not updated before and after the change. */ -void QGraphicsItemPrivate::setPosHelper(const QPointF &pos, bool update) +void QGraphicsItemPrivate::setPosHelper(const QPointF &pos) { Q_Q(QGraphicsItem); if (this->pos == pos) return; // Notify the item that the position is changing. - QPointF newPos = q->itemChange(QGraphicsItem::ItemPositionChange, pos).toPointF(); + const QVariant newPosVariant(q->itemChange(QGraphicsItem::ItemPositionChange, pos)); + QPointF newPos = newPosVariant.toPointF(); if (newPos == this->pos) return; // Update and repositition. - if (scene && update) { + inSetPosHelper = 1; + updateCachedClipPathFromSetPosHelper(newPos); + if (scene) { fullUpdateHelper(true); q->prepareGeometryChange(); } @@ -2370,7 +2378,8 @@ void QGraphicsItemPrivate::setPosHelper(const QPointF &pos, bool update) invalidateSceneTransformCache(); // Send post-notification. - q->itemChange(QGraphicsItem::ItemPositionHasChanged, newPos); + q->itemChange(QGraphicsItem::ItemPositionHasChanged, newPosVariant); + inSetPosHelper = 0; } /*! @@ -2385,7 +2394,7 @@ void QGraphicsItemPrivate::setPosHelper(const QPointF &pos, bool update) */ void QGraphicsItem::setPos(const QPointF &pos) { - d_ptr->setPosHelper(pos, /* update = */ true); + d_ptr->setPosHelper(pos); } /*! @@ -2529,10 +2538,10 @@ QTransform QGraphicsItem::sceneTransform() const QTransform m; if (d_ptr->hasTransform) { m = transform(); - m *= QTransform::fromTranslate(d_ptr->pos.x(), d_ptr->pos.y()); - } else { - // ### ? QTransform::fromTranslate(d_ptr->pos.x(), d_ptr->pos.y()) - m.translate(d_ptr->pos.x(), d_ptr->pos.y()); + if (!d_ptr->pos.isNull()) + m *= QTransform::fromTranslate(d_ptr->pos.x(), d_ptr->pos.y()); + } else if (!d_ptr->pos.isNull()) { + m = QTransform::fromTranslate(d_ptr->pos.x(), d_ptr->pos.y()); } // Combine with parent and add to cache. @@ -2657,6 +2666,8 @@ QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) co if (ok) *ok = true; const QPointF &itemPos = d_ptr->pos; + if (itemPos.isNull()) + return d_ptr->hasTransform ? transform() : QTransform(); if (d_ptr->hasTransform) return transform() * QTransform::fromTranslate(itemPos.x(), itemPos.y()); return QTransform::fromTranslate(itemPos.x(), itemPos.y()); @@ -2667,7 +2678,8 @@ QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) co const QPointF &otherPos = other->d_ptr->pos; if (other->d_ptr->hasTransform) { QTransform otherToParent = other->transform(); - otherToParent *= QTransform::fromTranslate(otherPos.x(), otherPos.y()); + if (!otherPos.isNull()) + otherToParent *= QTransform::fromTranslate(otherPos.x(), otherPos.y()); return otherToParent.inverted(ok); } else { if (ok) @@ -2692,11 +2704,11 @@ QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) co QTransform itemToParent = QTransform::fromTranslate(itemPos.x(), itemPos.y()); if (hasTr) - itemToParent = transform() * itemToParent; + itemToParent = itemPos.isNull() ? transform() : transform() * itemToParent; QTransform otherToParent = QTransform::fromTranslate(otherPos.x(), otherPos.y()); if (otherHasTr) - otherToParent = other->transform() * otherToParent; + otherToParent = otherPos.isNull() ? other->transform() : other->transform() * otherToParent; return itemToParent * otherToParent.inverted(ok); } @@ -2736,7 +2748,8 @@ QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) co const QGraphicsItemPrivate *pd = p->d_ptr; if (pd->hasTransform) x *= p->transform(); - x *= QTransform::fromTranslate(pd->pos.x(), pd->pos.y()); + if (!pd->pos.isNull()) + x *= QTransform::fromTranslate(pd->pos.x(), pd->pos.y()); } while ((p = p->d_ptr->parent) && p != root); if (parentOfOther) return x.inverted(ok); @@ -2781,12 +2794,11 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine) QVariant variant; qVariantSetValue<QMatrix>(variant, newTransform.toAffine()); newTransform = QTransform(qVariantValue<QMatrix>(itemChange(ItemMatrixChange, variant))); - if (oldTransform == newTransform) return; // Update and set the new transformation. - d_ptr->fullUpdateHelper(true); + d_ptr->fullUpdateHelper(true, true); prepareGeometryChange(); transformData->baseTransform = newTransform; transformData->dirty = true; @@ -2794,7 +2806,9 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine) d_ptr->invalidateSceneTransformCache(); // Send post-notification. - itemChange(ItemTransformHasChanged, newTransform); + // NB! We have to change the value from QMatrix to QTransform. + qVariantSetValue<QTransform>(newTransformVariant, newTransform); + itemChange(ItemTransformHasChanged, newTransformVariant); } /*! @@ -2836,14 +2850,14 @@ void QGraphicsItem::setTransform(const QTransform &matrix, bool combine) return; // Notify the item that the transformation matrix is changing. - QVariant variant; - qVariantSetValue<QTransform>(variant, newTransform); - newTransform = qVariantValue<QTransform>(itemChange(ItemTransformChange, variant)); + const QVariant newTransformVariant(itemChange(ItemTransformChange, + qVariantFromValue<QTransform>(newTransform))); + newTransform = qVariantValue<QTransform>(newTransformVariant); if (oldTransform == newTransform) return; // Update and set the new transformation. - d_ptr->fullUpdateHelper(true); + d_ptr->fullUpdateHelper(true, true); prepareGeometryChange(); transformData->baseTransform = newTransform; transformData->dirty = true; @@ -2852,7 +2866,7 @@ void QGraphicsItem::setTransform(const QTransform &matrix, bool combine) d_ptr->invalidateSceneTransformCache(); // Send post-notification. - itemChange(ItemTransformHasChanged, newTransform); + itemChange(ItemTransformHasChanged, newTransformVariant); } /*! @@ -3191,7 +3205,8 @@ qreal QGraphicsItem::zValue() const */ void QGraphicsItem::setZValue(qreal z) { - qreal newZ = qreal(itemChange(ItemZValueChange, double(z)).toDouble()); + const QVariant newZVariant(itemChange(ItemZValueChange, double(z))); + qreal newZ = qreal(newZVariant.toDouble()); if (newZ == d_ptr->z) return; d_ptr->z = z; @@ -3203,7 +3218,7 @@ void QGraphicsItem::setZValue(qreal z) d_ptr->scene->d_func()->invalidateSortCache(); } - itemChange(ItemZValueHasChanged, double(newZ)); + itemChange(ItemZValueHasChanged, newZVariant); } /*! @@ -3228,7 +3243,9 @@ QRectF QGraphicsItem::childrenBoundingRect() const QRectF childRect; foreach (QGraphicsItem *child, children()) { QPointF childPos = child->pos(); - QTransform matrix = child->transform() * QTransform::fromTranslate(childPos.x(), childPos.y()); + QTransform matrix = child->transform(); + if (!childPos.isNull()) + matrix *= QTransform::fromTranslate(childPos.x(), childPos.y()); childRect |= matrix.mapRect(child->boundingRect() | child->childrenBoundingRect()); } return childRect; @@ -3360,57 +3377,79 @@ bool QGraphicsItem::isClipped() const QPainterPath QGraphicsItem::clipPath() const { Q_D(const QGraphicsItem); - QPainterPath clip; - if (!isClipped()) - return clip; + if (!d->dirtyClipPath) + return d->emptyClipPath ? QPainterPath() : d->cachedClipPath; + + if (!isClipped()) { + d_ptr->setCachedClipPath(QPainterPath()); + return d->cachedClipPath; + } + const QRectF thisBoundingRect(boundingRect()); + if (thisBoundingRect.isEmpty()) { + if (d_ptr->flags & ItemClipsChildrenToShape) + d_ptr->setEmptyCachedClipPathRecursively(); + else + d_ptr->setEmptyCachedClipPath(); + return QPainterPath(); + } + + QPainterPath clip; // Start with the item's bounding rect. - clip.addRect(boundingRect()); + clip.addRect(thisBoundingRect); - bool clipAway = false; if (d->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { - // Make list of parents up to the farthest ancestor that clips its - // children to its shape. - QVarLengthArray<const QGraphicsItem *, 32> clippingAncestors; - const QGraphicsItem *parent = parentItem(); - const QGraphicsItem *clipOwner = 0; - do { + const QGraphicsItem *parent = this; + const QGraphicsItem *lastParent = this; + + // Intersect any in-between clips starting at the top and moving downwards. + bool foundValidClipPath = false; + while ((parent = parent->d_ptr->parent)) { if (parent->d_ptr->flags & ItemClipsChildrenToShape) { - clippingAncestors.append(parent); - clipOwner = parent; - } - } while ((parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) && (parent = parent->parentItem())); + // Map clip to the current parent and intersect with its shape/clipPath + clip = lastParent->itemTransform(parent).map(clip); + if ((foundValidClipPath = !parent->d_ptr->dirtyClipPath && parent->isClipped())) { + if (parent->d_ptr->emptyClipPath) { + if (d_ptr->flags & ItemClipsChildrenToShape) + d_ptr->setEmptyCachedClipPathRecursively(); + else + d_ptr->setEmptyCachedClipPath(); + return QPainterPath(); + } + clip = clip.intersected(parent->d_ptr->cachedClipPath); + if (!(parent->d_ptr->flags & ItemClipsToShape)) + clip = clip.intersected(parent->shape()); + } else { + clip = clip.intersected(parent->shape()); + } - // Start with the topmost clip. - QPainterPath parentClip = clipOwner->shape(); + if (clip.isEmpty()) { + if (d_ptr->flags & ItemClipsChildrenToShape) + d_ptr->setEmptyCachedClipPathRecursively(); + else + d_ptr->setEmptyCachedClipPath(); + return clip; + } + lastParent = parent; + } - // Intersect any in-between clips starting at the bottom and moving - // upwards. - for (int i = clippingAncestors.size() - 2; i >= 0; --i) { - const QGraphicsItem *item = clippingAncestors[i]; - // ### what if itemtransform fails - if (clipOwner) - parentClip = clipOwner->itemTransform(item).map(parentClip); - parentClip = parentClip.intersected(item->shape()); - if (parentClip.isEmpty()) { - clip = parentClip; - clipAway = true; + if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) + || foundValidClipPath) { break; } - clipOwner = item; } - if (!clipAway) { + if (lastParent != this) { + // Map clip back to the item's transform. // ### what if itemtransform fails - clip = clip.intersected(clipOwner->itemTransform(this).map(parentClip)); - if (clip.isEmpty()) - clipAway = true; + clip = lastParent->itemTransform(this).map(clip); } } - if (!clipAway && d->flags & ItemClipsToShape) + if (d->flags & ItemClipsToShape) clip = clip.intersected(shape()); + d_ptr->setCachedClipPath(clip); return clip; } @@ -3499,8 +3538,10 @@ bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelection return false; } - QRectF rectA = _q_adjustedRect(boundingRect()); - QRectF rectB = _q_adjustedRect(path.controlPointRect()); + QRectF rectA(boundingRect()); + _q_adjustRect(&rectA); + QRectF rectB(path.controlPointRect()); + _q_adjustRect(&rectB); if (!rectA.intersects(rectB)) { // This we can determine efficiently. If the two rects neither // intersect nor contain eachother, then the two items do not collide. @@ -3509,12 +3550,11 @@ bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelection // For further testing, we need this item's shape or bounding rect. QPainterPath thisShape; - if (mode == Qt::IntersectsItemShape || mode == Qt::ContainsItemShape) { + if (mode == Qt::IntersectsItemShape || mode == Qt::ContainsItemShape) thisShape = (isClipped() && !d_ptr->localCollisionHack) ? clipPath() : shape(); - } else { - thisShape.addPolygon(_q_adjustedRect(boundingRect())); - thisShape.closeSubpath(); - } + else + thisShape.addRect(rectA); + if (thisShape == QPainterPath()) { // Empty shape? No collision. return false; @@ -3684,7 +3724,8 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c // into the bitmap, converts the result to a QRegion and scales the region // back to device space with inverse granularity. qreal granularity = boundingRegionGranularity(); - QRect deviceRect = _q_adjustedRect(itemToDeviceTransform.mapRect(boundingRect()).toRect()); + QRect deviceRect = itemToDeviceTransform.mapRect(boundingRect()).toRect(); + _q_adjustRect(&deviceRect); if (granularity == 0.0) return QRegion(deviceRect); @@ -3814,6 +3855,24 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) /*! \internal + Returns true if we can discard an update request; otherwise false. +*/ +bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, + bool ignoreVisibleBit, + bool ignoreDirtyBit) const +{ + // No scene, or if the scene is updating everything, means we have nothing + // to do. The only exception is if the scene tracks the growing scene rect. + return (!visible && !ignoreVisibleBit) + || (dirty && !ignoreDirtyBit) + || !scene + || (scene->d_func()->updateAll && scene->d_func()->hasSceneRect) + || (!ignoreClipping && (childrenClippedToShape() && isClippedAway())) + || (childrenCombineOpacity() && isFullyTransparent()); +} + +/*! + \internal Asks the scene to mark this item's scene rect as dirty, requesting a redraw. This does not invalidate any cache. @@ -3822,19 +3881,16 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) only case where the item's background should be marked as dirty even when the item isn't visible. */ -void QGraphicsItemPrivate::updateHelper(const QRectF &rect, bool force) +void QGraphicsItemPrivate::updateHelper(const QRectF &rect, bool force, bool maybeDirtyClipPath) { // No scene, or if the scene is updating everything, means we have nothing // to do. The only exception is if the scene tracks the growing scene rect. - if (dirty) - return; - if (!scene || (scene && scene->d_func()->updateAll && scene->d_func()->hasSceneRect)) + if (discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath, /*ignoreVisibleBit=*/force)) return; - if (scene && (visible || force)) { - if (rect.isNull()) - dirty = 1; - scene->itemUpdated(q_ptr, rect); - } + + if (rect.isNull()) + dirty = 1; + scene->itemUpdated(q_ptr, rect); } /*! @@ -3842,21 +3898,25 @@ void QGraphicsItemPrivate::updateHelper(const QRectF &rect, bool force) Propagates updates to \a item and all its children. */ -void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly) +void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly, bool maybeDirtyClipPath) { - // No scene, or if the scene is updating everything, means we have nothing - // to do. The only exception is if the scene tracks the growing scene rect. - if (!scene || (scene && scene->d_func()->updateAll && scene->d_func()->hasSceneRect)) - return; - if (!childrenOnly && !dirty) - updateHelper(); - if (children.isEmpty() || dirtyChildren) + if (discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath, + /*ignoreVisibleBit=*/false, + /*ignoreDirtyBit=*/true)) { return; - if (flags & QGraphicsItem::ItemClipsChildrenToShape) { - // ### mark all children dirty? + } + + if (!childrenOnly && !dirty) { + // Effectively the same as updateHelper(QRectF(), false, maybeDirtyClipPath). + dirty = 1; + scene->itemUpdated(q_ptr, QRectF()); + } + + if (dirtyChildren || childrenClippedToShape()) { // Unnecessary to update children as well. return; } + if (ancestorFlags & AncestorClipsChildren) { Q_Q(QGraphicsItem); // Check if we can avoid updating all children. @@ -3879,10 +3939,36 @@ void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly) } } foreach (QGraphicsItem *child, children) - child->d_ptr->fullUpdateHelper(); + child->d_ptr->fullUpdateHelper(false, maybeDirtyClipPath); dirtyChildren = 1; } +static inline bool qt_allChildrenCombineOpacity(QGraphicsItem *parent) +{ + Q_ASSERT(parent); + if (parent->flags() & QGraphicsItem::ItemDoesntPropagateOpacityToChildren) + return false; + + const QList<QGraphicsItem *> children(parent->childItems()); + for (int i = 0; i < children.size(); ++i) { + if (children.at(i)->flags() & QGraphicsItem::ItemIgnoresParentOpacity) + return false; + } + return true; +} + +void QGraphicsItemPrivate::updateEffectiveOpacity() +{ + Q_Q(QGraphicsItem); + if (parent) { + resolveEffectiveOpacity(parent->effectiveOpacity()); + parent->d_ptr->allChildrenCombineOpacity = qt_allChildrenCombineOpacity(parent); + } else { + resolveEffectiveOpacity(1.0); + } + allChildrenCombineOpacity = qt_allChildrenCombineOpacity(q); +} + /*! \internal @@ -3907,7 +3993,14 @@ void QGraphicsItemPrivate::resolveEffectiveOpacity(qreal parentEffectiveOpacity) } // Set this item's resolved opacity. - setExtra(ExtraEffectiveOpacity, myEffectiveOpacity); + if (qFuzzyCompare(myEffectiveOpacity, qreal(1.0))) { + // Opaque, unset effective opacity. + hasEffectiveOpacity = 0; + unsetExtra(ExtraEffectiveOpacity); + } else { + hasEffectiveOpacity = 1; + setExtra(ExtraEffectiveOpacity, myEffectiveOpacity); + } // Resolve children always. for (int i = 0; i < children.size(); ++i) @@ -3960,6 +4053,109 @@ void QGraphicsItemPrivate::removeExtraItemCache() unsetExtra(ExtraCacheData); } +void QGraphicsItemPrivate::setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect) +{ + setEmptyCachedClipPath(); + + const bool checkRect = !emptyIfOutsideThisRect.isNull() + && !(flags & QGraphicsItem::ItemClipsChildrenToShape); + for (int i = 0; i < children.size(); ++i) { + if (!checkRect) { + children.at(i)->d_ptr->setEmptyCachedClipPathRecursively(); + continue; + } + + QGraphicsItem *child = children.at(i); + const QRectF rect = child->mapRectFromParent(emptyIfOutsideThisRect); + if (rect.intersects(child->boundingRect())) + child->d_ptr->invalidateCachedClipPathRecursively(false, rect); + else + child->d_ptr->setEmptyCachedClipPathRecursively(rect); + } +} + +void QGraphicsItemPrivate::invalidateCachedClipPathRecursively(bool childrenOnly, const QRectF &emptyIfOutsideThisRect) +{ + if (!childrenOnly) + invalidateCachedClipPath(); + + const bool checkRect = !emptyIfOutsideThisRect.isNull(); + for (int i = 0; i < children.size(); ++i) { + if (!checkRect) { + children.at(i)->d_ptr->invalidateCachedClipPathRecursively(false); + continue; + } + + QGraphicsItem *child = children.at(i); + const QRectF rect = child->mapRectFromParent(emptyIfOutsideThisRect); + if (rect.intersects(child->boundingRect())) + child->d_ptr->invalidateCachedClipPathRecursively(false, rect); + else + child->d_ptr->setEmptyCachedClipPathRecursively(rect); + } +} + +void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &newPos) +{ + Q_ASSERT(inSetPosHelper); + + if (!(ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) + return; // Not clipped by any ancestor. + + // Find closest clip ancestor and transform. + Q_Q(QGraphicsItem); + QTransform thisToParentTransform = hasTransform + ? q->transform() * QTransform::fromTranslate(newPos.x(), newPos.y()) + : QTransform::fromTranslate(newPos.x(), newPos.y()); + QGraphicsItem *clipParent = parent; + while (clipParent && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) { + if (clipParent->d_ptr->hasTransform) + thisToParentTransform *= clipParent->transform(); + if (!clipParent->d_ptr->pos.isNull()) { + thisToParentTransform *= QTransform::fromTranslate(clipParent->d_ptr->pos.x(), + clipParent->d_ptr->pos.y()); + } + clipParent = clipParent->d_ptr->parent; + } + + // thisToParentTransform is now the same as q->itemTransform(clipParent), except + // that the new position (which is not yet set on the item) is taken into account. + Q_ASSERT(clipParent); + Q_ASSERT(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); + + // From here everything is calculated in clip parent's coordinates. + const QRectF parentBoundingRect(clipParent->boundingRect()); + const QRectF thisBoundingRect(thisToParentTransform.mapRect(q->boundingRect())); + + if (!parentBoundingRect.intersects(thisBoundingRect)) { + // Item is moved outside the clip parent's bounding rect, + // i.e. it is fully clipped and the clip path is empty. + if (flags & QGraphicsItem::ItemClipsChildrenToShape) + setEmptyCachedClipPathRecursively(); + else + setEmptyCachedClipPathRecursively(thisToParentTransform.inverted().mapRect(parentBoundingRect)); + return; + } + + const QPainterPath parentClip(clipParent->isClipped() ? clipParent->clipPath() : clipParent->shape()); + if (parentClip.contains(thisBoundingRect)) + return; // Item is inside the clip parent's shape. No update required. + + const QRectF parentClipRect(parentClip.controlPointRect()); + if (!parentClipRect.intersects(thisBoundingRect)) { + // Item is moved outside the clip parent's shape, + // i.e. it is fully clipped and the clip path is empty. + if (flags & QGraphicsItem::ItemClipsChildrenToShape) + setEmptyCachedClipPathRecursively(); + else + setEmptyCachedClipPathRecursively(thisToParentTransform.inverted().mapRect(parentClipRect)); + } else { + // Item is partially inside the clip parent's shape, + // i.e. the cached clip path must be invalidated. + invalidateCachedClipPathRecursively(false, thisToParentTransform.inverted().mapRect(parentClipRect)); + } +} + /*! \internal @@ -3990,20 +4186,23 @@ bool QGraphicsItemPrivate::isProxyWidget() const */ void QGraphicsItem::update(const QRectF &rect) { - if (d_ptr->dirty) + if ((rect.isEmpty() && !rect.isNull()) || d_ptr->discardUpdateRequest()) return; - if (d_ptr->scene && isVisible()) { - if (CacheMode(d_ptr->cacheMode) != NoCache) { - QGraphicsItemCache *cache = d_ptr->extraItemCache(); - if (rect.isNull()) { - cache->allExposed = true; - cache->exposed.clear(); - } else { - cache->exposed.append(rect); - } + + if (CacheMode(d_ptr->cacheMode) != NoCache) { + QGraphicsItemCache *cache = d_ptr->extraItemCache(); + if (rect.isNull()) { + cache->allExposed = true; + cache->exposed.clear(); + } else { + cache->exposed.append(rect); } - d_ptr->updateHelper(rect); } + + // Effectively the same as updateHelper(rect); + if (rect.isNull()) + d_ptr->dirty = 1; + d_ptr->scene->itemUpdated(this, rect); } @@ -4260,9 +4459,9 @@ QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, const QRectF &rect */ QPolygonF QGraphicsItem::mapToParent(const QRectF &rect) const { - if (!d_ptr->hasTransform) - return QPolygonF(rect.translated(d_ptr->pos)); - return transform().map(rect.translated(d_ptr->pos)); + QPolygonF p = !d_ptr->hasTransform ? rect : transform().map(rect); + p.translate(d_ptr->pos); + return p; } /*! @@ -4329,8 +4528,8 @@ QRectF QGraphicsItem::mapRectToItem(const QGraphicsItem *item, const QRectF &rec */ QRectF QGraphicsItem::mapRectToParent(const QRectF &rect) const { - QRectF r = rect.translated(d_ptr->pos.x(), d_ptr->pos.y()); - return !d_ptr->hasTransform ? r : transform().mapRect(r); + QRectF r = !d_ptr->hasTransform ? rect : transform().mapRect(rect); + return r.translated(d_ptr->pos); } /*! @@ -4461,9 +4660,9 @@ QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, const QPolygonF &p */ QPolygonF QGraphicsItem::mapToParent(const QPolygonF &polygon) const { - QPolygonF p = polygon; + QPolygonF p = !d_ptr->hasTransform ? polygon : transform().map(polygon); p.translate(d_ptr->pos); - return d_ptr->hasTransform ? transform().map(p) : p; + return p; } /*! @@ -4505,7 +4704,10 @@ QPainterPath QGraphicsItem::mapToItem(const QGraphicsItem *item, const QPainterP */ QPainterPath QGraphicsItem::mapToParent(const QPainterPath &path) const { - return d_ptr->parent ? itemTransform(d_ptr->parent).map(path) : mapToScene(path); + QTransform x = QTransform::fromTranslate(d_ptr->pos.x(), d_ptr->pos.y()); + if (d_ptr->hasTransform) + x = transform() * x; + return x.map(path); } /*! @@ -5735,11 +5937,18 @@ void QGraphicsItem::removeFromIndex() void QGraphicsItem::prepareGeometryChange() { if (d_ptr->scene) { - d_ptr->updateHelper(); - + d_ptr->updateHelper(QRectF(), false, /*maybeDirtyClipPath=*/!d_ptr->inSetPosHelper); QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func(); scenePrivate->removeFromIndex(this); } + + if (d_ptr->inSetPosHelper) + return; + + if (d_ptr->flags & ItemClipsChildrenToShape) + d_ptr->invalidateCachedClipPathRecursively(); + else + d_ptr->invalidateCachedClipPath(); } /*! @@ -7253,6 +7462,7 @@ QVariant QGraphicsLineItem::extension(const QVariant &variant) const QPixmap::createHeuristicMask(). The performance and memory consumption is similar to MaskShape. */ +extern QPainterPath qt_regionToPath(const QRegion ®ion); class QGraphicsPixmapItemPrivate : public QGraphicsItemPrivate { @@ -7273,7 +7483,6 @@ public: void updateShape() { - extern QPainterPath qt_regionToPath(const QRegion ®ion); shape = QPainterPath(); switch (shapeMode) { case QGraphicsPixmapItem::MaskShape: { @@ -8323,6 +8532,8 @@ void QGraphicsTextItem::setTabChangesFocus(bool b) Returns true if the \gui Tab key will cause the widget to change focus; otherwise, false is returned. + By default, this behavior is disabled, and this function will return false. + \sa setTabChangesFocus() */ bool QGraphicsTextItem::tabChangesFocus() const @@ -8514,6 +8725,7 @@ void QGraphicsSimpleTextItem::setText(const QString &text) return; d->text = text; d->updateBoundingRect(); + update(); } /*! @@ -8775,13 +8987,17 @@ void QGraphicsItemGroup::addToGroup(QGraphicsItem *item) QTransform oldSceneMatrix = item->sceneTransform(); item->setPos(mapFromItem(item, 0, 0)); item->setParentItem(this); - item->setTransform(oldSceneMatrix - * sceneTransform().inverted() - * QTransform::fromTranslate(-item->x(), -item->y())); + QTransform newItemTransform(oldSceneMatrix); + newItemTransform *= sceneTransform().inverted(); + if (!item->pos().isNull()) + newItemTransform *= QTransform::fromTranslate(-item->x(), -item->y()); + item->setTransform(newItemTransform); item->d_func()->setIsMemberOfGroup(true); prepareGeometryChange(); - d->itemsBoundingRect |= (item->transform() * QTransform::fromTranslate(item->x(), item->y())) - .mapRect(item->boundingRect() | item->childrenBoundingRect()); + QTransform itemTransform(item->transform()); + if (!item->pos().isNull()) + itemTransform *= QTransform::fromTranslate(item->x(), item->y()); + d->itemsBoundingRect |= itemTransform.mapRect(item->boundingRect() | item->childrenBoundingRect()); update(); } diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index c14b978..d2cbf25 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -142,10 +142,15 @@ public: hasBoundingRegionGranularity(0), flags(0), hasOpacity(0), + hasEffectiveOpacity(0), isWidget(0), dirty(0), dirtyChildren(0), localCollisionHack(0), + dirtyClipPath(1), + emptyClipPath(0), + inSetPosHelper(0), + allChildrenCombineOpacity(1), globalStackingOrder(-1), sceneTransformIndex(-1), q_ptr(0) @@ -166,11 +171,15 @@ public: virtual QVariant inputMethodQueryHelper(Qt::InputMethodQuery query) const; static bool movableAncestorIsSelected(const QGraphicsItem *item); - void setPosHelper(const QPointF &pos, bool update); + void setPosHelper(const QPointF &pos); void setVisibleHelper(bool newVisible, bool explicitly, bool update = true); void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true); - void updateHelper(const QRectF &rect = QRectF(), bool force = false); - void fullUpdateHelper(bool childrenOnly = false); + bool discardUpdateRequest(bool ignoreClipping = false, + bool ignoreVisibleBit = false, + bool ignoreDirtyBit = false) const; + void updateHelper(const QRectF &rect = QRectF(), bool force = false, bool maybeDirtyClipPath = false); + void fullUpdateHelper(bool childrenOnly = false, bool maybeDirtyClipPath = false); + void updateEffectiveOpacity(); void resolveEffectiveOpacity(qreal effectiveParentOpacity); void resolveDepth(int parentDepth); void invalidateSceneTransformCache(); @@ -243,6 +252,47 @@ public: QGraphicsItemCache *extraItemCache() const; void removeExtraItemCache(); + inline void setCachedClipPath(const QPainterPath &path) + { + cachedClipPath = path; + dirtyClipPath = 0; + emptyClipPath = 0; + } + + inline void setEmptyCachedClipPath() + { + emptyClipPath = 1; + dirtyClipPath = 0; + } + + void setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect = QRectF()); + + inline void invalidateCachedClipPath() + { /*static int count = 0 ;qWarning("%i", ++count);*/ dirtyClipPath = 1; emptyClipPath = 0; } + + void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF()); + void updateCachedClipPathFromSetPosHelper(const QPointF &newPos); + + inline bool isFullyTransparent() const + { return hasEffectiveOpacity && qFuzzyCompare(q_func()->effectiveOpacity() + 1, qreal(1.0)); } + + inline bool childrenCombineOpacity() const + { return allChildrenCombineOpacity || children.isEmpty(); } + + inline bool isClippedAway() const + { return !dirtyClipPath && q_func()->isClipped() && (emptyClipPath || cachedClipPath.isEmpty()); } + + inline bool childrenClippedToShape() const + { return (flags & QGraphicsItem::ItemClipsChildrenToShape) || children.isEmpty(); } + + inline bool isInvisible() const + { + return !visible + || (childrenClippedToShape() && isClippedAway()) + || (childrenCombineOpacity() && isFullyTransparent()); + } + + QPainterPath cachedClipPath; QPointF pos; qreal z; QGraphicsScene *scene; @@ -272,10 +322,15 @@ public: // New 32 bytes quint32 hasOpacity : 1; + quint32 hasEffectiveOpacity : 1; quint32 isWidget : 1; quint32 dirty : 1; quint32 dirtyChildren : 1; quint32 localCollisionHack : 1; + quint32 dirtyClipPath : 1; + quint32 emptyClipPath : 1; + quint32 inSetPosHelper : 1; + quint32 allChildrenCombineOpacity : 1; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index 0ea7692..eaa97ff 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -117,7 +117,7 @@ QGraphicsLayoutItemPrivate::QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *par, */ void QGraphicsLayoutItemPrivate::init() { - sizeHintCacheDirty = true; + sizeHintCacheDirty = true; sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); } @@ -175,12 +175,12 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) Returns the parent item of this layout, or 0 if this layout is not installed on any widget. - + If this is the item that the layout is installed on, it will return "itself". If the layout is a sub-layout, this function returns the parent widget of the parent layout. - + Note that it will traverse up the layout item hierarchy instead of just calling QGraphicsItem::parentItem(). This is on purpose. @@ -233,7 +233,7 @@ QGraphicsItem *QGraphicsLayoutItemPrivate::parentItem() const position. Calling setGeometry() will always resize and reposition the item immediately. Normally, this function is called by QGraphicsLayout after the layout has been activated, but it can also be called by the item's user - at any time. + at any time. The sizeHint() function returns the item' minimum, preferred and maximum size hints. You can override these properties by calling setMinimumSize(), @@ -360,7 +360,7 @@ void QGraphicsLayoutItem::setSizePolicy(QSizePolicy::Policy hPolicy, } /*! - Returns the current size policy. + Returns the current size policy. \sa setSizePolicy(), QWidget::sizePolicy() */ @@ -626,14 +626,15 @@ void QGraphicsLayoutItem::setMaximumHeight(qreal height) */ /*! - \fn virtual void QGraphicsLayoutItem::setGeometry(const QRectF &rect) = 0 + \fn virtual void QGraphicsLayoutItem::setGeometry(const QRectF &rect) - This pure virtual function sets the geometry of the QGraphicsLayoutItem to + This virtual function sets the geometry of the QGraphicsLayoutItem to \a rect, which is in parent coordinates (e.g., the top-left corner of \a rect is equivalent to the item's position in parent coordinates). - Reimplement this function in a subclass of QGraphicsLayoutItem to enable - your item to receive geometry updates. + You must reimplement this function in a subclass of QGraphicsLayoutItem to + receive geometry updates. The layout will call this function when it does a + rearrangement. If \a rect is outside of the bounds of minimumSize and maximumSize, it will be adjusted to its closest size so that it is within the legal @@ -744,7 +745,7 @@ QSizeF QGraphicsLayoutItem::effectiveSizeHint(Qt::SizeHint which, const QSizeF & \sa effectiveSizeHint() */ void QGraphicsLayoutItem::updateGeometry() -{ +{ Q_D(QGraphicsLayoutItem); d->sizeHintCacheDirty = true; } @@ -768,7 +769,7 @@ QGraphicsLayoutItem *QGraphicsLayoutItem::parentLayoutItem() const \sa parentLayoutItem() */ void QGraphicsLayoutItem::setParentLayoutItem(QGraphicsLayoutItem *parent) -{ +{ d_func()->parent = parent; } @@ -789,12 +790,12 @@ bool QGraphicsLayoutItem::isLayout() const If its true, then the layout will delete it. If its false, then it is assumed that another object has the ownership of it, and the layout won't delete this item. - - If the item inherits both QGraphicsItem and QGraphicsLayoutItem (such - as QGraphicsWidget does) the item is really part of two ownership + + If the item inherits both QGraphicsItem and QGraphicsLayoutItem (such + as QGraphicsWidget does) the item is really part of two ownership hierarchies. This property informs what the layout should do with its child items when it is destructed. In the case of QGraphicsWidget, it - is preferred that when the layout is deleted it won't delete its children + is preferred that when the layout is deleted it won't delete its children (since they are also part of the graphics item hierarchy). By default this value is initialized to false in QGraphicsLayoutItem, @@ -822,9 +823,9 @@ void QGraphicsLayoutItem::setOwnedByLayout(bool ownership) /*! * Returns the QGraphicsItem that this layout item represents. - * For QGraphicsWidget it will return itself. For custom items it can return an - * aggregated value. - * + * For QGraphicsWidget it will return itself. For custom items it can return an + * aggregated value. + * * \sa setGraphicsItem() */ QGraphicsItem *QGraphicsLayoutItem::graphicsItem() const @@ -836,10 +837,10 @@ QGraphicsItem *QGraphicsLayoutItem::graphicsItem() const * If the QGraphicsLayoutItem represents a QGraphicsItem, and it wants to take * advantage of the automatic reparenting capabilities of QGraphicsLayout it * should set this value. - * Note that if you delete \a item and not delete the layout item, you are - * responsible of calling setGraphicsItem(0) in order to avoid having a + * Note that if you delete \a item and not delete the layout item, you are + * responsible of calling setGraphicsItem(0) in order to avoid having a * dangling pointer. - * + * * \sa graphicsItem() */ void QGraphicsLayoutItem::setGraphicsItem(QGraphicsItem *item) @@ -848,5 +849,5 @@ void QGraphicsLayoutItem::setGraphicsItem(QGraphicsItem *item) } QT_END_NAMESPACE - + #endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 1bd2e21..973254f 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -177,6 +177,10 @@ QT_BEGIN_NAMESPACE while the widget is embedded. In this state, the widget may differ slightly in behavior from when it is not embedded. + \warning This class is provided for convenience when bridging + QWidgets and QGraphicsItems, it should not be used for + high-performance scenarios. + \sa QGraphicsScene::addWidget(), QGraphicsWidget */ @@ -1034,7 +1038,7 @@ void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event) if (receiver != d->dragDropWidget) { // Try to enter before we leave QDragEnterEvent dragEnter(receiverPos, event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers()); - dragEnter.setDropAction(event->proposedAction()); + dragEnter.setDropAction(event->proposedAction()); QApplication::sendEvent(receiver, &dragEnter); event->setAccepted(dragEnter.isAccepted()); event->setDropAction(dragEnter.dropAction()); @@ -1433,7 +1437,7 @@ int QGraphicsProxyWidget::type() const Creates a proxy widget for the given \a child of the widget contained in this proxy. - + This function makes it possible to aquire proxies for non top-level widgets. For instance, you can embed a dialog, and then transform only one of its widgets. diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 1f78a18..9881960 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -292,15 +292,21 @@ static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) // QRectF::intersects() returns false always if either the source or target // rectangle's width or height are 0. This works around that problem. -static QRectF _q_adjustedRect(const QRectF &rect) +static inline void _q_adjustRect(QRectF *rect) { - static const qreal p = (qreal)0.00001; - QRectF r = rect; - if (!r.width()) - r.adjust(-p, 0, p, 0); - if (!r.height()) - r.adjust(0, -p, 0, p); - return r; + Q_ASSERT(rect); + if (!rect->width()) + rect->adjust(-0.00001, 0, 0.00001, 0); + if (!rect->height()) + rect->adjust(0, -0.00001, 0, 0.00001); +} + +static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item) +{ + Q_ASSERT(item); + QRectF boundingRect(item->boundingRect()); + _q_adjustRect(&boundingRect); + return boundingRect; } static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraphicsSceneMouseEvent *mouseEvent) @@ -632,10 +638,11 @@ void QGraphicsScenePrivate::_q_updateLater() */ void QGraphicsScenePrivate::_q_polishItems() { + const QVariant booleanTrueVariant(true); foreach (QGraphicsItem *item, unpolishedItems) { if (!item->d_ptr->explicitlyHidden) { - item->itemChange(QGraphicsItem::ItemVisibleChange, true); - item->itemChange(QGraphicsItem::ItemVisibleHasChanged, true); + item->itemChange(QGraphicsItem::ItemVisibleChange, booleanTrueVariant); + item->itemChange(QGraphicsItem::ItemVisibleHasChanged, booleanTrueVariant); } if (item->isWidget()) { QEvent event(QEvent::Polish); @@ -691,9 +698,8 @@ void QGraphicsScenePrivate::_q_removeItemLater(QGraphicsItem *item) Q_Q(QGraphicsScene); if (QGraphicsItem *parent = item->d_func()->parent) { - QVariant variant; - qVariantSetValue<QGraphicsItem *>(variant, item); - parent->itemChange(QGraphicsItem::ItemChildRemovedChange, variant); + parent->itemChange(QGraphicsItem::ItemChildRemovedChange, + qVariantFromValue<QGraphicsItem *>(item)); parent->d_func()->children.removeAll(item); } @@ -740,6 +746,15 @@ void QGraphicsScenePrivate::_q_removeItemLater(QGraphicsItem *item) unpolishedItems.removeAll(item); dirtyItems.removeAll(item); + //We remove all references of item from the sceneEventFilter arrays + QMultiMap<QGraphicsItem*, QGraphicsItem*>::iterator iterator = sceneEventFilters.begin(); + while (iterator != sceneEventFilters.end()) { + if (iterator.value() == item || iterator.key() == item) + iterator = sceneEventFilters.erase(iterator); + else + ++iterator; + } + // Remove from scene transform cache int transformIndex = item->d_func()->sceneTransformIndex; if (transformIndex != -1) { @@ -1358,6 +1373,48 @@ QGraphicsWidget *QGraphicsScenePrivate::windowForItem(const QGraphicsItem *item) return 0; } + +QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QPointF &pos) const +{ + QList<QGraphicsItem *> items; + + // The index returns a rough estimate of what items are inside the rect. + // Refine it by iterating through all returned items. + QRectF adjustedRect = QRectF(pos, QSize(1,1)); + foreach (QGraphicsItem *item, estimateItemsInRect(adjustedRect)) { + // Find the item's scene transform in a clever way. + QTransform x = item->sceneTransform(); + bool keep = false; + + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + // Rect intersects/contains item's shape + if (QRectF_intersects(adjustedRect, x.mapRect(br))) { + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) { + if (item->contains(xinv.map(pos))) { + items << item; + keep = true; + } + } + } + + if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { + // Recurse into children that clip children. + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) + childItems_helper(&items, item, xinv.map(pos)); + } + } + + sortItems(&items, Qt::AscendingOrder, sortCacheEnabled); + return items; +} + QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order) const @@ -1368,7 +1425,8 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QRectF &rect, // The index returns a rough estimate of what items are inside the rect. // Refine it by iterating through all returned items. - QRectF adjustedRect = _q_adjustedRect(rect); + QRectF adjustedRect(rect); + _q_adjustRect(&adjustedRect); foreach (QGraphicsItem *item, estimateItemsInRect(adjustedRect)) { // Find the item's scene transform in a clever way. QTransform x = item->sceneTransform(); @@ -1377,7 +1435,7 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QRectF &rect, // ### _q_adjustedRect is only needed because QRectF::intersects, // QRectF::contains and QTransform::map() and friends don't work with // flat rectangles. - QRectF br = _q_adjustedRect(item->boundingRect()); + const QRectF br(adjustedItemBoundingRect(item)); if (mode >= Qt::ContainsItemBoundingRect) { // Rect intersects/contains item's bounding rect QRectF mbr = x.mapRect(br); @@ -1392,7 +1450,7 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QRectF &rect, bool ok; QTransform xinv = x.inverted(&ok); if (ok) { - if (path == QPainterPath()) + if (path.isEmpty()) path.addRect(rect); if (itemCollidesWithPath(item, xinv.map(path), mode)) { items << item; @@ -1429,7 +1487,8 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QPolygonF &poly { QList<QGraphicsItem *> items; - QRectF polyRect = _q_adjustedRect(polygon.boundingRect()); + QRectF polyRect(polygon.boundingRect()); + _q_adjustRect(&polyRect); QPainterPath path; // The index returns a rough estimate of what items are inside the rect. @@ -1442,7 +1501,7 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QPolygonF &poly // ### _q_adjustedRect is only needed because QRectF::intersects, // QRectF::contains and QTransform::map() and friends don't work with // flat rectangles. - QRectF br = _q_adjustedRect(item->boundingRect()); + const QRectF br(adjustedItemBoundingRect(item)); if (mode >= Qt::ContainsItemBoundingRect) { // Polygon contains/intersects item's bounding rect if (path == QPainterPath()) @@ -1487,20 +1546,46 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QPainterPath &p Qt::SortOrder order) const { QList<QGraphicsItem *> items; + QRectF pathRect(path.controlPointRect()); + _q_adjustRect(&pathRect); + // The index returns a rough estimate of what items are inside the rect. // Refine it by iterating through all returned items. - foreach (QGraphicsItem *item, estimateItemsInRect(_q_adjustedRect(path.controlPointRect()))) { + foreach (QGraphicsItem *item, estimateItemsInRect(pathRect)) { // Find the item's scene transform in a clever way. QTransform x = item->sceneTransform(); - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - QPainterPath mappedPath = xinv.map(path); - if (itemCollidesWithPath(item, mappedPath, mode)) { + bool keep = false; + + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + if (mode >= Qt::ContainsItemBoundingRect) { + // Path contains/intersects item's bounding rect + if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(x.mapRect(br))) + || (mode == Qt::ContainsItemBoundingRect && path.contains(x.mapRect(br)))) { items << item; - if (item->flags() & QGraphicsItem::ItemClipsChildrenToShape) - childItems_helper(&items, item, mappedPath, mode); + keep = true; } + } else { + // Path contains/intersects item's shape + if (QRectF_intersects(pathRect, x.mapRect(br))) { + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) { + if (itemCollidesWithPath(item, xinv.map(path), mode)) { + items << item; + keep = true; + } + } + } + } + + if (keep && (item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) { + bool ok; + QTransform xinv = x.inverted(&ok); + if (ok) + childItems_helper(&items, item, xinv.map(path), mode); } } @@ -1511,13 +1596,13 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::items_helper(const QPainterPath &p void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items, const QGraphicsItem *parent, - const QRectF &rect, - Qt::ItemSelectionMode mode) const + const QPointF &pos) const { - QPainterPath path; bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - QRectF r = !parentClip ? _q_adjustedRect(rect) : _q_adjustedRect(rect).intersected(_q_adjustedRect(parent->boundingRect())); - if (r.isEmpty()) + if (parentClip && parent->d_ptr->isClippedAway()) + return; + // ### is this needed? + if (parentClip && !parent->boundingRect().contains(pos)) return; QList<QGraphicsItem *> &children = parent->d_ptr->children; @@ -1527,31 +1612,73 @@ void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items, continue; // Skip invisible items and all their children. - if (!item->d_ptr->visible || qFuzzyCompare(item->effectiveOpacity(), qreal(0.0))) + if (item->d_ptr->isInvisible()) continue; - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - QRectF br = _q_adjustedRect(item->boundingRect()); - QRectF mbr = item->mapRectToParent(br); bool keep = false; - if (mode >= Qt::ContainsItemBoundingRect) { - // Rect intersects/contains item's bounding rect - if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr)) - || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(br))) { + if (!item->d_ptr->isClippedAway()) { + if (item->contains(item->mapFromParent(pos))) { items->append(item); keep = true; } - } else { - // Rect intersects/contains item's shape - if (QRectF_intersects(rect, mbr)) { - if (path == QPainterPath()) - path.addRect(rect); - if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) { + } + + if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) + // Recurse into children. + childItems_helper(items, item, item->mapFromParent(pos)); + } +} + + +void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items, + const QGraphicsItem *parent, + const QRectF &rect, + Qt::ItemSelectionMode mode) const +{ + bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); + if (parentClip && parent->d_ptr->isClippedAway()) + return; + QRectF adjustedRect(rect); + _q_adjustRect(&adjustedRect); + QRectF r = !parentClip ? adjustedRect : adjustedRect.intersected(adjustedItemBoundingRect(parent)); + if (r.isEmpty()) + return; + + QPainterPath path; + QList<QGraphicsItem *> &children = parent->d_ptr->children; + for (int i = 0; i < children.size(); ++i) { + QGraphicsItem *item = children.at(i); + if (item->d_ptr->hasTransform && !item->transform().isInvertible()) + continue; + + // Skip invisible items and all their children. + if (item->d_ptr->isInvisible()) + continue; + + bool keep = false; + if (!item->d_ptr->isClippedAway()) { + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + QRectF mbr = item->mapRectToParent(br); + if (mode >= Qt::ContainsItemBoundingRect) { + // Rect intersects/contains item's bounding rect + if ((mode == Qt::IntersectsItemBoundingRect && QRectF_intersects(rect, mbr)) + || (mode == Qt::ContainsItemBoundingRect && rect != mbr && rect.contains(br))) { items->append(item); keep = true; } + } else { + // Rect intersects/contains item's shape + if (QRectF_intersects(rect, mbr)) { + if (path == QPainterPath()) + path.addRect(rect); + if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) { + items->append(item); + keep = true; + } + } } } @@ -1568,18 +1695,22 @@ void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items, } } + void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items, const QGraphicsItem *parent, const QPolygonF &polygon, Qt::ItemSelectionMode mode) const { - QPainterPath path; bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - QRectF polyRect = _q_adjustedRect(polygon.boundingRect()); - QRectF r = !parentClip ? polyRect : polyRect.intersected(_q_adjustedRect(parent->boundingRect())); + if (parentClip && parent->d_ptr->isClippedAway()) + return; + QRectF polyRect(polygon.boundingRect()); + _q_adjustRect(&polyRect); + QRectF r = !parentClip ? polyRect : polyRect.intersected(adjustedItemBoundingRect(parent)); if (r.isEmpty()) return; + QPainterPath path; QList<QGraphicsItem *> &children = parent->d_ptr->children; for (int i = 0; i < children.size(); ++i) { QGraphicsItem *item = children.at(i); @@ -1587,32 +1718,34 @@ void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items, continue; // Skip invisible items. - if (!item->d_ptr->visible || qFuzzyCompare(item->effectiveOpacity() + 1, qreal(1.0))) + if (item->d_ptr->isInvisible()) continue; - // ### _q_adjustedRect is only needed because QRectF::intersects, - // QRectF::contains and QTransform::map() and friends don't work with - // flat rectangles. - QRectF br = _q_adjustedRect(item->boundingRect()); bool keep = false; - if (mode >= Qt::ContainsItemBoundingRect) { - // Polygon contains/intersects item's bounding rect - if (path == QPainterPath()) - path.addPolygon(polygon); - if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) - || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { - items->append(item); - keep = true; - } - } else { - // Polygon contains/intersects item's shape - if (QRectF_intersects(polyRect, item->mapRectToParent(br))) { + if (!item->d_ptr->isClippedAway()) { + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + if (mode >= Qt::ContainsItemBoundingRect) { + // Polygon contains/intersects item's bounding rect if (path == QPainterPath()) path.addPolygon(polygon); - if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) { + if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) + || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { items->append(item); keep = true; } + } else { + // Polygon contains/intersects item's shape + if (QRectF_intersects(polyRect, item->mapRectToParent(br))) { + if (path == QPainterPath()) + path.addPolygon(polygon); + if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) { + items->append(item); + keep = true; + } + } } } @@ -1629,30 +1762,52 @@ void QGraphicsScenePrivate::childItems_helper(QList<QGraphicsItem *> *items, Qt::ItemSelectionMode mode) const { bool parentClip = (parent->flags() & QGraphicsItem::ItemClipsChildrenToShape); - QPainterPath intersectedPath = !parentClip ? path : path.intersected(parent->shape()); - if (intersectedPath.isEmpty()) + if (parentClip && parent->d_ptr->isClippedAway()) + return; + QRectF pathRect(path.boundingRect()); + _q_adjustRect(&pathRect); + QRectF r = !parentClip ? pathRect : pathRect.intersected(adjustedItemBoundingRect(parent)); + if (r.isEmpty()) return; QList<QGraphicsItem *> &children = parent->d_ptr->children; for (int i = 0; i < children.size(); ++i) { QGraphicsItem *item = children.at(i); + if (item->d_ptr->hasTransform && !item->transform().isInvertible()) + continue; // Skip invisible items. - if (!item->d_ptr->visible || qFuzzyCompare(item->effectiveOpacity(), qreal(0.0))) + if (item->d_ptr->isInvisible()) continue; - QTransform x = item->sceneTransform(); - - bool ok; - QTransform xinv = x.inverted(&ok); - if (ok) { - QPainterPath mappedPath = xinv.map(path); - if (itemCollidesWithPath(item, mappedPath, mode)) { - items->append(item); - if (!item->d_ptr->children.isEmpty()) - childItems_helper(items, item, mappedPath, mode); + bool keep = false; + if (!item->d_ptr->isClippedAway()) { + // ### _q_adjustedRect is only needed because QRectF::intersects, + // QRectF::contains and QTransform::map() and friends don't work with + // flat rectangles. + const QRectF br(adjustedItemBoundingRect(item)); + if (mode >= Qt::ContainsItemBoundingRect) { + // Polygon contains/intersects item's bounding rect + if ((mode == Qt::IntersectsItemBoundingRect && path.intersects(item->mapRectToParent(br))) + || (mode == Qt::ContainsItemBoundingRect && path.contains(item->mapRectToParent(br)))) { + items->append(item); + keep = true; + } + } else { + // Path contains/intersects item's shape + if (QRectF_intersects(pathRect, item->mapRectToParent(br))) { + if (itemCollidesWithPath(item, item->mapFromParent(path), mode)) { + items->append(item); + keep = true; + } + } } } + + if ((keep || !(item->flags() & QGraphicsItem::ItemClipsChildrenToShape)) && !item->d_ptr->children.isEmpty()) { + // Recurse into children that clip children. + childItems_helper(items, item, item->mapFromParent(path), mode); + } } } @@ -2326,17 +2481,8 @@ QList<QGraphicsItem *> QGraphicsScene::items() const */ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const { - QList<QGraphicsItem *> itemsAtPoint; - - // Find all items within a 1x1 rect area starting at pos. This can be - // inefficient for scenes that use small coordinates (like unity - // coordinates), or for detailed graphs. ### The index should support - // fetching items at a pos to avoid this limitation. - foreach (QGraphicsItem *item, items(QRectF(pos, QSizeF(1, 1)), Qt::IntersectsItemBoundingRect)) { - if (item->contains(item->mapFromScene(pos))) - itemsAtPoint << item; - } - return itemsAtPoint; + Q_D(const QGraphicsScene); + return d->items_helper(pos); } @@ -2723,8 +2869,9 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Notify the item that its scene is changing, and allow the item to // react. - QGraphicsScene *targetScene = qVariantValue<QGraphicsScene *>(item->itemChange(QGraphicsItem::ItemSceneChange, - qVariantFromValue<QGraphicsScene *>(this))); + const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, + qVariantFromValue<QGraphicsScene *>(this))); + QGraphicsScene *targetScene = qVariantValue<QGraphicsScene *>(newSceneVariant); if (targetScene != this) { if (targetScene && item->scene() != targetScene) targetScene->addItem(item); @@ -2818,7 +2965,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item) emit selectionChanged(); // Deliver post-change notification - item->itemChange(QGraphicsItem::ItemSceneHasChanged, qVariantFromValue<QGraphicsScene *>(this)); + item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); } /*! @@ -3082,8 +3229,9 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) // Notify the item that it's scene is changing to 0, allowing the item to // react. - QGraphicsScene *targetScene = qVariantValue<QGraphicsScene *>(item->itemChange(QGraphicsItem::ItemSceneChange, - qVariantFromValue<QGraphicsScene *>(0))); + const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange, + qVariantFromValue<QGraphicsScene *>(0))); + QGraphicsScene *targetScene = qVariantValue<QGraphicsScene *>(newSceneVariant); if (targetScene != 0 && targetScene != this) { targetScene->addItem(item); return; @@ -3154,6 +3302,16 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) d->unpolishedItems.removeAll(item); d->dirtyItems.removeAll(item); + //We remove all references of item from the sceneEventFilter arrays + QMultiMap<QGraphicsItem*, QGraphicsItem*>::iterator iterator = d->sceneEventFilters.begin(); + while (iterator != d->sceneEventFilters.end()) { + if (iterator.value() == item || iterator.key() == item) + iterator = d->sceneEventFilters.erase(iterator); + else + ++iterator; + } + + //Ensure dirty flag have the correct default value so the next time it will be added it will receive updates item->d_func()->dirty = 0; item->d_func()->dirtyChildren = 0; @@ -3181,7 +3339,7 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) emit selectionChanged(); // Deliver post-change notification - item->itemChange(QGraphicsItem::ItemSceneHasChanged, qVariantFromValue<QGraphicsScene *>(0)); + item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant); } /*! @@ -3455,7 +3613,7 @@ QVariant QGraphicsScene::inputMethodQuery(Qt::InputMethodQuery query) const void QGraphicsScene::update(const QRectF &rect) { Q_D(QGraphicsScene); - if (d->updateAll) + if (d->updateAll || (rect.isEmpty() && !rect.isNull())) return; // Check if anyone's connected; if not, we can send updates directly to @@ -4564,7 +4722,9 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte // Item's (local) bounding rect QRectF brect = item->boundingRect(); - if (_q_adjustedRect(brect).isEmpty()) + QRectF adjustedBrect(brect); + _q_adjustRect(&adjustedBrect); + if (adjustedBrect.isEmpty()) return; // Fetch the off-screen transparent buffer and exposed area info. @@ -4595,16 +4755,17 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte if (cacheMode == QGraphicsItem::ItemCoordinateCache) { QSize pixmapSize; bool fixedCacheSize = false; + QRectF brectAligned = brect.toAlignedRect(); if ((fixedCacheSize = itemCache->fixedSize.isValid())) { pixmapSize = itemCache->fixedSize; } else { - pixmapSize = brect.toAlignedRect().size(); + pixmapSize = brectAligned.size().toSize(); } // Create or recreate the pixmap. int adjust = itemCache->fixedSize.isValid() ? 0 : 2; QSize adjustSize(adjust*2, adjust*2); - QRectF br = brect.adjusted(-adjust, -adjust, adjust, adjust); + QRectF br = brectAligned.adjusted(-adjust, -adjust, adjust, adjust); if (pix.isNull() || (!fixedCacheSize && (pixmapSize + adjustSize) != pix.size())) { pix = QPixmap(pixmapSize + adjustSize); itemCache->exposed.clear(); @@ -4614,9 +4775,11 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte // Redraw any newly exposed areas. if (itemCache->allExposed || !itemCache->exposed.isEmpty()) { // Fit the item's bounding rect into the pixmap's coordinates. - const QPointF scale(pixmapSize.width() / brect.width(), pixmapSize.height() / brect.height()); QTransform itemToPixmap; - itemToPixmap.scale(scale.x(), scale.y()); + if (fixedCacheSize) { + const QPointF scale(pixmapSize.width() / brect.width(), pixmapSize.height() / brect.height()); + itemToPixmap.scale(scale.x(), scale.y()); + } itemToPixmap.translate(-br.x(), -br.y()); // Generate the item's exposedRect and map its list of expose @@ -4733,11 +4896,9 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte if (newCacheIndent != deviceData->cacheIndent || deviceRect.size() != pix.size()) { QPoint diff = newCacheIndent - deviceData->cacheIndent; QPixmap newPix(deviceRect.size()); - // ### Investigate removing this fill (test with Plasma and - // graphicssystem raster). - newPix.fill(Qt::transparent); if (!pix.isNull()) { QPainter newPixPainter(&newPix); + newPixPainter.setCompositionMode(QPainter::CompositionMode_Source); newPixPainter.drawPixmap(-diff, pix); newPixPainter.end(); } @@ -4769,8 +4930,9 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte if (itemCache->allExposed || !itemCache->exposed.isEmpty() || !scrollExposure.isEmpty()) { // Construct an item-to-pixmap transform. QPointF p = deviceRect.topLeft(); - QTransform itemToPixmap = QTransform::fromTranslate(-p.x(), -p.y()); - itemToPixmap = painter->worldTransform() * itemToPixmap; + QTransform itemToPixmap = painter->worldTransform(); + if (!p.isNull()) + itemToPixmap *= QTransform::fromTranslate(-p.x(), -p.y()); // Map the item's logical expose to pixmap coordinates. QRegion pixmapExposed = scrollExposure; @@ -5104,9 +5266,12 @@ void QGraphicsScene::itemUpdated(QGraphicsItem *item, const QRectF &rect) update(item->sceneBoundingRect()); } else { // ### Remove _q_adjustedRects(). - QRectF boundingRect = _q_adjustedRect(item->boundingRect()); - if (!rect.isNull()) - boundingRect &= _q_adjustedRect(rect); + QRectF boundingRect(adjustedItemBoundingRect(item)); + if (!rect.isNull()) { + QRectF adjustedRect(rect); + _q_adjustRect(&adjustedRect); + boundingRect &= adjustedRect; + } // Update each view directly. for (int i = 0; i < d->views.size(); ++i) @@ -5118,6 +5283,9 @@ void QGraphicsScene::itemUpdated(QGraphicsItem *item, const QRectF &rect) d->resetDirtyItemsLater(); } + if (!item->isVisible()) + return; // Hiding an item won't effect the largestUntransformableItem/sceneRect. + // Update d->largestUntransformableItem by mapping this item's bounding // rect back to the topmost untransformable item's untransformed // coordinate system (which sort of equals the 1:1 coordinate system of an @@ -5133,7 +5301,9 @@ void QGraphicsScene::itemUpdated(QGraphicsItem *item, const QRectF &rect) // defined scene rect. if (!d->hasSceneRect) { QRectF oldGrowingItemsBoundingRect = d->growingItemsBoundingRect; - d->growingItemsBoundingRect |= _q_adjustedRect(item->sceneBoundingRect()); + QRectF adjustedItemSceneBoundingRect(item->sceneBoundingRect()); + _q_adjustRect(&adjustedItemSceneBoundingRect); + d->growingItemsBoundingRect |= adjustedItemSceneBoundingRect; if (d->growingItemsBoundingRect != oldGrowingItemsBoundingRect) emit sceneRectChanged(d->growingItemsBoundingRect); } diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 9c165d1..befbbd8 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -197,6 +197,7 @@ public: void mousePressEventHandler(QGraphicsSceneMouseEvent *mouseEvent); QGraphicsWidget *windowForItem(const QGraphicsItem *item) const; + QList<QGraphicsItem *> items_helper(const QPointF &pos) const; QList<QGraphicsItem *> items_helper(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order) const; @@ -208,6 +209,9 @@ public: Qt::SortOrder order) const; void childItems_helper(QList<QGraphicsItem *> *items, const QGraphicsItem *parent, + const QPointF &pos) const; + void childItems_helper(QList<QGraphicsItem *> *items, + const QGraphicsItem *parent, const QRectF &rect, Qt::ItemSelectionMode mode) const; void childItems_helper(QList<QGraphicsItem *> *items, diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index 57c79db..b819c2c 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -133,7 +133,7 @@ A QContextMenuEvent received by a QGraphicsView is translated into a QGraphicsSceneContextMenuEvent. The - QWheelEvent::globalPos() is translated into item, scene, and + QContextMenuEvent::globalPos() is translated into item, scene, and screen coordinates (pos(), scenePos(), and screenPos()). \sa QGraphicsSceneMouseEvent, QGraphicsSceneWheelEvent, diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 15c0e25..b5a1bdf 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -790,6 +790,19 @@ QRegion QGraphicsViewPrivate::mapToViewRegion(const QGraphicsItem *item, const Q return item->boundingRegion(itv) & itv.mapRect(rect).toAlignedRect(); } +// QRectF::intersects() returns false always if either the source or target +// rectangle's width or height are 0. This works around that problem. +static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item) +{ + Q_ASSERT(item); + QRectF boundingRect(item->boundingRect()); + if (!boundingRect.width()) + boundingRect.adjust(-0.00001, 0, 0.00001, 0); + if (!boundingRect.height()) + boundingRect.adjust(0, -0.00001, 0, 0.00001); + return boundingRect; +} + /*! \internal */ @@ -801,38 +814,37 @@ void QGraphicsViewPrivate::itemUpdated(QGraphicsItem *item, const QRectF &rect) updateLater(); QRectF updateRect = rect; - if (item->isClipped()) { + if ((item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape) || item->d_ptr->children.isEmpty()) { + updateRect &= adjustedItemBoundingRect(item); + if (updateRect.isEmpty()) + return; + } + + QGraphicsItem *clipItem = item; + if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { // Minimize unnecessary redraw. - QGraphicsItem *p = item; - while ((p = p->d_ptr->parent)) { - if (p->flags() & QGraphicsItem::ItemClipsChildrenToShape) { - updateRect &= p->itemTransform(item).mapRect(p->boundingRect()); - if (updateRect.isNull()) + QGraphicsItem *parent = item; + while ((parent = parent->d_ptr->parent)) { + if (parent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape) { + // Map update rect to the current parent and itersect with its bounding rect. + updateRect = clipItem->itemTransform(parent).mapRect(updateRect) + & adjustedItemBoundingRect(parent); + if (updateRect.isEmpty()) return; + clipItem = parent; } - if (!(p->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) + if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) break; } - - if (updateRect.isNull()) - return; } - // Map the rect to view coordinates. - QRect vr = viewport->rect(); - - if (!item->d_ptr->hasBoundingRegionGranularity) { - QRect r = mapToViewRect(item, updateRect) & vr; - if (r.isNull()) - return; - this->updateRect(r); - } else { - QRegion r = mapToViewRegion(item, updateRect) & vr; - if (r.isEmpty()) - return; - updateRegion(r); - } + // Map update rect from clipItem coordinates to view coordinates. + Q_ASSERT(clipItem); + if (!item->d_ptr->hasBoundingRegionGranularity) + this->updateRect(mapToViewRect(clipItem, updateRect) & viewport->rect()); + else + updateRegion(mapToViewRegion(clipItem, updateRect) & viewport->rect()); } void QGraphicsViewPrivate::updateLater() @@ -855,16 +867,19 @@ void QGraphicsViewPrivate::_q_updateLaterSlot() const QList<QGraphicsItem *> &dirtyItems = scene->d_func()->dirtyItems; for (int i = 0; i < dirtyItems.size(); ++i) { const QGraphicsItem *item = dirtyItems.at(i); + if (item->d_ptr->discardUpdateRequest(/*ignoreClipping=*/false, + /*ignoreVisibleBit=*/false, + /*ignoreDirtyBit=*/true)) { + continue; + } QTransform x = item->sceneTransform() * viewTransform; - QRect viewRect = x.mapRect(item->boundingRect()).toAlignedRect() & vr; - if (!viewRect.isNull()) - updateRect(viewRect); + updateRect(x.mapRect(item->boundingRect()).toAlignedRect() & vr); } dirtyRectCount += dirtyRects.size(); bool noUpdate = !fullUpdatePending && viewportUpdateMode == QGraphicsView::FullViewportUpdate; - if ((dirtyRectCount > 0 || !dirtyBoundingRect.isNull()) && !fullUpdatePending && !noUpdate) { + if ((dirtyRectCount > 0 || !dirtyBoundingRect.isEmpty()) && !fullUpdatePending && !noUpdate) { if (viewportUpdateMode == QGraphicsView::BoundingRectViewportUpdate || (viewportUpdateMode == QGraphicsView::SmartViewportUpdate && dirtyRectCount >= QGRAPHICSVIEW_REGION_RECT_THRESHOLD)) { @@ -921,6 +936,9 @@ void QGraphicsViewPrivate::updateAll() void QGraphicsViewPrivate::updateRegion(const QRegion &r) { + if (r.isEmpty()) + return; + Q_Q(QGraphicsView); // Rect intersects viewport - update everything? @@ -969,6 +987,9 @@ void QGraphicsViewPrivate::updateRegion(const QRegion &r) void QGraphicsViewPrivate::updateRect(const QRect &r) { + if (r.isEmpty()) + return; + Q_Q(QGraphicsView); // Rect intersects viewport - update everything? @@ -1023,105 +1044,73 @@ void QGraphicsViewPrivate::freeStyleOptionsArray(QStyleOptionGraphicsItem *array delete [] array; } +extern QPainterPath qt_regionToPath(const QRegion ®ion); -QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, - const QTransform &worldTransform, - bool *allItems) const +/*! + ### Adjustments in findItems: mapToScene(QRect) forces us to adjust the + input rectangle by (0, 0, 1, 1), because it uses QRect::bottomRight() + (etc) when mapping the rectangle to a polygon (which is _wrong_). In + addition, as QGraphicsItem::boundingRect() is defined in logical space, + but the default pen for QPainter is cosmetic with a width of 0, QPainter + is at risk of painting 1 pixel outside the bounding rect. Therefore we + must search for items with an adjustment of (-1, -1, 1, 1). +*/ +QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, bool *allItems) const { Q_Q(const QGraphicsView); - QList<QGraphicsItem *> itemList; - QSet<QGraphicsItem *> tmp; - bool simpleTransform = worldTransform.type() <= QTransform::TxScale; - - extern QPainterPath qt_regionToPath(const QRegion ®ion); - QPainterPath path = qt_regionToPath(exposedRegion); - *allItems = path.contains(q->mapFromScene(scene->d_func()->growingItemsBoundingRect).boundingRect()); - QList<QRectF> exposedRects; - QList<QPolygonF> exposedPolys; - - // Transform the exposed viewport rects to scene rects or polygons - foreach (const QRect &rect, exposedRegion.rects()) { - QPolygonF exposedPoly = q->mapToScene(rect.adjusted(-1, -1, 1, 1)); - QRectF exposedRect = exposedPoly.boundingRect(); - if (!simpleTransform) - exposedPolys << exposedPoly; - exposedRects << exposedRect; - } - - // Find which items need to be drawn. - if (*allItems) { + + // Step 1) If all items are contained within the expose region, then + // return a list of all visible items. + const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 2, 2)) + .boundingRect(); + if (exposedRegionSceneBounds.contains(scene->d_func()->growingItemsBoundingRect)) { + Q_ASSERT(allItems); + *allItems = true; + // All items are guaranteed within the exposed region, don't bother using the index. - foreach (QGraphicsItem *item, scene->items()) { + QList<QGraphicsItem *> itemList(scene->items()); + int i = 0; + while (i < itemList.size()) { // But we only want to include items that are visible - if (item->isVisible()) - itemList << item; - } - } else if (simpleTransform) { - // Simple rect lookups will do. - if (exposedRects.size() > 1) { - foreach (const QRectF &rect, exposedRects) { - foreach (QGraphicsItem *item, scene->d_func()->items_helper(rect, Qt::IntersectsItemBoundingRect, Qt::SortOrder(-1) /* don't sort */)) { - if (!tmp.contains(item)) { - tmp << item; - itemList << item; - } - } - } - } else { - itemList += scene->d_func()->items_helper(exposedRects[0], Qt::IntersectsItemBoundingRect, Qt::SortOrder(-1) /* don't sort */); - } - } else { - // Polygon lookup is necessary. - if (exposedRects.size() > 1) { - foreach (const QPolygonF &poly, exposedPolys) { - foreach (QGraphicsItem *item, scene->d_func()->items_helper(poly, Qt::IntersectsItemBoundingRect, Qt::SortOrder(-1) /* don't sort */)) { - if (!tmp.contains(item)) { - tmp << item; - itemList << item; - } - } - } - } else { - itemList += scene->d_func()->items_helper(exposedPolys[0], Qt::IntersectsItemBoundingRect, Qt::SortOrder(-1) /* don't sort */); + if (!itemList.at(i)->isVisible()) + itemList.removeAt(i); + else + ++i; } + + // Sort the items. + QGraphicsScenePrivate::sortItems(&itemList, Qt::DescendingOrder, scene->d_func()->sortCacheEnabled); + return itemList; } - // Check for items that ignore inherited transformations, and add them if - // necessary. - QRectF untr = scene->d_func()->largestUntransformableItem; - if (!*allItems && !untr.isNull()) { - // Map the largest untransformable item subtree boundingrect from view - // to scene coordinates, and use this to expand all exposed rects in - // search for untransformable items. - QRectF ltri = matrix.inverted().mapRect(untr); - ltri.adjust(-untr.width(), -untr.height(), untr.width(), untr.height()); - - foreach (const QRect &rect, exposedRegion.rects()) { - QRectF exposed = q->mapToScene(rect.adjusted(-1, -1, 1, 1)).boundingRect(); - exposed.adjust(-ltri.width(), -ltri.height(), ltri.width(), ltri.height()); - - foreach (QGraphicsItem *item, scene->d_func()->estimateItemsInRect(exposed)) { - if (item->d_ptr->itemIsUntransformable()) { - if (!tmp.contains(item)) { - QPainterPath rectPath; - rectPath.addRect(rect); - QPainterPath path = item->deviceTransform(q->viewportTransform()).inverted().map(rectPath); - if (item->collidesWithPath(path, Qt::IntersectsItemBoundingRect)) { - itemList << item; - tmp << item; - } - } - } - } - } + // Step 2) If the expose region is a simple rect and the view is only + // translated or scaled, search for items using + // QGraphicsScene::items(QRectF). + bool simpleRectLookup = (scene->d_func()->largestUntransformableItem.isNull() + && exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale); + if (simpleRectLookup) { + return scene->d_func()->items_helper(exposedRegionSceneBounds, + Qt::IntersectsItemBoundingRect, + Qt::DescendingOrder); } - tmp.clear(); - // Sort the items. - QGraphicsScenePrivate::sortItems(&itemList, Qt::DescendingOrder, - scene->d_func()->sortCacheEnabled); + // If the region is complex or the view has a complex transform, adjust + // the expose region, convert it to a path, and then search for items + // using QGraphicsScene::items(QPainterPath); + QRegion adjustedRegion; + foreach (const QRect &r, exposedRegion.rects()) + adjustedRegion += r.adjusted(-1, -1, 1, 1); + + const QPainterPath exposedPath(qt_regionToPath(adjustedRegion)); + if (scene->d_func()->largestUntransformableItem.isNull()) { + const QPainterPath exposedScenePath(q->mapToScene(exposedPath)); + return scene->d_func()->items_helper(exposedScenePath, + Qt::IntersectsItemBoundingRect, + Qt::DescendingOrder); + } - return itemList; + // NB! Path must be in viewport coordinates. + return itemsInArea(exposedPath, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder); } void QGraphicsViewPrivate::generateStyleOptions(const QList<QGraphicsItem *> &itemList, @@ -2224,7 +2213,8 @@ QList<QGraphicsItem *> QGraphicsView::items() const certainly room for improvement. */ QList<QGraphicsItem *> QGraphicsViewPrivate::itemsInArea(const QPainterPath &path, - Qt::ItemSelectionMode mode) const + Qt::ItemSelectionMode mode, + Qt::SortOrder order) const { Q_Q(const QGraphicsView); @@ -2274,8 +2264,8 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::itemsInArea(const QPainterPath &pat } // ### Insertion sort would be faster. - QGraphicsScenePrivate::sortItems(&result, Qt::AscendingOrder, - scene->d_func()->sortCacheEnabled); + if (order != Qt::SortOrder(-1)) + QGraphicsScenePrivate::sortItems(&result, order, scene->d_func()->sortCacheEnabled); return result; } @@ -3280,7 +3270,7 @@ void QGraphicsView::mouseMoveEvent(QMouseEvent *event) } // Update old rubberband - if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate && !d->rubberBandRect.isNull()) { + if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate && !d->rubberBandRect.isEmpty()) { if (d->viewportUpdateMode != FullViewportUpdate) viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect)); else @@ -3462,7 +3452,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) QPainter painter(viewport()); QTransform original = painter.worldTransform(); #ifndef QT_NO_RUBBERBAND - if (d->rubberBanding && !d->rubberBandRect.isNull()) + if (d->rubberBanding && !d->rubberBandRect.isEmpty()) painter.save(); #endif // Set up render hints @@ -3481,7 +3471,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // Find all exposed items bool allItems = false; - QList<QGraphicsItem *> itemList = d->findItems(exposedRegion, viewTransform, &allItems); + QList<QGraphicsItem *> itemList = d->findItems(exposedRegion, &allItems); #ifdef QGRAPHICSVIEW_DEBUG int exposedTime = stopWatch.elapsed(); @@ -3557,7 +3547,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) #ifndef QT_NO_RUBBERBAND // Rubberband - if (d->rubberBanding && !d->rubberBandRect.isNull()) { + if (d->rubberBanding && !d->rubberBandRect.isEmpty()) { painter.restore(); QStyleOptionRubberBand option; option.initFrom(viewport()); @@ -3631,30 +3621,30 @@ void QGraphicsView::scrollContentsBy(int dx, int dy) if (isRightToLeft()) dx = -dx; - if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate - && d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) { - for (int i = 0; i < d->dirtyRects.size(); ++i) - d->dirtyRects[i].translate(dx, dy); - for (int i = 0; i < d->dirtyRegions.size(); ++i) - d->dirtyRegions[i].translate(dx, dy); - } - + if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) { + if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) { + for (int i = 0; i < d->dirtyRects.size(); ++i) + d->dirtyRects[i].translate(dx, dy); + for (int i = 0; i < d->dirtyRegions.size(); ++i) + d->dirtyRegions[i].translate(dx, dy); + if (d->accelerateScrolling) { #ifndef QT_NO_RUBBERBAND - // Update old rubberband - if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate && !d->rubberBandRect.isNull()) { - if (d->viewportUpdateMode != FullViewportUpdate) - viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect)); - else - viewport()->update(); - } + // Update new and old rubberband regions + if (!d->rubberBandRect.isEmpty()) { + QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect)); + rubberBandRegion += rubberBandRegion.translated(-dx, -dy); + viewport()->update(rubberBandRegion); + } #endif - - if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate){ - if (d->accelerateScrolling && d->viewportUpdateMode != FullViewportUpdate) - viewport()->scroll(dx, dy); - else + viewport()->scroll(dx, dy); + } else { + viewport()->update(); + } + } else { viewport()->update(); + } } + d->updateLastCenterPoint(); if ((d->cacheMode & CacheBackground) diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 2109673..a76279e 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -85,7 +85,8 @@ public: qint64 verticalScroll() const; QList<QGraphicsItem *> itemsInArea(const QPainterPath &path, - Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, + Qt::SortOrder = Qt::AscendingOrder) const; QPointF mousePressItemPoint; QPointF mousePressScenePoint; @@ -172,9 +173,7 @@ public: void updateRegion(const QRegion ®ion); bool updateSceneSlotReimplementedChecked; - QList<QGraphicsItem *> findItems(const QRegion &exposedRegion, - const QTransform &worldTransform, - bool *allItems) const; + QList<QGraphicsItem *> findItems(const QRegion &exposedRegion, bool *allItems) const; void generateStyleOptions(const QList<QGraphicsItem *> &itemList, QGraphicsItem **itemArray, diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 5cc18f9..7f02fb9 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -366,32 +366,33 @@ void QGraphicsWidget::resize(const QSizeF &size) void QGraphicsWidget::setGeometry(const QRectF &rect) { QGraphicsWidgetPrivate *wd = QGraphicsWidget::d_func(); - const QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr; - setAttribute(Qt::WA_Resized); - QRectF newGeom = rect; - newGeom.setSize(rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize)) - .boundedTo(effectiveSizeHint(Qt::MaximumSize))); - if (newGeom == d->geom) - return; - - // Update and prepare to change the geometry (remove from index). - if (wd->scene) { - if (rect.topLeft() != d->geom.topLeft()) - wd->fullUpdateHelper(true); - else - update(); - } - prepareGeometryChange(); - - // setPos triggers ItemPositionChange, which can adjust position + QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr; + QRectF newGeom; QPointF oldPos = d->geom.topLeft(); - wd->inSetGeometry = 1; - wd->setPosHelper(newGeom.topLeft(), /* update = */ false); - wd->inSetGeometry = 0; - newGeom.moveTopLeft(pos()); - - if (newGeom == d->geom) - return; + if (!wd->inSetPos) { + setAttribute(Qt::WA_Resized); + newGeom = rect; + newGeom.setSize(rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize)) + .boundedTo(effectiveSizeHint(Qt::MaximumSize))); + if (newGeom == d->geom) + return; + + // setPos triggers ItemPositionChange, which can adjust position + wd->inSetGeometry = 1; + wd->setPosHelper(newGeom.topLeft()); + wd->inSetGeometry = 0; + newGeom.moveTopLeft(pos()); + + if (newGeom == d->geom) + return; + + // Update and prepare to change the geometry (remove from index) if the size has changed. + if (wd->scene) { + if (rect.topLeft() == d->geom.topLeft()) { + prepareGeometryChange(); + } + } + } // Update the layout item geometry bool moved = oldPos != pos(); @@ -401,6 +402,11 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) event.setOldPos(oldPos); event.setNewPos(pos()); QApplication::sendEvent(this, &event); + if (wd->inSetPos) { + //set the new pos + d->geom.moveTopLeft(pos()); + return; + } } QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); @@ -1016,9 +1022,11 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant & break; case ItemPositionHasChanged: if (!d->inSetGeometry) { + d->inSetPos = 1; // Ensure setGeometry is called (avoid recursion when setPos is // called from within setGeometry). setGeometry(QRectF(pos(), size())); + d->inSetPos = 0 ; } break; case ItemParentChange: { @@ -1269,6 +1277,8 @@ bool QGraphicsWidget::event(QEvent *event) break; case QEvent::Polish: polishEvent(); + d->polished = true; + d->updateFont(d->font); break; case QEvent::WindowActivate: case QEvent::WindowDeactivate: diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 641409d..789f8da 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -274,6 +274,8 @@ void QGraphicsWidgetPrivate::updateFont(const QFont &font) } } + if (!polished) + return; // Notify change. QEvent event(QEvent::FontChange); QApplication::sendEvent(q, &event); diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index afa6812..53eaa31 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -85,6 +85,8 @@ public: inheritedPaletteResolveMask(0), inheritedFontResolveMask(0), inSetGeometry(0), + polished(0), + inSetPos(0), focusPolicy(Qt::NoFocus), focusNext(0), focusPrev(0), @@ -193,6 +195,8 @@ public: } quint32 attributes : 10; quint32 inSetGeometry : 1; + quint32 polished: 1; + quint32 inSetPos : 1; // Focus Qt::FocusPolicy focusPolicy; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 558d574..c7a20db 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3607,6 +3607,9 @@ int QImage::pixelIndex(int x, int y) const If the \a position is not valid, the results are undefined. + \warning This function is expensive when used for massive pixel + manipulations. + \sa setPixel(), valid(), {QImage#Pixel Manipulation}{Pixel Manipulation} */ @@ -4937,10 +4940,12 @@ int QImage::dotsPerMeterY() const meter, to \a x. Together with dotsPerMeterY(), this number defines the intended - scale and aspect ratio of the image. + scale and aspect ratio of the image, and determines the scale + at which QPainter will draw graphics on the image. It does not + change the scale or aspect ratio of the image when it is rendered + on other paint devices. - \sa dotsPerMeterX(), {QImage#Image Information}{Image - Information} + \sa dotsPerMeterX(), {QImage#Image Information}{Image Information} */ void QImage::setDotsPerMeterX(int x) { @@ -4957,10 +4962,12 @@ void QImage::setDotsPerMeterX(int x) to \a y. Together with dotsPerMeterX(), this number defines the intended - scale and aspect ratio of the image. + scale and aspect ratio of the image, and determines the scale + at which QPainter will draw graphics on the image. It does not + change the scale or aspect ratio of the image when it is rendered + on other paint devices. - \sa dotsPerMeterY(), {QImage#Image Information}{Image - Information} + \sa dotsPerMeterY(), {QImage#Image Information}{Image Information} */ void QImage::setDotsPerMeterY(int y) { @@ -5577,6 +5584,8 @@ bool QImage::isDetached() const Use one of the composition mods in QPainter::CompositionMode instead. + \warning This function is expensive. + \sa alphaChannel(), {QImage#Image Transformations}{Image Transformations}, {QImage#Image Formats}{Image Formats} */ @@ -5659,6 +5668,11 @@ void QImage::setAlphaChannel(const QImage &alphaChannel) \l{QPixmap::}{alphaChannel()}, which works in the same way as this function on QPixmaps. + Most usecases for this function can be replaced with QPainter and + using composition modes. + + \warning This is an expensive function. + \sa setAlphaChannel(), hasAlphaChannel(), {QPixmap#Pixmap Information}{Pixmap}, {QImage#Image Transformations}{Image Transformations} diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 6b74323..33e565c 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -100,7 +100,9 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool is bmi.blueMask = 0; } - hdc = CreateCompatibleDC(qt_win_display_dc()); + HDC display_dc = GetDC(0); + hdc = CreateCompatibleDC(display_dc); + ReleaseDC(0, display_dc); Q_ASSERT(hdc); uchar *bits = 0; diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp index cba9827..a130a1a 100644 --- a/src/gui/image/qpaintengine_pic.cpp +++ b/src/gui/image/qpaintengine_pic.cpp @@ -346,7 +346,7 @@ void QPicturePaintEngine::writeCmdLength(int pos, const QRectF &r, bool corr) if (corr) { // widen bounding rect int w2 = painter()->pen().width() / 2; br.setCoords(br.left() - w2, br.top() - w2, - br.right() + w2, br.bottom() + w2); + br.right() + w2, br.bottom() + w2); } br = painter()->transform().mapRect(br); if (painter()->hasClipping()) { @@ -458,6 +458,25 @@ void QPicturePaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap writeCmdLength(pos, r, false); } +void QPicturePaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr, + Qt::ImageConversionFlags flags) +{ + Q_D(QPicturePaintEngine); +#ifdef QT_PICTURE_DEBUG + qDebug() << " -> drawImage():" << r << sr; +#endif + int pos; + SERIALIZE_CMD(QPicturePrivate::PdcDrawImage); + if (d->pic_d->in_memory_only) { + int index = d->pic_d->image_list.size(); + d->pic_d->image_list.append(image); + d->s << r << index << sr << (quint32) flags; + } else { + d->s << r << image << sr << (quint32) flags; + } + writeCmdLength(pos, r, false); +} + extern int qt_defaultDpi(); void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h index 3ae0845..745d057 100644 --- a/src/gui/image/qpaintengine_pic_p.h +++ b/src/gui/image/qpaintengine_pic_p.h @@ -100,6 +100,8 @@ public: void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); + void drawImage(const QRectF &r, const QImage &image, const QRectF &sr, + Qt::ImageConversionFlags flags = Qt::AutoColor); void drawTextItem(const QPointF &p, const QTextItem &ti); Type type() const { return Picture; } diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index d5d7cb0..92023e0 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -759,13 +759,21 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) QImage image; if (d->formatMajor < 4) { s >> p >> image; - painter->drawPixmap(p, QPixmap::fromImage(image)); + painter->drawImage(p, image); } else if (d->formatMajor <= 5){ s >> ir >> image; - painter->drawPixmap(ir, QPixmap::fromImage(image), QRect(0, 0, ir.width(), ir.height())); + painter->drawImage(ir, image, QRect(0, 0, ir.width(), ir.height())); } else { - s >> r >> image; - painter->drawPixmap(r, QPixmap::fromImage(image), QRectF(0, 0, r.width(), r.height())); + QRectF sr; + if (d->in_memory_only) { + int index; + s >> r >> index >> sr >> ul; + Q_ASSERT(index < d->image_list.size()); + image = d->image_list.at(index); + } else { + s >> r >> image >> sr >> ul; + } + painter->drawImage(r, image, sr, Qt::ImageConversionFlags(ul)); } } break; diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h index 1da7f07..a3fd34f 100644 --- a/src/gui/image/qpicture_p.h +++ b/src/gui/image/qpicture_p.h @@ -158,6 +158,7 @@ public: QRect override_rect; QPaintEngine *paintEngine; bool in_memory_only; + QList<QImage> image_list; QList<QPixmap> pixmap_list; QList<QBrush> brush_list; QList<QPen> pen_list; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 8684a1b..efb8260 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -674,7 +674,7 @@ void QPixmap::resize_helper(const QSize &s) pixels black. The effect of this function is undefined when the pixmap is being painted on. - This is potentially an expensive operation. + \warning This is potentially an expensive operation. \sa mask(), {QPixmap#Pixmap Transformations}{Pixmap Transformations}, QBitmap @@ -1380,6 +1380,12 @@ void QPixmap::deref() If the given \a size is empty, this function returns a null pixmap. + + In some cases it can be more beneficial to draw the pixmap to a + painter with a scale set rather than scaling the pixmap. This is + the case when the painter is for instance based on OpenGL or when + the scale factor changes rapidly. + \sa isNull(), {QPixmap#Pixmap Transformations}{Pixmap Transformations} @@ -1751,6 +1757,10 @@ int QPixmap::metric(PaintDeviceMetric metric) const The effect of this function is undefined when the pixmap is being painted on. + \warning This is potentially an expensive operation. Most usecases + for this function are covered by QPainter and compositionModes + which will normally execute faster. + \sa alphaChannel(), {QPixmap#Pixmap Transformations}{Pixmap Transformations} */ @@ -1793,6 +1803,9 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) \image alphachannelimage.png The pixmap and channelImage QPixmaps + \warning This is an expensive operation. The alpha channel of the + pixmap is extracted dynamically from the pixeldata. + \sa setAlphaChannel(), {QPixmap#Pixmap Information}{Pixmap Information} */ @@ -1814,7 +1827,8 @@ QPaintEngine *QPixmap::paintEngine() const Extracts a bitmap mask from the pixmap's alphachannel. - This is potentially an expensive operation. + \warning This is potentially an expensive operation. The mask of + the pixmap is extracted dynamically from the pixeldata. \sa setMask(), {QPixmap#Pixmap Information}{Pixmap Information} */ diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index bfc605b..26d9618 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -303,7 +303,7 @@ void QMacPixmapData::fromImage(const QImage &img, else one_bit = one_bit >> (x % 8); if ((one_bit & 0x01)) - *(drow+x) = 0x00000000; + *(drow+x) = 0xFF000000; else *(drow+x) = 0xFFFFFFFF; } diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index d758221..ff7c1b6 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1288,6 +1288,12 @@ void QX11PixmapData::setMask(const QBitmap &newmask) 0, 0, 0, 0, 0, 0, w, h); release(); *this = newData; + // the new QX11PixmapData object isn't referenced yet, so + // ref it + ref.ref(); + + // the below is to make sure the QX11PixmapData destructor + // doesn't delete our newly created render picture newData.hd = 0; newData.x11_mask = 0; newData.picture = 0; diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 2e4da40..7296426 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -109,6 +109,7 @@ protected: private: friend class QPixmap; friend class QGLContextPrivate; + friend class QX11PixmapData; QAtomicInt ref; int detach_no; diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp index 720f0b8..e3e8aa4 100644 --- a/src/gui/inputmethod/qwininputcontext_win.cpp +++ b/src/gui/inputmethod/qwininputcontext_win.cpp @@ -57,15 +57,17 @@ #ifdef Q_IME_DEBUG #include "qdebug.h" -#endif - -QT_BEGIN_NAMESPACE +#endif -extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); #if defined(Q_OS_WINCE) extern void qt_wince_show_SIP(bool show); // defined in qguifunctions_wince.cpp #endif +QT_BEGIN_NAMESPACE + +extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); + + DEFINE_GUID(IID_IActiveIMMApp, 0x08c0e040, 0x62d1, 0x11d1, 0x93, 0x26, 0x0, 0x60, 0xb0, 0x67, 0xb8, 0x6e); diff --git a/src/gui/inputmethod/qximinputcontext_p.h b/src/gui/inputmethod/qximinputcontext_p.h index ca2103b..3773122 100644 --- a/src/gui/inputmethod/qximinputcontext_p.h +++ b/src/gui/inputmethod/qximinputcontext_p.h @@ -98,6 +98,7 @@ public: QString text; QBitArray selectedChars; bool composing; + bool preeditEmpty; void clear(); }; diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp index 2fbe86f..c320fb4 100644 --- a/src/gui/inputmethod/qximinputcontext_x11.cpp +++ b/src/gui/inputmethod/qximinputcontext_x11.cpp @@ -264,6 +264,7 @@ extern "C" { qic->standardFormat(QInputContext::PreeditFormat)); attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor, sellen ? 0 : 1, QVariant()); QInputMethodEvent e(data->text, attrs); + data->preeditEmpty = data->text.isEmpty(); qic->sendEvent(e); return 0; @@ -286,11 +287,14 @@ void QXIMInputContext::ICData::clear() text = QString(); selectedChars.clear(); composing = false; + preeditEmpty = true; } QXIMInputContext::ICData *QXIMInputContext::icData() const { - return ximData.value(focusWidget()->effectiveWinId()); + if (QWidget *w = focusWidget()) + return ximData.value(w->effectiveWinId()); + return 0; } /* The cache here is needed, as X11 leaks a few kb for every XFreeFontSet call, so we avoid creating and deletion of fontsets as @@ -433,7 +437,8 @@ void QXIMInputContext::create_xim() // reinitialize input context after the input method // server (like SCIM) has been launched without // requiring the user to manually switch focus. - if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) + if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled) + && focusWidget->testAttribute(Qt::WA_WState_Created)) setFocusWidget(focusWidget); } // following code fragment is not required for immodule @@ -531,12 +536,14 @@ void QXIMInputContext::reset() if (data->ic) { char *mb = XmbResetIC(data->ic); + QInputMethodEvent e; if (mb) { - QInputMethodEvent e; e.setCommitString(QString::fromLocal8Bit(mb)); - sendEvent(e); XFree(mb); - + data->preeditEmpty = false; // force sending an event + } + if (!data->preeditEmpty) { + sendEvent(e); update(); } } @@ -562,12 +569,14 @@ void QXIMInputContext::mouseHandler(int pos, QMouseEvent *e) return; XIM_DEBUG("QXIMInputContext::mouseHandler pos=%d", pos); - ICData *data = ximData.value(focusWidget()->effectiveWinId()); - if (!data) - return; - if (pos < 0 || pos > data->text.length()) - reset(); - // ##### handle mouse position + if (QWidget *w = focusWidget()) { + ICData *data = ximData.value(w->effectiveWinId()); + if (!data) + return; + if (pos < 0 || pos > data->text.length()) + reset(); + // ##### handle mouse position + } } bool QXIMInputContext::isComposing() const @@ -683,6 +692,7 @@ QXIMInputContext::ICData *QXIMInputContext::createICData(QWidget *w) { ICData *data = new ICData; data->widget = w; + data->preeditEmpty = true; XVaNestedList preedit_attr = 0; XIMCallback startcallback, drawcallback, donecallback; diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index c7ba95d..55b3a03 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1374,6 +1374,11 @@ bool QAbstractItemView::event(QEvent *event) { Q_D(QAbstractItemView); switch (event->type()) { + case QEvent::Paint: + //we call this here because the scrollbars' visibility might be altered + //so this can't be done in the paintEvent method + d->executePostedLayout(); //make sure we set the layout properly + break; case QEvent::Show: { d->executePostedLayout(); //make sure we set the layout properly @@ -1395,6 +1400,9 @@ bool QAbstractItemView::event(QEvent *event) case QEvent::FocusOut: d->checkPersistentEditorFocus(); break; + case QEvent::FontChange: + d->doDelayedItemsLayout(); // the size of the items will change + break; default: break; } @@ -1501,12 +1509,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event) // when the user is interacting with it (ie. clicking on it) bool autoScroll = d->autoScroll; d->autoScroll = false; - // setSelection will update the current item too - // and it seems that the two updates are not merged - bool updates = d->viewport->updatesEnabled(); - d->viewport->setUpdatesEnabled(command == QItemSelectionModel::NoUpdate); d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); - d->viewport->setUpdatesEnabled(updates); d->autoScroll = autoScroll; QRect rect(d->pressedPosition - offset, pos); setSelection(rect, command); diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 0aad6bb..bf9b5c5 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -291,6 +291,18 @@ QSizeF QItemDelegatePrivate::doTextLayout(int lineWidth) const setModelData(), and updateEditorGeometry(). This process is described in the \l{Spin Box Delegate Example}. + \section1 QStyledItemDelegate vs. QItemDelegate + + Since Qt 4.4, there are two delegate classes: QItemDelegate and + QStyledItemDelegate. However, the default delegate is QStyledItemDelegate. + These two classes are independent alternatives to painting and providing + editors for items in views. The difference between them is that + QStyledItemDelegate uses the current style to paint its items. We therefore + recommend using QStyledItemDelegate as the base class when implementing + custom delegates or when working with Qt style sheets. The code required + for either class should be equal unless the custom delegate needs to use + the style for drawing. + \sa {Delegate Classes}, QStyledItemDelegate, QAbstractItemDelegate, {Spin Box Delegate Example}, {Settings Editor Example}, {Icons Example} diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index d2fec21..07f0a38 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -2854,7 +2854,7 @@ void QDynamicListViewBase::addLeaf(QVector<int> &leaf, const QRect &area, continue; vi = &_this->dynamicListView->items[idx]; Q_ASSERT(vi); - if (vi->rect().intersects(area) && vi->visited != visited) { + if (vi->isValid() && vi->rect().intersects(area) && vi->visited != visited) { QModelIndex index = _this->listViewItemToIndex(*vi); Q_ASSERT(index.isValid()); _this->intersectVector.append(index); diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index b3993c7..91431c4 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1032,9 +1032,21 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc } } - if (!source_rows_remove.isEmpty()) + if (!source_rows_remove.isEmpty()) { remove_source_items(m->proxy_rows, m->source_rows, source_rows_remove, source_parent, Qt::Vertical); + QSet<int> source_rows_remove_set = source_rows_remove.toList().toSet(); + QVector<QModelIndex>::iterator it = m->mapped_children.begin(); + while (it != m->mapped_children.end()) { + const QModelIndex source_child_index = *it; + if (source_rows_remove_set.contains(source_child_index.row())) { + it = m->mapped_children.erase(it); + remove_from_mapping(source_child_index); + } else { + ++it; + } + } + } if (!source_rows_resort.isEmpty()) { // Re-sort the rows @@ -1103,6 +1115,8 @@ void QSortFilterProxyModelPrivate::_q_sourceReset() // All internal structures are deleted in clear() q->reset(); update_source_sort_column(); + if (dynamic_sortfilter) + sort(); } void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged() @@ -1495,6 +1509,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) d->clear_mapping(); reset(); + d->update_source_sort_column(); } /*! @@ -1566,6 +1581,10 @@ bool QSortFilterProxyModel::hasChildren(const QModelIndex &parent) const return false; if (!d->model->hasChildren(source_parent)) return false; + + if (d->model->canFetchMore(source_parent)) + return true; //we assume we might have children that can be fetched + QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value(); return m->source_rows.count() != 0 && m->source_columns.count() != 0; } @@ -1893,7 +1912,7 @@ QSize QSortFilterProxyModel::span(const QModelIndex &index) const void QSortFilterProxyModel::sort(int column, Qt::SortOrder order) { Q_D(QSortFilterProxyModel); - if (d->proxy_sort_column == column && d->sort_order == order) + if (d->dynamic_sortfilter && d->proxy_sort_column == column && d->sort_order == order) return; d->sort_order = order; d->proxy_sort_column = column; @@ -2107,6 +2126,8 @@ void QSortFilterProxyModel::setDynamicSortFilter(bool enable) { Q_D(QSortFilterProxyModel); d->dynamic_sortfilter = enable; + if (enable) + d->sort(); } /*! diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp index 271cc0d..be0971b 100644 --- a/src/gui/itemviews/qstyleditemdelegate.cpp +++ b/src/gui/itemviews/qstyleditemdelegate.cpp @@ -218,16 +218,17 @@ public: The \l{Star Delegate Example}{Star Delegate} example creates editors by reimplementing these methods. - \section1 QStyledItemDelegate and QItemDelegate - - QStyledItemDelegate has taken over the job as default delegate - - leaving QItemDelegate behind. They will now co-exist peacefully as - independent alternatives to painting and providing editors for - items in views. The difference between them is that the new - delegate uses the current style to paint its items. We therefore - recommend using QStyledItemDelegate as base when implementing - custom delegates. The code required should be equal unless the - custom delegate also wishes to use the style for drawing. + \section1 QStyledItemDelegate vs. QItemDelegate + + Since Qt 4.4, there are two delegate classes: QItemDelegate and + QStyledItemDelegate. However, the default delegate is QStyledItemDelegate. + These two classes are independent alternatives to painting and providing + editors for items in views. The difference between them is that + QStyledItemDelegate uses the current style to paint its items. We therefore + recommend using QStyledItemDelegate as the base class when implementing + custom delegates or when working with Qt style sheets. The code required + for either class should be equal unless the custom delegate needs to use + the style for drawing. If you wish to customize the painting of item views, you should implement a custom style. Please see the QStyle class diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 34bb180..2902768 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -320,26 +320,12 @@ QRect QTableViewPrivate::visualSpanRect(const Span &span) const \a drawn is a QBitArray of visualRowCountxvisualCoulumnCount which say if particular cell has been drawn */ void QTableViewPrivate::drawAndClipSpans(const QRect &area, QPainter *painter, - const QStyleOptionViewItemV4 &option, - QBitArray *drawn) + const QStyleOptionViewItemV4 &option, QBitArray *drawn, + int firstVisualRow, int lastVisualRow, int firstVisualColumn, int lastVisualColumn) { bool alternateBase = false; QRegion region = viewport->rect(); - int firstVisualRow = qMax(verticalHeader->visualIndexAt(0),0); - int lastVisualRow = verticalHeader->visualIndexAt(viewport->height()); - if (lastVisualRow == -1) - lastVisualRow = model->rowCount(root) - 1; - - int firstVisualColumn = horizontalHeader->visualIndexAt(0); - int lastVisualColumn = horizontalHeader->visualIndexAt(viewport->width()); - if (q_func()->isRightToLeft()) - qSwap(firstVisualColumn, lastVisualColumn); - if (firstVisualColumn == -1) - firstVisualColumn = 0; - if (lastVisualColumn == -1) - lastVisualColumn = model->columnCount(root) - 1; - QList<Span>::const_iterator it; for (it = spans.constBegin(); it != spans.constEnd(); ++it) { Span span = *it; @@ -768,10 +754,13 @@ void QTableView::paintEvent(QPaintEvent *event) uint y = verticalHeader->length() - verticalHeader->offset() - 1; QVector<QRect> rects = event->region().rects(); + + //firstVisualRow is the visual index of the first visible row. lastVisualRow is the visual index of the last visible Row. + //same goes for ...VisualColumn int firstVisualRow = qMax(verticalHeader->visualIndexAt(0),0); int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->viewport()->height()); if (lastVisualRow == -1) - lastVisualRow = d->model->rowCount(d->root); + lastVisualRow = d->model->rowCount(d->root) - 1; int firstVisualColumn = horizontalHeader->visualIndexAt(0); int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->viewport()->width()); @@ -795,7 +784,8 @@ void QTableView::paintEvent(QPaintEvent *event) } if (d->hasSpans()) - d->drawAndClipSpans(dirtyArea, &painter, option, &drawn); + d->drawAndClipSpans(dirtyArea, &painter, option, &drawn, + firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn); // get the horizontal start and end visual sections int left = horizontalHeader->visualIndexAt(dirtyArea.left()); diff --git a/src/gui/itemviews/qtableview_p.h b/src/gui/itemviews/qtableview_p.h index a1c1152..b08eabd 100644 --- a/src/gui/itemviews/qtableview_p.h +++ b/src/gui/itemviews/qtableview_p.h @@ -103,7 +103,8 @@ public: bool spansIntersectColumns(const QList<int> &columns) const; bool spansIntersectRows(const QList<int> &rows) const; void drawAndClipSpans(const QRect &area, QPainter *painter, - const QStyleOptionViewItemV4 &option, QBitArray *drawn); + const QStyleOptionViewItemV4 &option, QBitArray *drawn, + int firstVisualRow, int lastVisualRow, int firstVisualColumn, int lastVisualColumn); void drawCell(QPainter *painter, const QStyleOptionViewItemV4 &option, const QModelIndex &index); bool showGrid; diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 943b194..62c1277 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1239,16 +1239,23 @@ bool QTreeView::viewportEvent(QEvent *event) int oldBranch = d->hoverBranch; d->hoverBranch = d->itemDecorationAt(he->pos()); if (oldBranch != d->hoverBranch) { - QRect oldRect = visualRect(d->modelIndex(oldBranch)); - QRect newRect = visualRect(d->modelIndex(d->hoverBranch)); - viewport()->update(oldRect.left() - d->indent, oldRect.top(), d->indent, oldRect.height()); - viewport()->update(newRect.left() - d->indent, newRect.top(), d->indent, newRect.height()); + QModelIndex oldIndex = d->modelIndex(oldBranch), + newIndex = d->modelIndex(d->hoverBranch); + if (oldIndex != newIndex) { + QRect oldRect = visualRect(oldIndex); + QRect newRect = visualRect(newIndex); + viewport()->update(oldRect.left() - d->indent, oldRect.top(), d->indent, oldRect.height()); + viewport()->update(newRect.left() - d->indent, newRect.top(), d->indent, newRect.height()); + } } if (selectionBehavior() == QAbstractItemView::SelectRows) { - QRect oldHoverRect = visualRect(d->hover); - QRect newHoverRect = visualRect(indexAt(he->pos())); - viewport()->update(QRect(0, newHoverRect.y(), viewport()->width(), newHoverRect.height())); - viewport()->update(QRect(0, oldHoverRect.y(), viewport()->width(), oldHoverRect.height())); + QModelIndex newHoverIndex = indexAt(he->pos()); + if (d->hover != newHoverIndex) { + QRect oldHoverRect = visualRect(d->hover); + QRect newHoverRect = visualRect(newHoverIndex); + viewport()->update(QRect(0, newHoverRect.y(), viewport()->width(), newHoverRect.height())); + viewport()->update(QRect(0, oldHoverRect.y(), viewport()->width(), oldHoverRect.height())); + } } break; } default: @@ -1377,7 +1384,7 @@ void QTreeView::drawTree(QPainter *painter, const QRegion ®ion) const // start at the top of the viewport and iterate down to the update area for (; i < viewItems.count(); ++i) { const int itemHeight = d->itemHeight(i); - if (y + itemHeight >= area.top()) + if (y + itemHeight > area.top()) break; y += itemHeight; } @@ -2012,6 +2019,7 @@ int QTreeView::verticalOffset() const // If we are scrolling per item and have non-uniform row heights, // finding the vertical offset in pixels is going to be relatively slow. // ### find a faster way to do this + d->executePostedLayout(); int offset = 0; for (int i = 0; i < d->viewItems.count(); ++i) { if (i == verticalScrollBar()->value()) @@ -2307,11 +2315,12 @@ void QTreeView::scrollContentsBy(int dx, int dy) } } - if (d->viewItems.isEmpty() || d->defaultItemHeight == 0) + const int itemHeight = d->defaultItemHeight <= 0 ? sizeHintForRow(0) : d->defaultItemHeight; + if (d->viewItems.isEmpty() || itemHeight == 0) return; // guestimate the number of items in the viewport - int viewCount = d->viewport->height() / d->defaultItemHeight; + int viewCount = d->viewport->height() / itemHeight; int maxDeltaY = qMin(d->viewItems.count(), viewCount); // no need to do a lot of work if we are going to redraw the whole thing anyway if (qAbs(dy) > qAbs(maxDeltaY) && d->editors.isEmpty()) { @@ -2558,8 +2567,11 @@ void QTreeView::sortByColumn(int column, Qt::SortOrder order) { Q_D(QTreeView); - //will emit a signal connected to _q_sortIndicatorChanged, which then actually sorts + //If sorting is enabled will emit a signal connected to _q_sortIndicatorChanged, which then actually sorts d->header->setSortIndicator(column, order); + //If sorting is not enabled, force to sort now. + if (!d->sortingEnabled) + d->model->sort(column, order); } /*! @@ -3496,6 +3508,7 @@ void QTreeViewPrivate::updateScrollBars() int QTreeViewPrivate::itemDecorationAt(const QPoint &pos) const { + const_cast<QTreeView *>(q_func())->executeDelayedItemsLayout(); int x = pos.x(); int column = header->logicalIndexAt(x); if (column != 0) diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 357153d..6103225 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -2951,18 +2951,21 @@ QWidget *QTreeWidget::itemWidget(QTreeWidgetItem *item, int column) const /*! \since 4.1 - Sets the given \a widget to be displayed in the cell specified by - the given \a item and \a column. - - Note that the given \a widget's \l {QWidget}{autoFillBackground} - property must be set to true, otherwise the widget's background will - be transparent, showing both the model data and the tree widget - item. - - This function should only be used to display static content in the - place of a tree widget item. If you want to display custom dynamic - content or implement a custom editor widget, use QTreeView and - subclass QItemDelegate instead. + Sets the given \a widget to be displayed in the cell specified by the given + \a item and \a column. + + The given \a widget's \l {QWidget::}{autoFillBackground} property must be + set to true, otherwise the widget's background will be transparent, showing + both the model data and the tree widget item. + + This function should only be used to display static content in the place of + a tree widget item. If you want to display custom dynamic content or + implement a custom editor widget, use QTreeView and subclass QItemDelegate + instead. + + This function cannot be called before the item hierarchy has been set up, + i.e., the QTreeWidgetItem that will hold \a widget must have been added to + the view before \a widget is set. \note The tree takes ownership of the widget. diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 6971ed4..185fae2 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -169,189 +169,174 @@ QApplicationPrivate::~QApplicationPrivate() } /*! - \class QApplication - \brief The QApplication class manages the GUI application's control - flow and main settings. - - \ingroup application - \mainclass - - It contains the main event loop, where all events from the window - system and other sources are processed and dispatched. It also - handles the application's initialization and finalization, and - provides session management. It also handles most system-wide and - application-wide settings. - - For any GUI application that uses Qt, there is precisely one - QApplication object, no matter whether the application has 0, 1, 2 - or more windows at any time. For non-GUI Qt applications, use - QCoreApplication instead, which doesn't depend on the \l QtGui - library. - - The QApplication object is accessible through the instance() - function which return a pointer equivalent to the global qApp - pointer. - - QApplication's main areas of responsibility are: - \list - - \o It initializes the application with the user's desktop settings - such as palette(), font() and doubleClickInterval(). It keeps track - of these properties in case the user changes the desktop globally, for - example through some kind of control panel. - - \o It performs event handling, meaning that it receives events - from the underlying window system and dispatches them to the relevant - widgets. By using sendEvent() and postEvent() you can send your own - events to widgets. - - \o It parses common command line arguments and sets its internal - state accordingly. See the \link QApplication::QApplication() - constructor documentation\endlink below for more details about this. - - \o It defines the application's look and feel, which is - encapsulated in a QStyle object. This can be changed at runtime - with setStyle(). - - \o It specifies how the application is to allocate colors. - See setColorSpec() for details. - - \o It provides localization of strings that are visible to the user - via translate(). - - \o It provides some magical objects like the desktop() and the - clipboard(). - - \o It knows about the application's windows. You can ask which - widget is at a certain position using widgetAt(), get a list of - topLevelWidgets() and closeAllWindows(), etc. - - \o It manages the application's mouse cursor handling, - see setOverrideCursor() - - \o On the X window system, it provides functions to flush and sync - the communication stream, see flushX() and syncX(). - - \o It provides support for sophisticated \link - session.html session management \endlink. This makes it possible - for applications to terminate gracefully when the user logs out, to - cancel a shutdown process if termination isn't possible and even to - preserve the entire application's state for a future session. See - isSessionRestored(), sessionId() and commitData() and saveState() - for details. - - \endlist - - Since the QApplication object does so much initialization, it - \e{must} be created before any other objects related to the user - interface are created. - - Since it also deals with common command line arguments, it is - usually a good idea to create it \e before any interpretation or - modification of \c argv is done in the application itself. - - \table - \header \o{2,1} Groups of functions - \row - \o System settings - \o - desktopSettingsAware(), - setDesktopSettingsAware(), - cursorFlashTime(), - setCursorFlashTime(), - doubleClickInterval(), - setDoubleClickInterval(), - setKeyboardInputInterval(), - wheelScrollLines(), - setWheelScrollLines(), - palette(), - setPalette(), - font(), - setFont(), - fontMetrics(). - - \row - \o Event handling - \o - exec(), - processEvents(), - exit(), - quit(). - sendEvent(), - postEvent(), - sendPostedEvents(), - removePostedEvents(), - hasPendingEvents(), - notify(), - macEventFilter(), - qwsEventFilter(), - x11EventFilter(), - x11ProcessEvent(), - winEventFilter(). - - \row - \o GUI Styles - \o - style(), - setStyle(). - - \row - \o Color usage - \o - colorSpec(), - setColorSpec(), - qwsSetCustomColors(). - - \row - \o Text handling - \o - installTranslator(), - removeTranslator() - translate(). - - \row - \o Widgets - \o - allWidgets(), - topLevelWidgets(), - desktop(), - activePopupWidget(), - activeModalWidget(), - clipboard(), - focusWidget(), - winFocus(), - activeWindow(), - widgetAt(). - - \row - \o Advanced cursor handling - \o - overrideCursor(), - setOverrideCursor(), - restoreOverrideCursor(). - - \row - \o X Window System synchronization - \o - flushX(), - syncX(). - - \row - \o Session management - \o - isSessionRestored(), - sessionId(), - commitData(), - saveState(). - - \row - \o Miscellaneous - \o - closeAllWindows(), - startingUp(), - closingDown(), - type(). - \endtable + \class QApplication + \brief The QApplication class manages the GUI application's control + flow and main settings. + + \ingroup application + \mainclass + + QApplication contains the main event loop, where all events from the window + system and other sources are processed and dispatched. It also handles the + application's initialization and finalization, and provides session + management. In addition, it handles most system-wide and application-wide + settings. + + For any GUI application using Qt, there is precisely one QApplication + object, no matter whether the application has 0, 1, 2 or more windows at + any given time. For non-GUI Qt applications, use QCoreApplication instead, + as it does not depend on the \l QtGui library. + + The QApplication object is accessible through the instance() function that + returns a pointer equivalent to the global qApp pointer. + + QApplication's main areas of responsibility are: + \list + \o It initializes the application with the user's desktop settings + such as palette(), font() and doubleClickInterval(). It keeps + track of these properties in case the user changes the desktop + globally, for example through some kind of control panel. + + \o It performs event handling, meaning that it receives events + from the underlying window system and dispatches them to the + relevant widgets. By using sendEvent() and postEvent() you can + send your own events to widgets. + + \o It parses common command line arguments and sets its internal + state accordingly. See the \l{QApplication::QApplication()} + {constructor documentation} below for more details. + + \o It defines the application's look and feel, which is + encapsulated in a QStyle object. This can be changed at runtime + with setStyle(). + + \o It specifies how the application is to allocate colors. See + setColorSpec() for details. + + \o It provides localization of strings that are visible to the + user via translate(). + + \o It provides some magical objects like the desktop() and the + clipboard(). + + \o It knows about the application's windows. You can ask which + widget is at a certain position using widgetAt(), get a list of + topLevelWidgets() and closeAllWindows(), etc. + + \o It manages the application's mouse cursor handling, see + setOverrideCursor() + + \o On the X window system, it provides functions to flush and sync + the communication stream, see flushX() and syncX(). + + \o It provides support for sophisticated \l{Session Management} + {session management}. This makes it possible for applications + to terminate gracefully when the user logs out, to cancel a + shutdown process if termination isn't possible and even to + preserve the entire application's state for a future session. + See isSessionRestored(), sessionId() and commitData() and + saveState() for details. + \endlist + + The QApplication object does so much initialization. Hence, it \e{must} be + created before any other objects related to the user interface are created. + Since QApplication also deals with common command line arguments, it is + usually a good idea to create it \e before any interpretation or + modification of \c argv is done in the application itself. + + \table + \header + \o{2,1} Groups of functions + + \row + \o System settings + \o desktopSettingsAware(), + setDesktopSettingsAware(), + cursorFlashTime(), + setCursorFlashTime(), + doubleClickInterval(), + setDoubleClickInterval(), + setKeyboardInputInterval(), + wheelScrollLines(), + setWheelScrollLines(), + palette(), + setPalette(), + font(), + setFont(), + fontMetrics(). + + \row + \o Event handling + \o exec(), + processEvents(), + exit(), + quit(). + sendEvent(), + postEvent(), + sendPostedEvents(), + removePostedEvents(), + hasPendingEvents(), + notify(), + macEventFilter(), + qwsEventFilter(), + x11EventFilter(), + x11ProcessEvent(), + winEventFilter(). + + \row + \o GUI Styles + \o style(), + setStyle(). + + \row + \o Color usage + \o colorSpec(), + setColorSpec(), + qwsSetCustomColors(). + + \row + \o Text handling + \o installTranslator(), + removeTranslator() + translate(). + + \row + \o Widgets + \o allWidgets(), + topLevelWidgets(), + desktop(), + activePopupWidget(), + activeModalWidget(), + clipboard(), + focusWidget(), + activeWindow(), + widgetAt(). + + \row + \o Advanced cursor handling + \o overrideCursor(), + setOverrideCursor(), + restoreOverrideCursor(). + + \row + \o X Window System synchronization + \o flushX(), + syncX(). + + \row + \o Session management + \o isSessionRestored(), + sessionId(), + commitData(), + saveState(). + + \row + \o Miscellaneous + \o closeAllWindows(), + startingUp(), + closingDown(), + type(). + \endtable \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings */ @@ -382,6 +367,7 @@ QApplicationPrivate::~QApplicationPrivate() Returns the top-level widget at the given \a point; returns 0 if there is no such widget. */ + /*! \fn QWidget *QApplication::topLevelAt(int x, int y) @@ -393,8 +379,8 @@ QApplicationPrivate::~QApplicationPrivate() /* - The qt_init() and qt_cleanup() functions are implemented in the - qapplication_xyz.cpp file. + The qt_init() and qt_cleanup() functions are implemented in the + qapplication_xyz.cpp file. */ void qt_init(QApplicationPrivate *priv, int type @@ -580,99 +566,100 @@ void QApplicationPrivate::process_cmdline() } /*! - Initializes the window system and constructs an application object - with \a argc command line arguments in \a argv. - - \warning The data referred to by \a argc and \a argv must stay valid - for the entire lifetime of the QApplication object. In addition, - \a argc must be greater than zero and \a argv must contain at least - one valid character string. - - The global \c qApp pointer refers to this application object. Only - one application object should be created. - - This application object must be constructed before any \link - QPaintDevice paint devices\endlink (including widgets, pixmaps, bitmaps - etc.). - - Note that \a argc and \a argv might be changed. Qt removes command - line arguments that it recognizes. - - Qt debugging options (not available if Qt was compiled without the - QT_DEBUG flag defined): - \list - \o -nograb, tells Qt that it must never grab the mouse or the keyboard. - \o -dograb (only under X11), running under a debugger can cause - an implicit -nograb, use -dograb to override. - \o -sync (only under X11), switches to synchronous mode for - debugging. - \endlist - - See \link debug.html Debugging Techniques \endlink for a more - detailed explanation. - - All Qt programs automatically support the following command line options: - \list - \o -style= \e style, sets the application GUI style. Possible values - are \c motif, \c windows, and \c platinum. If you compiled Qt - with additional styles or have additional styles as plugins these - will be available to the \c -style command line option. - \o -style \e style, is the same as listed above. - \o -stylesheet= \e stylesheet, sets the application \l styleSheet. The value - must be a path to a file that contains the Style Sheet. Note that relative URLs - in the Style Sheet file are relative to the Style Sheet file's path. - \o -stylesheet \e stylesheet, is the same as listed above. - \o -session= \e session, restores the application from an earlier - \link session.html session \endlink. - \o -session \e session, is the same as listed above. - \o -widgetcount, prints debug message at the end about number of widgets left - undestroyed and maximum number of widgets existed at the same time - \o -reverse, sets the application's layout direction to Qt::RightToLeft - \o -graphicssystem, sets the backend to be used for on-screen - widgets and QPixmaps. Available options are \c{raster} and \c{opengl}. - - \endlist - - The Windows version of Qt also support one additional command line - option, if Direct3D support has been compiled into Qt: - \list - \o -direct3d will make the Direct3D paint engine the default widget - paint engine in Qt. \bold {This functionality is experimental.} - \endlist - - The X11 version of Qt also supports some traditional X11 - command line options: - \list - \o -display \e display, sets the X display (default is $DISPLAY). - \o -geometry \e geometry, sets the client geometry of the - first window that is shown. - \o -fn or \c -font \e font, defines the application font. The - font should be specified using an X logical font description. - \o -bg or \c -background \e color, sets the default background color - and an application palette (light and dark shades are calculated). - \o -fg or \c -foreground \e color, sets the default foreground color. - \o -btn or \c -button \e color, sets the default button color. - \o -name \e name, sets the application name. - \o -title \e title, sets the application title. - \o -visual \c TrueColor, forces the application to use a TrueColor visual - on an 8-bit display. - \o -ncols \e count, limits the number of colors allocated in the - color cube on an 8-bit display, if the application is using the - QApplication::ManyColor color specification. If \e count is - 216 then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green, - and 6 of blue); for other values, a cube - approximately proportional to a 2x3x1 cube is used. - \o -cmap, causes the application to install a private color map - on an 8-bit display. - \o -im, sets the input method server (equivalent to setting the XMODIFIERS - environment variable) - \o -inputstyle, defines how the input is inserted into the given widget. E.g., - \c onTheSpot makes the input appear directly in the widget, while - \c overTheSpot makes the input appear in a box floating over the - widget and is not inserted until the editing is done. - \endlist - - \sa arguments() + Initializes the window system and constructs an application object with + \a argc command line arguments in \a argv. + + \warning The data referred to by \a argc and \a argv must stay valid for + the entire lifetime of the QApplication object. In addition, \a argc must + be greater than zero and \a argv must contain at least one valid character + string. + + The global \c qApp pointer refers to this application object. Only one + application object should be created. + + This application object must be constructed before any \l{QPaintDevice} + {paint devices} (including widgets, pixmaps, bitmaps etc.). + + \note \a argc and \a argv might be changed as Qt removes command line + arguments that it recognizes. + + Qt debugging options (not available if Qt was compiled without the QT_DEBUG + flag defined): + \list + \o -nograb, tells Qt that it must never grab the mouse or the + keyboard. + \o -dograb (only under X11), running under a debugger can cause an + implicit -nograb, use -dograb to override. + \o -sync (only under X11), switches to synchronous mode for + debugging. + \endlist + + See \l{Debugging Techniques} for a more detailed explanation. + + All Qt programs automatically support the following command line options: + \list + \o -style= \e style, sets the application GUI style. Possible values + are \c motif, \c windows, and \c platinum. If you compiled Qt with + additional styles or have additional styles as plugins these will + be available to the \c -style command line option. + \o -style \e style, is the same as listed above. + \o -stylesheet= \e stylesheet, sets the application \l styleSheet. The + value must be a path to a file that contains the Style Sheet. + \note Relative URLs in the Style Sheet file are relative to the + Style Sheet file's path. + \o -stylesheet \e stylesheet, is the same as listed above. + \o -session= \e session, restores the application from an earlier + \l{Session Management}{session}. + \o -session \e session, is the same as listed above. + \o -widgetcount, prints debug message at the end about number of + widgets left undestroyed and maximum number of widgets existed at + the same time + \o -reverse, sets the application's layout direction to + Qt::RightToLeft + \o -graphicssystem, sets the backend to be used for on-screen widgets + and QPixmaps. Available options are \c{raster} and \c{opengl}. + \endlist + + The Windows version of Qt supports an additional command line option, if + Direct3D support has been compiled into Qt: + \list + \o -direct3d will make the Direct3D paint engine the default widget + paint engine in Qt. \bold {This functionality is experimental.} + \endlist + + The X11 version of Qt supports some traditional X11 command line options: + \list + \o -display \e display, sets the X display (default is $DISPLAY). + \o -geometry \e geometry, sets the client geometry of the first window + that is shown. + \o -fn or \c -font \e font, defines the application font. The font + should be specified using an X logical font description. + \o -bg or \c -background \e color, sets the default background color + and an application palette (light and dark shades are calculated). + \o -fg or \c -foreground \e color, sets the default foreground color. + \o -btn or \c -button \e color, sets the default button color. + \o -name \e name, sets the application name. + \o -title \e title, sets the application title. + \o -visual \c TrueColor, forces the application to use a TrueColor + visual on an 8-bit display. + \o -ncols \e count, limits the number of colors allocated in the color + cube on an 8-bit display, if the application is using the + QApplication::ManyColor color specification. If \e count is 216 + then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green, + and 6 of blue); for other values, a cube approximately proportional + to a 2x3x1 cube is used. + \o -cmap, causes the application to install a private color map on an + 8-bit display. + \o -im, sets the input method server (equivalent to setting the + XMODIFIERS environment variable) + \o -inputstyle, defines how the input is inserted into the given + widget, e.g., \c onTheSpot makes the input appear directly in the + widget, while \c overTheSpot makes the input appear in a box + floating over the widget and is not inserted until the editing is + done. + \endlist + + \sa arguments() */ QApplication::QApplication(int &argc, char **argv) @@ -685,26 +672,26 @@ QApplication::QApplication(int &argc, char **argv, int _internal) /*! - Constructs an application object with \a argc command line arguments - in \a argv. If \a GUIenabled is true, a GUI application is - constructed, otherwise a non-GUI (console) application is created. + Constructs an application object with \a argc command line arguments in + \a argv. If \a GUIenabled is true, a GUI application is constructed, + otherwise a non-GUI (console) application is created. - \warning The data referred to by \a argc and \a argv must stay valid - for the entire lifetime of the QApplication object. In addition, - \a argc must be greater than zero and \a argv must contain at least - one valid character string. + \warning The data referred to by \a argc and \a argv must stay valid for + the entire lifetime of the QApplication object. In addition, \a argc must + be greater than zero and \a argv must contain at least one valid character + string. - Set \a GUIenabled to false for programs without a graphical user - interface that should be able to run without a window system. + Set \a GUIenabled to false for programs without a graphical user interface + that should be able to run without a window system. - On X11, the window system is initialized if \a GUIenabled is true. - If \a GUIenabled is false, the application does not connect to the - X server. On Windows and Macintosh, currently the window system is - always initialized, regardless of the value of GUIenabled. This may - change in future versions of Qt. + On X11, the window system is initialized if \a GUIenabled is true. If + \a GUIenabled is false, the application does not connect to the X server. + On Windows and Macintosh, currently the window system is always + initialized, regardless of the value of GUIenabled. This may change in + future versions of Qt. - The following example shows how to create an application that - uses a graphical interface when available. + The following example shows how to create an application that uses a + graphical interface when available. \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 0 */ @@ -720,17 +707,17 @@ QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _intern /*! - Constructs an application object with \a argc command line arguments - in \a argv. + Constructs an application object with \a argc command line arguments in + \a argv. - \warning The data referred to by \a argc and \a argv must stay valid - for the entire lifetime of the QApplication object. In addition, - \a argc must be greater than zero and \a argv must contain at least - one valid character string. + \warning The data referred to by \a argc and \a argv must stay valid for + the entire lifetime of the QApplication object. In addition, \a argc must + be greater than zero and \a argv must contain at least one valid character + string. - With Qt for Embedded Linux, passing QApplication::GuiServer for \a type - makes this application the server (equivalent to running with the - \c -qws option). + With Qt for Embedded Linux, passing QApplication::GuiServer for \a type + makes this application the server (equivalent to running with the + \c -qws option). */ QApplication::QApplication(int &argc, char **argv, Type type) : QCoreApplication(*new QApplicationPrivate(argc, argv, type)) @@ -778,16 +765,16 @@ static int aargc = 1; static char *aargv[] = { (char*)"unknown", 0 }; /*! - \fn QApplication::QApplication(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap) + \fn QApplication::QApplication(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap) - Create an application, given an already open display \a display. If \a - visual and \a colormap are non-zero, the application will use those as - the default Visual and Colormap contexts. + Creates an application, given an already open display \a display. If + \a visual and \a colormap are non-zero, the application will use those + values as the default Visual and Colormap contexts. - \warning Qt only supports TrueColor visuals at depths higher than 8 - bits-per-pixel. + \warning Qt only supports TrueColor visuals at depths higher than 8 + bits-per-pixel. - This is available only on X11. + This function is only available on X11. */ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap) : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient)) @@ -809,19 +796,18 @@ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap, } /*! - \fn QApplication::QApplication(Display *display, int &argc, char **argv, - Qt::HANDLE visual, Qt::HANDLE colormap) + \fn QApplication::QApplication(Display *display, int &argc, char **argv, + Qt::HANDLE visual, Qt::HANDLE colormap) - Create an application, given an already open \a display and using \a - argc command line arguments in \a argv. If \a visual and \a colormap - are non-zero, the application will use those as the default Visual - and Colormap contexts. + Creates an application, given an already open \a display and using \a argc + command line arguments in \a argv. If \a visual and \a colormap are + non-zero, the application will use those values as the default Visual + and Colormap contexts. - \warning Qt only supports TrueColor visuals at depths higher than 8 - bits-per-pixel. - - This is available only on X11. + \warning Qt only supports TrueColor visuals at depths higher than 8 + bits-per-pixel. + This function is only available on X11. */ QApplication::QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE colormap) @@ -850,6 +836,7 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv, /*! Initializes the QApplication object, called from the constructors. */ +extern void qInitDrawhelperAsm(); void QApplicationPrivate::initialize() { @@ -893,7 +880,6 @@ void QApplicationPrivate::initialize() #endif //Q_OS_WINCE // Set up which span functions should be used in raster engine... - extern void qInitDrawhelperAsm(); qInitDrawhelperAsm(); #if !defined(Q_WS_X11) && !defined(Q_WS_QWS) @@ -926,19 +912,18 @@ QApplication::Type QApplication::type() *****************************************************************************/ /*! - Returns the active popup widget. + Returns the active popup widget. - A popup widget is a special top-level widget that sets the \c - Qt::WType_Popup widget flag, e.g. the QMenu widget. When the - application opens a popup widget, all events are sent to the popup. - Normal widgets and modal widgets cannot be accessed before the popup - widget is closed. + A popup widget is a special top-level widget that sets the \c + Qt::WType_Popup widget flag, e.g. the QMenu widget. When the application + opens a popup widget, all events are sent to the popup. Normal widgets and + modal widgets cannot be accessed before the popup widget is closed. - Only other popup widgets may be opened when a popup widget is shown. - The popup widgets are organized in a stack. This function returns - the active popup widget at the top of the stack. + Only other popup widgets may be opened when a popup widget is shown. The + popup widgets are organized in a stack. This function returns the active + popup widget at the top of the stack. - \sa activeModalWidget(), topLevelWidgets() + \sa activeModalWidget(), topLevelWidgets() */ QWidget *QApplication::activePopupWidget() @@ -949,17 +934,17 @@ QWidget *QApplication::activePopupWidget() /*! - Returns the active modal widget. + Returns the active modal widget. - A modal widget is a special top-level widget which is a subclass of - QDialog that specifies the modal parameter of the constructor as - true. A modal widget must be closed before the user can continue - with other parts of the program. + A modal widget is a special top-level widget which is a subclass of QDialog + that specifies the modal parameter of the constructor as true. A modal + widget must be closed before the user can continue with other parts of the + program. - Modal widgets are organized in a stack. This function returns - the active modal widget at the top of the stack. + Modal widgets are organized in a stack. This function returns the active + modal widget at the top of the stack. - \sa activePopupWidget(), topLevelWidgets() + \sa activePopupWidget(), topLevelWidgets() */ QWidget *QApplication::activeModalWidget() @@ -968,8 +953,8 @@ QWidget *QApplication::activeModalWidget() } /*! - Cleans up any window system resources that were allocated by this - application. Sets the global variable \c qApp to 0. + Cleans up any window system resources that were allocated by this + application. Sets the global variable \c qApp to 0. */ QApplication::~QApplication() @@ -1098,8 +1083,8 @@ QApplication::~QApplication() /*! \fn QWidget *QApplication::widgetAt(const QPoint &point) - Returns the widget at global screen position \a point, or 0 if there - is no Qt widget there. + Returns the widget at global screen position \a point, or 0 if there is no + Qt widget there. This function can be slow. @@ -1147,8 +1132,8 @@ QWidget *QApplication::widgetAt(const QPoint &p) \overload - Returns the widget at global screen position (\a x, \a y), or 0 - if there is no Qt widget there. + Returns the widget at global screen position (\a x, \a y), or 0 if there is + no Qt widget there. */ /*! @@ -1217,16 +1202,17 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis \since 4.4 \brief defines a threshold for auto maximizing widgets - The auto maximize threshold is only available - as part of Qt for Windows CE. + The auto maximize threshold is only available as part of Qt for Windows CE. This property defines a threshold for the size of a window as a percentage - of the screen size. If the minimum size hint of a window exceeds the threshold, - calling show() will then cause the window to be maximized automatically. + of the screen size. If the minimum size hint of a window exceeds the + threshold, calling show() will then cause the window to be maximized + automatically. - Setting the threshold to be 100 or greater means that it will cause it to always - be maximized. Setting it to be 50 means that the widget is maximized if the vertical - minimum size hint is at least 50% of the vertical screen size. + Setting the threshold to be 100 or greater means that it will cause it to + always be maximized. Setting it to be 50 means that the widget is maximized + if the vertical minimum size hint is at least 50% of the vertical screen + size. If -1 is specified then this will disable the feature. @@ -1239,12 +1225,11 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis \since 4.5 \brief toggles automatic SIP (software input panel) visibility - The auto SIP property is only available - as part of Qt for Windows CE. + The auto SIP property is only available as part of Qt for Windows CE. Set this property to true to automatically display the SIP when entering - widgets that accept keyboard input. This only affects widgets that have the - attribute WA_InputMethodEnabled set. + widgets that accept keyboard input. This property only affects widgets with + the WA_InputMethodEnabled attribute set. */ #ifdef Q_OS_WINCE @@ -1296,9 +1281,9 @@ void QApplication::setStyleSheet(const QString& styleSheet) #endif // QT_NO_STYLE_STYLESHEET /*! - Returns the application's style object. + Returns the application's style object. - \sa setStyle(), QStyle + \sa setStyle(), QStyle */ QStyle *QApplication::style() { @@ -1381,22 +1366,21 @@ QStyle *QApplication::style() } /*! - Sets the application's GUI style to \a style. Ownership of the style - object is transferred to QApplication, so QApplication will delete - the style object on application exit or when a new style is set and - the old style is still the parent of the application object. + Sets the application's GUI style to \a style. Ownership of the style object + is transferred to QApplication, so QApplication will delete the style + object on application exit or when a new style is set and the old style is + still the parent of the application object. Example usage: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 1 - When switching application styles, the color palette is set back to - the initial colors or the system defaults. This is necessary since - certain styles have to adapt the color palette to be fully - style-guide compliant. + When switching application styles, the color palette is set back to the + initial colors or the system defaults. This is necessary since certain + styles have to adapt the color palette to be fully style-guide compliant. - Note that setting the style before a palette has been set - (i.e. before creating QApplication) will cause the application to - use QStyle::standardPalette() for the palette. + Setting the style before a palette has been se, i.e., before creating + QApplication, will cause the application to use QStyle::standardPalette() + for the palette. \warning Qt style sheets are currently not supported for custom QStyle subclasses. We plan to address this in some future release. @@ -1499,20 +1483,20 @@ void QApplication::setStyle(QStyle *style) } /*! - \overload + \overload - Requests a QStyle object for \a style from the QStyleFactory. + Requests a QStyle object for \a style from the QStyleFactory. - The string must be one of the QStyleFactory::keys(), typically one - of "windows", "motif", "cde", "plastique", "windowsxp", or - "macintosh". Style names are case insensitive. + The string must be one of the QStyleFactory::keys(), typically one of + "windows", "motif", "cde", "plastique", "windowsxp", or "macintosh". Style + names are case insensitive. - Returns 0 if an unknown \a style is passed, otherwise the QStyle object - returned is set as the application's GUI style. + Returns 0 if an unknown \a style is passed, otherwise the QStyle object + returned is set as the application's GUI style. - \warning To ensure that the application's style is set correctly, it is - best to call this function before the QApplication constructor, if - possible. + \warning To ensure that the application's style is set correctly, it is + best to call this function before the QApplication constructor, if + possible. */ QStyle* QApplication::setStyle(const QString& style) { @@ -1525,20 +1509,19 @@ QStyle* QApplication::setStyle(const QString& style) } /*! - \since 4.5 + \since 4.5 - Sets the default graphics backend to \a system, which will be used - for on-screen widgets and QPixmaps. The available systems are - \c{"native"}, \c{"raster"} and \c{"opengl"}. + Sets the default graphics backend to \a system, which will be used for + on-screen widgets and QPixmaps. The available systems are \c{"native"}, + \c{"raster"} and \c{"opengl"}. - Note that this function call overrides both the application - commandline \c{-graphicssystem} switch and the configure - \c{-graphicssystem} switch. + This function call overrides both the application commandline + \c{-graphicssystem} switch and the configure \c{-graphicssystem} switch. - \warning This function must be called before the QApplication - constructor is called. + \warning This function must be called before the QApplication constructor + is called. - The \c{"opengl"} option is currently considered experimental. + \note The \c{"opengl"} option is currently experimental. */ void QApplication::setGraphicsSystem(const QString &system) @@ -1547,9 +1530,10 @@ void QApplication::setGraphicsSystem(const QString &system) } /*! - Returns the color specification. - \sa QApplication::setColorSpec() - */ + Returns the color specification. + + \sa QApplication::setColorSpec() +*/ int QApplication::colorSpec() { @@ -1557,54 +1541,54 @@ int QApplication::colorSpec() } /*! - Sets the color specification for the application to \a spec. - - The color specification controls how the application allocates colors - when run on a display with a limited amount of colors, e.g. 8 bit / 256 - color displays. - - The color specification must be set before you create the QApplication - object. - - The options are: - \list - \o QApplication::NormalColor. - This is the default color allocation strategy. Use this option if - your application uses buttons, menus, texts and pixmaps with few - colors. With this option, the application uses system global - colors. This works fine for most applications under X11, but on - Windows machines it may cause dithering of non-standard colors. - \o QApplication::CustomColor. - Use this option if your application needs a small number of custom - colors. On X11, this option is the same as NormalColor. On Windows, Qt - creates a Windows palette, and allocates colors to it on demand. - \o QApplication::ManyColor. - Use this option if your application is very color hungry - (e.g. it requires thousands of colors). - Under X11 the effect is: + Sets the color specification for the application to \a spec. + + The color specification controls how the application allocates colors when + run on a display with a limited amount of colors, e.g. 8 bit / 256 color + displays. + + The color specification must be set before you create the QApplication + object. + + The options are: \list - \o For 256-color displays which have at best a 256 color true - color visual, the default visual is used, and colors are - allocated from a color cube. The color cube is the 6x6x6 (216 - color) "Web palette" (the red, green, and blue components - always have one of the following values: 0x00, 0x33, 0x66, - 0x99, 0xCC, or 0xFF), but the number of colors can be changed - by the \e -ncols option. The user can force the application to - use the true color visual with the \link - QApplication::QApplication() -visual \endlink option. - \o For 256-color displays which have a true color visual with more - than 256 colors, use that visual. Silicon Graphics X servers - have this feature, for example. They provide an 8 bit visual - by default but can deliver true color when asked. + \o QApplication::NormalColor. This is the default color allocation + strategy. Use this option if your application uses buttons, menus, + texts and pixmaps with few colors. With this option, the + application uses system global colors. This works fine for most + applications under X11, but on Windows machines it may cause + dithering of non-standard colors. + \o QApplication::CustomColor. Use this option if your application + needs a small number of custom colors. On X11, this option is the + same as NormalColor. On Windows, Qt creates a Windows palette, and + allocates colors to it on demand. + \o QApplication::ManyColor. Use this option if your application is + very color hungry, e.g., it requires thousands of colors. \br + Under X11 the effect is: + \list + \o For 256-color displays which have at best a 256 color true + color visual, the default visual is used, and colors are + allocated from a color cube. The color cube is the 6x6x6 + (216 color) "Web palette" (the red, green, and blue + components always have one of the following values: 0x00, + 0x33, 0x66, 0x99, 0xCC, or 0xFF), but the number of colors + can be changed by the \e -ncols option. The user can force + the application to use the true color visual with the + \l{QApplication::QApplication()}{-visual} option. + \o For 256-color displays which have a true color visual with + more than 256 colors, use that visual. Silicon Graphics X + servers this feature, for example. They provide an 8 bit + visual by default but can deliver true color when asked. + \endlist + On Windows, Qt creates a Windows palette, and fills it with a color + cube. \endlist - On Windows, Qt creates a Windows palette, and fills it with a color cube. - \endlist - Be aware that the CustomColor and ManyColor choices may lead to colormap - flashing: The foreground application gets (most) of the available - colors, while the background windows will look less attractive. + Be aware that the CustomColor and ManyColor choices may lead to colormap + flashing: The foreground application gets (most) of the available colors, + while the background windows will look less attractive. - Example: + Example: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 2 @@ -1624,10 +1608,9 @@ void QApplication::setColorSpec(int spec) \brief the minimum size that any GUI element that the user can interact with should have - For example, no button should be resized to be smaller than the - global strut size. The strut size should be considered when - reimplementing GUI controls that may be used on touch-screens or - similar I/O devices. + For example, no button should be resized to be smaller than the global + strut size. The strut size should be considered when reimplementing GUI + controls that may be used on touch-screens or similar I/O devices. Example: @@ -1661,12 +1644,11 @@ QPalette QApplication::palette() \fn QPalette QApplication::palette(const QWidget* widget) \overload - If a \a widget is passed, the default palette for the - widget's class is returned. This may or may not be the application - palette. In most cases there isn't a special palette for certain - types of widgets, but one notable exception is the popup menu - under Windows, if the user has defined a special background color - for menus in the display settings. + If a \a widget is passed, the default palette for the widget's class is + returned. This may or may not be the application palette. In most cases + there is no special palette for certain types of widgets, but one notable + exception is the popup menu under Windows, if the user has defined a + special background color for menus in the display settings. \sa setPalette(), QWidget::palette() */ @@ -1760,26 +1742,26 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* } /*! - Changes the default application palette to \a palette. + Changes the default application palette to \a palette. - If \a className is passed, the change applies only to widgets that - inherit \a className (as reported by QObject::inherits()). If - \a className is left 0, the change affects all widgets, thus overriding - any previously set class specific palettes. + If \a className is passed, the change applies only to widgets that inherit + \a className (as reported by QObject::inherits()). If \a className is left + 0, the change affects all widgets, thus overriding any previously set class + specific palettes. - The palette may be changed according to the current GUI style in - QStyle::polish(). + The palette may be changed according to the current GUI style in + QStyle::polish(). - \warning Do not use this function in conjunction with \l{Qt Style Sheets}. - When using style sheets, the palette of a widget can be customized using the "color", - "background-color", "selection-color", "selection-background-color" and - "alternate-background-color". + \warning Do not use this function in conjunction with \l{Qt Style Sheets}. + When using style sheets, the palette of a widget can be customized using + the "color", "background-color", "selection-color", + "selection-background-color" and "alternate-background-color". - Note that some styles do not use the palette for all drawing, - for instance, if they make use of native theme engines. This is - the case for the Windows XP, Windows Vista, and Mac OS X styles. + \note Some styles do not use the palette for all drawing, for instance, if + they make use of native theme engines. This is the case for the Windows XP, + Windows Vista, and Mac OS X styles. - \sa QWidget::setPalette(), palette(), QStyle::polish() + \sa QWidget::setPalette(), palette(), QStyle::polish() */ void QApplication::setPalette(const QPalette &palette, const char* className) @@ -1884,15 +1866,15 @@ QFont QApplication::font(const char *className) /*! - Changes the default application font to \a font. If \a className - is passed, the change applies only to classes that inherit \a - className (as reported by QObject::inherits()). + Changes the default application font to \a font. If \a className is passed, + the change applies only to classes that inherit \a className (as reported + by QObject::inherits()). - On application start-up, the default font depends on the window - system. It can vary depending on both the window system version and - the locale. This function lets you override the default font; but - overriding may be a bad idea because, for example, some locales need - extra large fonts to support their special characters. + On application start-up, the default font depends on the window system. It + can vary depending on both the window system version and the locale. This + function lets you override the default font; but overriding may be a bad + idea because, for example, some locales need extra large fonts to support + their special characters. \warning Do not use this function in conjunction with \l{Qt Style Sheets}. The font of an application can be customized using the "font" style sheet @@ -1994,11 +1976,10 @@ void QApplication::setWindowIcon(const QIcon &icon) } /*! - Returns a list of the top-level widgets (windows) in the - application. + Returns a list of the top-level widgets (windows) in the application. - Note that some of the top-level widgets may be hidden, for - example a tooltip if no tooltip is currently shown. + \note Some of the top-level widgets may be hidden, for example a tooltip if + no tooltip is currently shown. Example: @@ -2024,7 +2005,7 @@ QWidgetList QApplication::topLevelWidgets() The list is empty (QList::isEmpty()) if there are no widgets. - Note that some of the widgets may be hidden. + \note Some of the widgets may be hidden. Example: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 5 @@ -2043,10 +2024,10 @@ QWidgetList QApplication::allWidgets() } /*! - Returns the application widget that has the keyboard input focus, or - 0 if no widget in this application has the focus. + Returns the application widget that has the keyboard input focus, or 0 if + no widget in this application has the focus. - \sa QWidget::setFocus(), QWidget::hasFocus(), activeWindow(), focusChanged() + \sa QWidget::setFocus(), QWidget::hasFocus(), activeWindow(), focusChanged() */ QWidget *QApplication::focusWidget() @@ -2080,9 +2061,13 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) QWidget *prev = focus_widget; focus_widget = focus; - if (prev && reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason && - prev->testAttribute(Qt::WA_InputMethodEnabled)) { - QInputContext *qic = prev->inputContext(); + if (prev && ((reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason + && prev->testAttribute(Qt::WA_InputMethodEnabled)) + // Do reset the input context, in case the new focus widget won't accept keyboard input + // or it is not created fully yet. + || (focus_widget && (!focus_widget->testAttribute(Qt::WA_InputMethodEnabled) + || !focus_widget->testAttribute(Qt::WA_WState_Created))))) { + QInputContext *qic = prev->inputContext(); if(qic) { qic->reset(); qic->setFocusWidget(0); @@ -2127,12 +2112,12 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) /*! - Returns the application top-level window that has the keyboard input - focus, or 0 if no application window has the focus. Note that - there might be an activeWindow() even if there is no focusWidget(), - for example if no widget in that window accepts key events. + Returns the application top-level window that has the keyboard input focus, + or 0 if no application window has the focus. There might be an + activeWindow() even if there is no focusWidget(), for example if no widget + in that window accepts key events. - \sa QWidget::setFocus(), QWidget::hasFocus(), focusWidget() + \sa QWidget::setFocus(), QWidget::hasFocus(), focusWidget() */ QWidget *QApplication::activeWindow() @@ -2141,9 +2126,9 @@ QWidget *QApplication::activeWindow() } /*! - Returns display (screen) font metrics for the application font. + Returns display (screen) font metrics for the application font. - \sa font(), setFont(), QWidget::fontMetrics(), QPainter::fontMetrics() + \sa font(), setFont(), QWidget::fontMetrics(), QPainter::fontMetrics() */ QFontMetrics QApplication::fontMetrics() @@ -2155,19 +2140,20 @@ QFontMetrics QApplication::fontMetrics() /*! Closes all top-level windows. - This function is particularly useful for applications with many - top-level windows. It could, for example, be connected to a - \gui{Exit} entry in the \gui{File} menu: + This function is particularly useful for applications with many top-level + windows. It could, for example, be connected to a \gui{Exit} entry in the + \gui{File} menu: \snippet examples/mainwindows/mdi/mainwindow.cpp 0 - The windows are closed in random order, until one window does not - accept the close event. The application quits when the last window - was successfully closed; this can be turned off by setting \l - quitOnLastWindowClosed to false. + The windows are closed in random order, until one window does not accept + the close event. The application quits when the last window was + successfully closed; this can be turned off by setting + \l quitOnLastWindowClosed to false. - \sa quitOnLastWindowClosed, lastWindowClosed() QWidget::close(), QWidget::closeEvent(), lastWindowClosed(), - quit(), topLevelWidgets(), QWidget::isWindow() + \sa quitOnLastWindowClosed, lastWindowClosed(), QWidget::close(), + QWidget::closeEvent(), lastWindowClosed(), quit(), topLevelWidgets(), + QWidget::isWindow() */ void QApplication::closeAllWindows() { @@ -2190,11 +2176,11 @@ void QApplication::closeAllWindows() } /*! - Displays a simple message box about Qt. The message includes the - version number of Qt being used by the application. + Displays a simple message box about Qt. The message includes the version + number of Qt being used by the application. - This is useful for inclusion in the \gui Help menu of an application, - as shown in the \l{mainwindows/menus}{Menus} example. + This is useful for inclusion in the \gui Help menu of an application, as + shown in the \l{mainwindows/menus}{Menus} example. This function is a convenience slot for QMessageBox::aboutQt(). */ @@ -2215,22 +2201,20 @@ void QApplication::aboutQt() /*! \fn void QApplication::lastWindowClosed() - This signal is emitted from QApplication::exec() when the last - visible primary window (i.e. window with no parent) with the - Qt::WA_QuitOnClose attribute set is closed. + This signal is emitted from QApplication::exec() when the last visible + primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose + attribute set is closed. By default, \list + \o this attribute is set for all widgets except transient windows such + as splash screens, tool windows, and popup menus - \i this attribute is set for all widgets except transient windows - such as splash screens, tool windows, and popup menus - - \i QApplication implicitly quits when this signal is emitted. - + \o QApplication implicitly quits when this signal is emitted. \endlist - This feature be turned off by setting \l quitOnLastWindowClosed to + This feature can be turned off by setting \l quitOnLastWindowClosed to false. \sa QWidget::close() @@ -2240,15 +2224,15 @@ void QApplication::aboutQt() \since 4.1 \fn void QApplication::focusChanged(QWidget *old, QWidget *now) - This signal is emitted when the widget that has keyboard focus - changed from \a old to \a now, i.e. because the user pressed the - tab-key, clicked into a widget or changed the active window. Note - that both \a old and \a now can be the null-pointer. + This signal is emitted when the widget that has keyboard focus changed from + \a old to \a now, i.e., because the user pressed the tab-key, clicked into + a widget or changed the active window. Both \a old and \a now can be the + null-pointer. - The signal is emitted after both widget have been notified about - the change through QFocusEvent. + The signal is emitted after both widget have been notified about the change + through QFocusEvent. - \sa QWidget::setFocus() QWidget::clearFocus() Qt::FocusReason + \sa QWidget::setFocus(), QWidget::clearFocus(), Qt::FocusReason */ /*! @@ -2257,10 +2241,10 @@ void QApplication::aboutQt() This signal is emitted when application fonts are loaded or removed. - \sa QFontDatabase::addApplicationFont() - \sa QFontDatabase::addApplicationFontFromData() - \sa QFontDatabase::removeAllApplicationFonts() - \sa QFontDatabase::removeApplicationFont() + \sa QFontDatabase::addApplicationFont(), + QFontDatabase::addApplicationFontFromData(), + QFontDatabase::removeAllApplicationFonts(), + QFontDatabase::removeApplicationFont() */ #ifndef QT_NO_TRANSLATION @@ -2357,18 +2341,17 @@ void QApplication::syncX() {} // do nothing \fn void QApplication::setActiveWindow(QWidget* active) Sets the active window to the \a active widget in response to a system - event. The function is called from the platform specific event - handlers. + event. The function is called from the platform specific event handlers. - \warning This function does \e not set the keyboard focus to the - active widget. Call QWidget::activateWindow() instead. + \warning This function does \e not set the keyboard focus to the active + widget. Call QWidget::activateWindow() instead. - It sets the activeWindow() and focusWidget() attributes and sends - proper \l{QEvent::WindowActivate}{WindowActivate}/\l{QEvent::WindowDeactivate}{WindowDeactivate} - and \l{QEvent::FocusIn}{FocusIn}/\l{QEvent::FocusOut}{FocusOut} events - to all appropriate widgets. The window will then be painted in - active state (e.g. cursors in line edits will blink), and it will - have tool tips enabled. + It sets the activeWindow() and focusWidget() attributes and sends proper + \l{QEvent::WindowActivate}{WindowActivate}/\l{QEvent::WindowDeactivate} + {WindowDeactivate} and \l{QEvent::FocusIn}{FocusIn}/\l{QEvent::FocusOut} + {FocusOut} events to all appropriate widgets. The window will then be + painted in active state (e.g. cursors in line edits will blink), and it + will have tool tips enabled. \sa activeWindow(), QWidget::activateWindow() */ @@ -2467,7 +2450,9 @@ void QApplication::setActiveWindow(QWidget* act) } else { // If the focus widget is not in the activate_window, clear the focus w = QApplicationPrivate::focus_widget; - if (w && !QApplicationPrivate::active_window->isAncestorOf(w)) + if (!w && QApplicationPrivate::active_window->focusPolicy() != Qt::NoFocus) + QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason); + else if (!QApplicationPrivate::active_window->isAncestorOf(w)) QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason); } } @@ -2512,11 +2497,11 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool } /*! - \fn void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) - \internal + \fn void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) + \internal - Creates the proper Enter/Leave event when widget \a enter is entered - and widget \a leave is left. + Creates the proper Enter/Leave event when widget \a enter is entered and + widget \a leave is left. */ #if defined(Q_WS_WIN) extern void qt_win_set_cursor(QWidget *, bool); @@ -3033,11 +3018,11 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) /*! Returns the desktop widget (also called the root window). - Note that the desktop may be composed of multiple screens, so it would be - incorrect, for example, to attempt to \e center some widget in the - desktop's geometry. QDesktopWidget has various functions for obtaining - useful geometries upon the desktop, such as QDesktopWidget::screenGeometry() - and QDesktopWidget::availableGeometry(). + The desktop may be composed of multiple screens, so it would be incorrect, + for example, to attempt to \e center some widget in the desktop's geometry. + QDesktopWidget has various functions for obtaining useful geometries upon + the desktop, such as QDesktopWidget::screenGeometry() and + QDesktopWidget::availableGeometry(). On X11, it is also possible to draw on the desktop. */ @@ -3052,10 +3037,10 @@ QDesktopWidget *QApplication::desktop() #ifndef QT_NO_CLIPBOARD /*! - Returns a pointer to the application global clipboard. + Returns a pointer to the application global clipboard. - \note The QApplication object should already be constructed before - accessing the clipboard. + \note The QApplication object should already be constructed before + accessing the clipboard. */ QClipboard *QApplication::clipboard() { @@ -3071,11 +3056,11 @@ QClipboard *QApplication::clipboard() #endif // QT_NO_CLIPBOARD /*! - Sets whether Qt should use the system's standard colors, fonts, - etc., to \a on. By default, this is true. + Sets whether Qt should use the system's standard colors, fonts, etc., to + \a on. By default, this is true. - This function must be called before creating the QApplication - object, like this: + This function must be called before creating the QApplication object, like + this: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 6 @@ -3087,8 +3072,8 @@ void QApplication::setDesktopSettingsAware(bool on) } /*! - Returns true if Qt is set to use the system's standard colors, - fonts, etc.; otherwise returns false. The default is true. + Returns true if Qt is set to use the system's standard colors, fonts, etc.; + otherwise returns false. The default is true. \sa setDesktopSettingsAware() */ @@ -3098,17 +3083,17 @@ bool QApplication::desktopSettingsAware() } /*! - Returns the current state of the modifier keys on the keyboard. The - current state is updated sychronously as the event queue is emptied - of events that will spontaneously change the keyboard state - (QEvent::KeyPress and QEvent::KeyRelease events). + Returns the current state of the modifier keys on the keyboard. The current + state is updated sychronously as the event queue is emptied of events that + will spontaneously change the keyboard state (QEvent::KeyPress and + QEvent::KeyRelease events). - It should be noted this may not reflect the actual keys held on the - input device at the time of calling but rather the modifiers as - last reported in one of the above events. If no keys are being held - Qt::NoModifier is returned. + It should be noted this may not reflect the actual keys held on the input + device at the time of calling but rather the modifiers as last reported in + one of the above events. If no keys are being held Qt::NoModifier is + returned. - \sa mouseButtons() + \sa mouseButtons() */ Qt::KeyboardModifiers QApplication::keyboardModifiers() @@ -3117,17 +3102,17 @@ Qt::KeyboardModifiers QApplication::keyboardModifiers() } /*! - Returns the current state of the buttons on the mouse. The current - state is updated syncronously as the event queue is emptied of - events that will spontaneously change the mouse state - (QEvent::MousePress and QEvent::MouseRelease events). + Returns the current state of the buttons on the mouse. The current state is + updated syncronously as the event queue is emptied of events that will + spontaneously change the mouse state (QEvent::MouseButtonPress and + QEvent::MouseButtonRelease events). - It should be noted this may not reflect the actual buttons held on - theinput device at the time of calling but rather the mouse buttons - as last reported in one of the above events. If no mouse buttons are - being held Qt::NoButton is returned. + It should be noted this may not reflect the actual buttons held on the + input device at the time of calling but rather the mouse buttons as last + reported in one of the above events. If no mouse buttons are being held + Qt::NoButton is returned. - \sa keyboardModifiers() + \sa keyboardModifiers() */ Qt::MouseButtons QApplication::mouseButtons() @@ -3136,43 +3121,40 @@ Qt::MouseButtons QApplication::mouseButtons() } /*! - \fn bool QApplication::isSessionRestored() const + \fn bool QApplication::isSessionRestored() const - Returns true if the application has been restored from an earlier - \link session.html session\endlink; otherwise returns false. + Returns true if the application has been restored from an earlier + \l{Session Management}{session}; otherwise returns false. - \sa sessionId(), commitData(), saveState() + \sa sessionId(), commitData(), saveState() */ /*! - \fn QString QApplication::sessionId() const + \fn QString QApplication::sessionId() const - Returns the current \link session.html session's\endlink identifier. + Returns the current \l{Session Management}{session's} identifier. - If the application has been restored from an earlier session, this - identifier is the same as it was in that previous session. + If the application has been restored from an earlier session, this + identifier is the same as it was in that previous session. The session + identifier is guaranteed to be unique both for different applications + and for different instances of the same application. - The session identifier is guaranteed to be unique both for different - applications and for different instances of the same application. - - \sa isSessionRestored(), sessionKey(), commitData(), saveState() - */ + \sa isSessionRestored(), sessionKey(), commitData(), saveState() +*/ /*! - \fn QString QApplication::sessionKey() const + \fn QString QApplication::sessionKey() const - Returns the session key in the current \link session.html - session\endlink. + Returns the session key in the current \l{Session Management}{session}. - If the application has been restored from an earlier session, this - key is the same as it was when the previous session ended. + If the application has been restored from an earlier session, this key is + the same as it was when the previous session ended. - The session key changes with every call of commitData() or - saveState(). + The session key changes with every call of commitData() or saveState(). - \sa isSessionRestored(), sessionId(), commitData(), saveState() - */ + \sa isSessionRestored(), sessionId(), commitData(), saveState() +*/ #ifndef QT_NO_SESSIONMANAGER bool QApplication::isSessionRestored() const { @@ -3195,59 +3177,57 @@ QString QApplication::sessionKey() const - - /*! - \since 4.2 - \fn void QApplication::commitDataRequest(QSessionManager &manager) + \since 4.2 + \fn void QApplication::commitDataRequest(QSessionManager &manager) - This signal deals with \link session.html session - management\endlink. It is emitted when the QSessionManager wants the - application to commit all its data. + This signal deals with \l{Session Management}{session management}. It is + emitted when the QSessionManager wants the application to commit all its + data. - Usually this means saving all open files, after getting - permission from the user. Furthermore you may want to provide a means - by which the user can cancel the shutdown. + Usually this means saving all open files, after getting permission from + the user. Furthermore you may want to provide a means by which the user + can cancel the shutdown. - Note that you should not exit the application when called. - Instead, the session manager may or may not do this afterwards, - depending on the context. + You should not exit the application within this signal. Instead, + the session manager may or may not do this afterwards, depending on the + context. - \warning Within this signal, no user interaction is possible, \e - unless you ask the \a manager for explicit permission. See - QSessionManager::allowsInteraction() and - QSessionManager::allowsErrorInteraction() for details and example - usage. + \warning Within this signal, no user interaction is possible, \e + unless you ask the \a manager for explicit permission. See + QSessionManager::allowsInteraction() and + QSessionManager::allowsErrorInteraction() for details and example + usage. - Note: You should use Qt::DirectConnection when connecting to this signal. + \note You should use Qt::DirectConnection when connecting to this signal. - \sa isSessionRestored(), sessionId(), saveState(), {Session Management} + \sa isSessionRestored(), sessionId(), saveState(), {Session Management} */ /*! - This function deals with \link session.html session - management\endlink. It is invoked when the QSessionManager wants the - application to commit all its data. + This function deals with \l{Session Management}{session management}. It is + invoked when the QSessionManager wants the application to commit all its + data. - Usually this means saving all open files, after getting - permission from the user. Furthermore you may want to provide a means - by which the user can cancel the shutdown. + Usually this means saving all open files, after getting permission from the + user. Furthermore you may want to provide a means by which the user can + cancel the shutdown. - Note that you should not exit the application within this function. - Instead, the session manager may or may not do this afterwards, - depending on the context. + You should not exit the application within this function. Instead, the + session manager may or may not do this afterwards, depending on the + context. - \warning Within this function, no user interaction is possible, \e - unless you ask the \a manager for explicit permission. See - QSessionManager::allowsInteraction() and - QSessionManager::allowsErrorInteraction() for details and example - usage. + \warning Within this function, no user interaction is possible, \e + unless you ask the \a manager for explicit permission. See + QSessionManager::allowsInteraction() and + QSessionManager::allowsErrorInteraction() for details and example + usage. - The default implementation requests interaction and sends a close - event to all visible top-level widgets. If any event was - rejected, the shutdown is canceled. + The default implementation requests interaction and sends a close event to + all visible top-level widgets. If any event was rejected, the shutdown is + canceled. - \sa isSessionRestored(), sessionId(), saveState(), {Session Management} + \sa isSessionRestored(), sessionId(), saveState(), {Session Management} */ #ifndef QT_NO_SESSIONMANAGER void QApplication::commitData(QSessionManager& manager ) @@ -3273,58 +3253,54 @@ void QApplication::commitData(QSessionManager& manager ) } /*! - \since 4.2 - \fn void QApplication::saveStateRequest(QSessionManager &manager) + \since 4.2 + \fn void QApplication::saveStateRequest(QSessionManager &manager) - This signal deals with \link session.html session - management\endlink. It is invoked when the - \link QSessionManager session manager \endlink wants the application - to preserve its state for a future session. + This signal deals with \l{Session Management}{session management}. It is + invoked when the \l{QSessionManager}{session manager} wants the application + to preserve its state for a future session. - For example, a text editor would create a temporary file that - includes the current contents of its edit buffers, the location of - the cursor and other aspects of the current editing session. + For example, a text editor would create a temporary file that includes the + current contents of its edit buffers, the location of the cursor and other + aspects of the current editing session. - Note that you should never exit the application within this - signal. Instead, the session manager may or may not do this - afterwards, depending on the context. Futhermore, most session - managers will very likely request a saved state immediately after - the application has been started. This permits the session manager - to learn about the application's restart policy. + You should never exit the application within this signal. Instead, the + session manager may or may not do this afterwards, depending on the + context. Futhermore, most session managers will very likely request a saved + state immediately after the application has been started. This permits the + session manager to learn about the application's restart policy. - \warning Within this function, no user interaction is possible, \e - unless you ask the \a manager for explicit permission. See - QSessionManager::allowsInteraction() and - QSessionManager::allowsErrorInteraction() for details. + \warning Within this function, no user interaction is possible, \e + unless you ask the \a manager for explicit permission. See + QSessionManager::allowsInteraction() and + QSessionManager::allowsErrorInteraction() for details. - Note:: You should use Qt::DirectConnection when connecting to this signal. + \note You should use Qt::DirectConnection when connecting to this signal. - \sa isSessionRestored(), sessionId(), commitData(), {Session Management} + \sa isSessionRestored(), sessionId(), commitData(), {Session Management} */ /*! - This function deals with \link session.html session - management\endlink. It is invoked when the - \link QSessionManager session manager \endlink wants the application - to preserve its state for a future session. + This function deals with \l{Session Management}{session management}. It is + invoked when the \l{QSessionManager}{session manager} wants the application + to preserve its state for a future session. - For example, a text editor would create a temporary file that - includes the current contents of its edit buffers, the location of - the cursor and other aspects of the current editing session. + For example, a text editor would create a temporary file that includes the + current contents of its edit buffers, the location of the cursor and other + aspects of the current editing session. - Note that you should never exit the application within this - function. Instead, the session manager may or may not do this - afterwards, depending on the context. Futhermore, most session - managers will very likely request a saved state immediately after - the application has been started. This permits the session manager - to learn about the application's restart policy. + You should never exit the application within this function. Instead, the + session manager may or may not do this afterwards, depending on the + context. Futhermore, most session managers will very likely request a saved + state immediately after the application has been started. This permits the + session manager to learn about the application's restart policy. - \warning Within this function, no user interaction is possible, \e - unless you ask the \a manager for explicit permission. See - QSessionManager::allowsInteraction() and - QSessionManager::allowsErrorInteraction() for details. + \warning Within this function, no user interaction is possible, \e + unless you ask the \a manager for explicit permission. See + QSessionManager::allowsInteraction() and + QSessionManager::allowsErrorInteraction() for details. - \sa isSessionRestored(), sessionId(), commitData(), {Session Management} + \sa isSessionRestored(), sessionId(), commitData(), {Session Management} */ void QApplication::saveState(QSessionManager &manager) @@ -3348,13 +3324,12 @@ void QApplication::setStartDragTime(int ms) \brief the time in milliseconds that a mouse button must be held down before a drag and drop operation will begin - If you support drag and drop in your application, and want to start a - drag and drop operation after the user has held down a mouse button for - a certain amount of time, you should use this property's value as the - delay. + If you support drag and drop in your application, and want to start a drag + and drop operation after the user has held down a mouse button for a + certain amount of time, you should use this property's value as the delay. - Qt also uses this delay internally, e.g. in QTextEdit and QLineEdit, - for starting a drag. + Qt also uses this delay internally, e.g. in QTextEdit and QLineEdit, for + starting a drag. The default value is 500 ms. @@ -3367,9 +3342,9 @@ int QApplication::startDragTime() } /* - Sets the distance after which a drag should start to \a l pixels. + Sets the distance after which a drag should start to \a l pixels. - \sa startDragDistance() + \sa startDragDistance() */ void QApplication::setStartDragDistance(int l) @@ -3380,15 +3355,14 @@ void QApplication::setStartDragDistance(int l) /*! \property QApplication::startDragDistance - If you support drag and drop in your application, and want to start a - drag and drop operation after the user has moved the cursor a certain - distance with a button held down, you should use this property's value - as the minimum distance required. + If you support drag and drop in your application, and want to start a drag + and drop operation after the user has moved the cursor a certain distance + with a button held down, you should use this property's value as the + minimum distance required. - For example, if the mouse position of the click is stored in \c - startPos and the current position (e.g. in the mouse move event) is - \c currentPos, you can find out if a drag should be started with code - like this: + For example, if the mouse position of the click is stored in \c startPos + and the current position (e.g. in the mouse move event) is \c currentPos, + you can find out if a drag should be started with code like this: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 7 @@ -3434,14 +3408,14 @@ int QApplication::startDragDistance() \sa layoutDirection(), isRightToLeft() */ -/*! \property QApplication::layoutDirection - - \brief the default layout direction for this application +/*! + \property QApplication::layoutDirection + \brief the default layout direction for this application - On system start-up, the default layout direction depends on the - application's language. + On system start-up, the default layout direction depends on the + application's language. - \sa QWidget::layoutDirection, isLeftToRight(), isRightToLeft() + \sa QWidget::layoutDirection, isLeftToRight(), isRightToLeft() */ void QApplication::setLayoutDirection(Qt::LayoutDirection direction) @@ -3465,11 +3439,12 @@ Qt::LayoutDirection QApplication::layoutDirection() } -/*! \obsolete +/*! + \obsolete - Strips out vertical alignment flags and transforms an - alignment \a align of Qt::AlignLeft into Qt::AlignLeft or - Qt::AlignRight according to the language used. + Strips out vertical alignment flags and transforms an alignment \a align + of Qt::AlignLeft into Qt::AlignLeft or Qt::AlignRight according to the + language used. */ #ifdef QT3_SUPPORT @@ -3485,8 +3460,8 @@ Qt::Alignment QApplication::horizontalAlignment(Qt::Alignment align) Returns the active application override cursor. - This function returns 0 if no application cursor has been defined - (i.e. the internal cursor stack is empty). + This function returns 0 if no application cursor has been defined (i.e. the + internal cursor stack is empty). \sa setOverrideCursor(), restoreOverrideCursor() */ @@ -3499,9 +3474,10 @@ QCursor *QApplication::overrideCursor() /*! Changes the currently active application override cursor to \a cursor. - This function has no effect if setOverrideCursor() wasn't called. + This function has no effect if setOverrideCursor() was not called. - \sa setOverrideCursor() overrideCursor() restoreOverrideCursor() QWidget::setCursor() + \sa setOverrideCursor(), overrideCursor(), restoreOverrideCursor(), + QWidget::setCursor() */ void QApplication::changeOverrideCursor(const QCursor &cursor) { @@ -3515,8 +3491,8 @@ void QApplication::changeOverrideCursor(const QCursor &cursor) /*! \fn void QApplication::setOverrideCursor(const QCursor &cursor, bool replace) - Use changeOverrideCursor(\a cursor) (if \a replace is true) - or setOverrideCursor(\a cursor) (if \a replace is false). + Use changeOverrideCursor(\a cursor) (if \a replace is true) or + setOverrideCursor(\a cursor) (if \a replace is false). */ /*! @@ -3524,29 +3500,26 @@ void QApplication::changeOverrideCursor(const QCursor &cursor) the value that was set to exit() (which is 0 if exit() is called via quit()). - It is necessary to call this function to start event handling. The - main event loop receives events from the window system and - dispatches these to the application widgets. + It is necessary to call this function to start event handling. The main + event loop receives events from the window system and dispatches these to + the application widgets. + + Generally, no user interaction can take place before calling exec(). As a + special case, modal widgets like QMessageBox can be used before calling + exec(), because modal widgets call exec() to start a local event loop. - Generally speaking, no user interaction can take place before - calling exec(). As a special case, modal widgets like QMessageBox - can be used before calling exec(), because modal widgets call - exec() to start a local event loop. - - To make your application perform idle processing, i.e. executing a - special function whenever there are no pending events, use a - QTimer with 0 timeout. More advanced idle processing schemes can - be achieved using processEvents(). + To make your application perform idle processing, i.e., executing a special + function whenever there are no pending events, use a QTimer with 0 timeout. + More advanced idle processing schemes can be achieved using processEvents(). We recommend that you connect clean-up code to the - \l{QCoreApplication::}{aboutToQuit()} signal, instead of putting it in - your application's \c{main()} function because on some platforms the - QApplication::exec() call may not return. For example, on Windows - when the user logs off, the system terminates the process after Qt - closes all top-level windows. Hence, there is no guarantee that the - application will have time to exit its event loop and execute code at - the end of the \c{main()} function after the QApplication::exec() - call. + \l{QCoreApplication::}{aboutToQuit()} signal, instead of putting it in your + application's \c{main()} function because on some platforms the + QApplication::exec() call may not return. For example, on Windows when the + user logs off, the system terminates the process after Qt closes all + top-level windows. Hence, there is no guarantee that the application will + have time to exit its event loop and execute code at the end of the + \c{main()} function after the QApplication::exec() call. \sa quitOnLastWindowClosed, quit(), exit(), processEvents(), QCoreApplication::exec() @@ -4094,101 +4067,98 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) /*! - \class QSessionManager - \brief The QSessionManager class provides access to the session manager. - - \ingroup application - \ingroup environment - - A session manager in a desktop environment (in which Qt GUI - applications live) keeps track of a session, which is a group of - running applications, each of which has a particular state. The - state of an application contains (most notably) the documents the - application has open and the position and size of its windows. - - The session manager is used to save the session, e.g. when the - machine is shut down, and to restore a session, e.g. when the - machine is started up. We recommend that you use QSettings to save - an individual application's settings, e.g. window positions, - recently used files, etc. When the application is restarted by the - session manager, you can restore the settings. - - QSessionManager provides an interface between the application - and the session manager so that the program can work well with the - session manager. In Qt, session management requests for action are - handled by the two virtual functions QApplication::commitData() - and QApplication::saveState(). Both provide a reference to a - session manager object as argument, to allow the application to - communicate with the session manager. The session manager can only - be accessed through these functions. - - No user interaction is possible \e unless the application gets - explicit permission from the session manager. You ask for permission - by calling allowsInteraction() or, if it's really urgent, - allowsErrorInteraction(). Qt does not enforce this, but the session - manager may. - - You can try to abort the shutdown process by calling cancel(). The - default commitData() function does this if some top-level window - rejected its closeEvent(). - - For sophisticated session managers provided on Unix/X11, QSessionManager - offers further possibilities to fine-tune an application's session - management behavior: setRestartCommand(), setDiscardCommand(), - setRestartHint(), setProperty(), requestPhase2(). See the respective - function descriptions for further details. - - \sa QApplication, {Session Management} + \class QSessionManager + \brief The QSessionManager class provides access to the session manager. + + \ingroup application + \ingroup environment + + A session manager in a desktop environment (in which Qt GUI applications + live) keeps track of a session, which is a group of running applications, + each of which has a particular state. The state of an application contains + (most notably) the documents the application has open and the position and + size of its windows. + + The session manager is used to save the session, e.g., when the machine is + shut down, and to restore a session, e.g., when the machine is started up. + We recommend that you use QSettings to save an application's settings, + for example, window positions, recently used files, etc. When the + application is restarted by the session manager, you can restore the + settings. + + QSessionManager provides an interface between the application and the + session manager so that the program can work well with the session manager. + In Qt, session management requests for action are handled by the two + virtual functions QApplication::commitData() and QApplication::saveState(). + Both provide a reference to a session manager object as argument, to allow + the application to communicate with the session manager. The session + manager can only be accessed through these functions. + + No user interaction is possible \e unless the application gets explicit + permission from the session manager. You ask for permission by calling + allowsInteraction() or, if it is really urgent, allowsErrorInteraction(). + Qt does not enforce this, but the session manager may. + + You can try to abort the shutdown process by calling cancel(). The default + commitData() function does this if some top-level window rejected its + closeEvent(). + + For sophisticated session managers provided on Unix/X11, QSessionManager + offers further possibilities to fine-tune an application's session + management behavior: setRestartCommand(), setDiscardCommand(), + setRestartHint(), setProperty(), requestPhase2(). See the respective + function descriptions for further details. + + \sa QApplication, {Session Management} */ /*! \enum QSessionManager::RestartHint - This enum type defines the circumstances under which this - application wants to be restarted by the session manager. The - current values are + This enum type defines the circumstances under which this application wants + to be restarted by the session manager. The current values are: - \value RestartIfRunning if the application is still running when - the session is shut down, it wants to be restarted at the start of - the next session. + \value RestartIfRunning If the application is still running when the + session is shut down, it wants to be restarted + at the start of the next session. - \value RestartAnyway the application wants to be started at the - start of the next session, no matter what. (This is useful for - utilities that run just after startup and then quit.) + \value RestartAnyway The application wants to be started at the + start of the next session, no matter what. + (This is useful for utilities that run just + after startup and then quit.) - \value RestartImmediately the application wants to be started - immediately whenever it is not running. + \value RestartImmediately The application wants to be started immediately + whenever it is not running. - \value RestartNever the application does not want to be restarted - automatically. + \value RestartNever The application does not want to be restarted + automatically. - The default hint is \c RestartIfRunning. + The default hint is \c RestartIfRunning. */ /*! - \fn QString QSessionManager::sessionId() const + \fn QString QSessionManager::sessionId() const - Returns the identifier of the current session. + Returns the identifier of the current session. - If the application has been restored from an earlier session, this - identifier is the same as it was in that earlier session. + If the application has been restored from an earlier session, this + identifier is the same as it was in the earlier session. - \sa sessionKey(), QApplication::sessionId() - */ + \sa sessionKey(), QApplication::sessionId() +*/ /*! - \fn QString QSessionManager::sessionKey() const + \fn QString QSessionManager::sessionKey() const - Returns the session key in the current session. + Returns the session key in the current session. - If the application has been restored from an earlier session, this - key is the same as it was when the previous session ended. + If the application has been restored from an earlier session, this key is + the same as it was when the previous session ended. - The session key changes with every call of commitData() or - saveState(). + The session key changes with every call of commitData() or saveState(). - \sa sessionId(), QApplication::sessionKey() - */ + \sa sessionId(), QApplication::sessionKey() +*/ /*! \fn void* QSessionManager::handle() const @@ -4197,120 +4167,116 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) */ /*! - \fn bool QSessionManager::allowsInteraction() + \fn bool QSessionManager::allowsInteraction() - Asks the session manager for permission to interact with the - user. Returns true if interaction is permitted; otherwise - returns false. + Asks the session manager for permission to interact with the user. Returns + true if interaction is permitted; otherwise returns false. - The rationale behind this mechanism is to make it possible to - synchronize user interaction during a shutdown. Advanced session - managers may ask all applications simultaneously to commit their - data, resulting in a much faster shutdown. + The rationale behind this mechanism is to make it possible to synchronize + user interaction during a shutdown. Advanced session managers may ask all + applications simultaneously to commit their data, resulting in a much + faster shutdown. - When the interaction is completed we strongly recommend releasing the - user interaction semaphore with a call to release(). This way, other - applications may get the chance to interact with the user while your - application is still busy saving data. (The semaphore is implicitly - released when the application exits.) + When the interaction is completed we strongly recommend releasing the user + interaction semaphore with a call to release(). This way, other + applications may get the chance to interact with the user while your + application is still busy saving data. (The semaphore is implicitly + released when the application exits.) - If the user decides to cancel the shutdown process during the - interaction phase, you must tell the session manager that this has - happened by calling cancel(). + If the user decides to cancel the shutdown process during the interaction + phase, you must tell the session manager that this has happened by calling + cancel(). - Here's an example of how an application's QApplication::commitData() - might be implemented: + Here's an example of how an application's QApplication::commitData() might + be implemented: - \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 8 + \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 8 - If an error occurred within the application while saving its data, - you may want to try allowsErrorInteraction() instead. + If an error occurred within the application while saving its data, you may + want to try allowsErrorInteraction() instead. - \sa QApplication::commitData(), release(), cancel() + \sa QApplication::commitData(), release(), cancel() */ /*! - \fn bool QSessionManager::allowsErrorInteraction() + \fn bool QSessionManager::allowsErrorInteraction() - Returns true if error interaction is permitted; otherwise returns false. + Returns true if error interaction is permitted; otherwise returns false. - This is similar to allowsInteraction(), but also enables the application - to tell the user about any errors that occur. Session managers - may give error interaction requests higher priority, which means that it - is more likely that an error interaction is permitted. However, you are - still not guaranteed that the session manager will allow interaction. + This is similar to allowsInteraction(), but also enables the application to + tell the user about any errors that occur. Session managers may give error + interaction requests higher priority, which means that it is more likely + that an error interaction is permitted. However, you are still not + guaranteed that the session manager will allow interaction. - \sa allowsInteraction(), release(), cancel() + \sa allowsInteraction(), release(), cancel() */ /*! - \fn void QSessionManager::release() + \fn void QSessionManager::release() - Releases the session manager's interaction semaphore after an - interaction phase. + Releases the session manager's interaction semaphore after an interaction + phase. - \sa allowsInteraction(), allowsErrorInteraction() + \sa allowsInteraction(), allowsErrorInteraction() */ /*! - \fn void QSessionManager::cancel() - - Tells the session manager to cancel the shutdown process. Applications - should not call this function without first asking the user. + \fn void QSessionManager::cancel() - \sa allowsInteraction(), allowsErrorInteraction() + Tells the session manager to cancel the shutdown process. Applications + should not call this function without asking the user first. + \sa allowsInteraction(), allowsErrorInteraction() */ /*! - \fn void QSessionManager::setRestartHint(RestartHint hint) + \fn void QSessionManager::setRestartHint(RestartHint hint) - Sets the application's restart hint to \a hint. On application - startup the hint is set to \c RestartIfRunning. + Sets the application's restart hint to \a hint. On application startup, the + hint is set to \c RestartIfRunning. - Note that these flags are only hints, a session manager may or may - not respect them. + \note These flags are only hints, a session manager may or may not respect + them. - We recommend setting the restart hint in QApplication::saveState() - because most session managers perform a checkpoint shortly after an - application's startup. + We recommend setting the restart hint in QApplication::saveState() because + most session managers perform a checkpoint shortly after an application's + startup. - \sa restartHint() + \sa restartHint() */ /*! - \fn QSessionManager::RestartHint QSessionManager::restartHint() const + \fn QSessionManager::RestartHint QSessionManager::restartHint() const - Returns the application's current restart hint. The default is - \c RestartIfRunning. + Returns the application's current restart hint. The default is + \c RestartIfRunning. - \sa setRestartHint() + \sa setRestartHint() */ /*! - \fn void QSessionManager::setRestartCommand(const QStringList& command) + \fn void QSessionManager::setRestartCommand(const QStringList& command) - If the session manager is capable of restoring sessions it will - execute \a command in order to restore the application. The command - defaults to + If the session manager is capable of restoring sessions it will execute + \a command in order to restore the application. The command defaults to \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 9 - The \c -session option is mandatory; otherwise QApplication cannot - tell whether it has been restored or what the current session - identifier is. See QApplication::isSessionRestored() and - QApplication::sessionId() for details. + The \c -session option is mandatory; otherwise QApplication cannot tell + whether it has been restored or what the current session identifier is. + See QApplication::isSessionRestored() and QApplication::sessionId() for + details. - If your application is very simple, it may be possible to store the - entire application state in additional command line options. This - is usually a very bad idea because command lines are often limited - to a few hundred bytes. Instead, use QSettings, or temporary files - or a database for this purpose. By marking the data with the unique - sessionId(), you will be able to restore the application in a future - session. + If your application is very simple, it may be possible to store the entire + application state in additional command line options. This is usually a + very bad idea because command lines are often limited to a few hundred + bytes. Instead, use QSettings, temporary files, or a database for this + purpose. By marking the data with the unique sessionId(), you will be able + to restore the application in a future session. - \sa restartCommand(), setDiscardCommand(), setRestartHint() + \sa restartCommand(), setDiscardCommand(), setRestartHint() */ /*! @@ -4318,8 +4284,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) Returns the currently set restart command. - To iterate over the list, you can use the \l foreach - pseudo-keyword: + To iterate over the list, you can use the \l foreach pseudo-keyword: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 10 @@ -4327,11 +4292,11 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) */ /*! - \fn void QSessionManager::setDiscardCommand(const QStringList& list) + \fn void QSessionManager::setDiscardCommand(const QStringList& list) - Sets the discard command to the given \a list. + Sets the discard command to the given \a list. - \sa discardCommand(), setRestartCommand() + \sa discardCommand(), setRestartCommand() */ @@ -4340,8 +4305,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) Returns the currently set discard command. - To iterate over the list, you can use the \l foreach - pseudo-keyword: + To iterate over the list, you can use the \l foreach pseudo-keyword: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 11 @@ -4349,53 +4313,51 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) */ /*! - \fn void QSessionManager::setManagerProperty(const QString &name, const QString &value) - \overload + \fn void QSessionManager::setManagerProperty(const QString &name, const QString &value) + \overload - Low-level write access to the application's identification and state - records are kept in the session manager. + Low-level write access to the application's identification and state + records are kept in the session manager. - The property called \a name has its value set to the string \a value. + The property called \a name has its value set to the string \a value. */ /*! - \fn void QSessionManager::setManagerProperty(const QString& name, - const QStringList& value) + \fn void QSessionManager::setManagerProperty(const QString& name, + const QStringList& value) - Low-level write access to the application's identification and state - record are kept in the session manager. + Low-level write access to the application's identification and state record + are kept in the session manager. - The property called \a name has its value set to the string list \a value. + The property called \a name has its value set to the string list \a value. */ /*! - \fn bool QSessionManager::isPhase2() const + \fn bool QSessionManager::isPhase2() const - Returns true if the session manager is currently performing a second - session management phase; otherwise returns false. + Returns true if the session manager is currently performing a second + session management phase; otherwise returns false. - \sa requestPhase2() + \sa requestPhase2() */ /*! - \fn void QSessionManager::requestPhase2() + \fn void QSessionManager::requestPhase2() - Requests a second session management phase for the application. The - application may then return immediately from the - QApplication::commitData() or QApplication::saveState() function, - and they will be called again once most or all other applications have - finished their session management. + Requests a second session management phase for the application. The + application may then return immediately from the QApplication::commitData() + or QApplication::saveState() function, and they will be called again once + most or all other applications have finished their session management. - The two phases are useful for applications such as the X11 window manager - that need to store information about another application's windows - and therefore have to wait until these applications have completed their - respective session management tasks. + The two phases are useful for applications such as the X11 window manager + that need to store information about another application's windows and + therefore have to wait until these applications have completed their + respective session management tasks. - Note that if another application has requested a second phase it - may get called before, simultaneously with, or after your - application's second phase. + \note If another application has requested a second phase it may get called + before, simultaneously with, or after your application's second phase. - \sa isPhase2() + \sa isPhase2() */ /***************************************************************************** @@ -4588,15 +4550,14 @@ void QSessionManager::requestPhase2() /*! \fn bool QApplication::hasGlobalMouseTracking() - This feature does not exist anymore. This function - always returns true in Qt 4. + This feature does not exist anymore. This function always returns true + in Qt 4. */ /*! \fn void QApplication::setGlobalMouseTracking(bool dummy) - This function does nothing in Qt 4. The \a dummy parameter - is ignored. + This function does nothing in Qt 4. The \a dummy parameter is ignored. */ /*! @@ -4634,15 +4595,14 @@ void QSessionManager::requestPhase2() /*! \fn const QColor &QApplication::winStyleHighlightColor() - Use qApp->palette().color(QPalette::Active, QPalette::Highlight) - instead. + Use qApp->palette().color(QPalette::Active, QPalette::Highlight) instead. */ /*! \fn QWidget *QApplication::widgetAt(int x, int y, bool child) - Use the two-argument widgetAt() overload to get the child widget. - To get the top-level widget do this: + Use the two-argument widgetAt() overload to get the child widget. To get + the top-level widget do this: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 12 */ @@ -4650,8 +4610,8 @@ void QSessionManager::requestPhase2() /*! \fn QWidget *QApplication::widgetAt(const QPoint &point, bool child) - Use the single-argument widgetAt() overload to get the child widget. - To get the top-level widget do this: + Use the single-argument widgetAt() overload to get the child widget. To get + the top-level widget do this: \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 13 */ @@ -4723,10 +4683,9 @@ void QApplicationPrivate::emitLastWindowClosed() Sets whether Qt should use focus navigation suitable for use with a minimal keypad. - If \a enable is true, Qt::Key_Up and Qt::Key_Down are used to - change focus. + If \a enable is true, Qt::Key_Up and Qt::Key_Down are used to change focus. - This feature is only available in Qt for Embedded Linux. + This feature is available in Qt for Embedded Linux only. \sa keypadNavigationEnabled() */ @@ -4739,7 +4698,8 @@ void QApplication::setKeypadNavigationEnabled(bool enable) Returns true if Qt is set to use keypad navigation; otherwise returns false. The default is false. - This feature is only available in Qt for Embedded Linux. + This feature is available in Qt for Embedded Linux only. + \sa setKeypadNavigationEnabled() */ bool QApplication::keypadNavigationEnabled() @@ -4762,12 +4722,12 @@ bool QApplication::keypadNavigationEnabled() On Mac OS X, this works more at the application level and will cause the application icon to bounce in the dock. - On Windows this causes the window's taskbar entry to flash for a time. If \a - msec is zero, the flashing will stop and the taskbar entry will turn a + On Windows this causes the window's taskbar entry to flash for a time. If + \a msec is zero, the flashing will stop and the taskbar entry will turn a different color (currently orange). - On X11, this will cause the window to be marked as "demands attention", - the window must not be hidden (i.e. not have hide() called on it, but be + On X11, this will cause the window to be marked as "demands attention", the + window must not be hidden (i.e. not have hide() called on it, but be visible in some sort of way) in order for this to work. */ @@ -4775,18 +4735,16 @@ bool QApplication::keypadNavigationEnabled() \property QApplication::cursorFlashTime \brief the text cursor's flash (blink) time in milliseconds - The flash time is the time required to display, invert and - restore the caret display. Usually the text cursor is displayed - for half the cursor flash time, then hidden for the same amount - of time, but this may vary. + The flash time is the time required to display, invert and restore the + caret display. Usually the text cursor is displayed for half the cursor + flash time, then hidden for the same amount of time, but this may vary. - The default value on X11 is 1000 milliseconds. On Windows, the - control panel value is used. Widgets should not cache this value - since it may be changed at any time by the user changing the - global desktop settings. + The default value on X11 is 1000 milliseconds. On Windows, the control + panel value is used. Widgets should not cache this value since it may be + changed at any time by the user changing the global desktop settings. - Note that on Microsoft Windows, setting this property sets the - cursor flash time for all applications. + \note On Microsoft Windows, setting this property sets the cursor flash + time for all applications. */ /*! @@ -4794,11 +4752,11 @@ bool QApplication::keypadNavigationEnabled() \brief the time limit in milliseconds that distinguishes a double click from two consecutive mouse clicks - The default value on X11 is 400 milliseconds. On Windows and Mac - OS X, the operating system's value is used. + The default value on X11 is 400 milliseconds. On Windows and Mac OS X, the + operating system's value is used. - On Microsoft Windows, calling this function sets the - double click interval for all applications. + On Microsoft Windows, calling this function sets the double click interval + for all applications. */ /*! @@ -4816,15 +4774,13 @@ bool QApplication::keypadNavigationEnabled() \brief the number of lines to scroll a widget, when the mouse wheel is rotated. - If the value exceeds the widget's number of visible lines, the - widget should interpret the scroll operation as a single \e{page - up} or \e{page down}. If the widget is an \l{QAbstractItemView} - {item view class}, then the result of scrolling one \e line - depends on the setting of the widget's - \l{QAbstractItemView::verticalScrollMode()} {scroll mode}. Scroll - one \e line can mean \l{QAbstractItemView::ScrollPerItem} {scroll - one item} or \l{QAbstractItemView::ScrollPerPixel} {scroll one - pixel}. + If the value exceeds the widget's number of visible lines, the widget + should interpret the scroll operation as a single \e{page up} or + \e{page down}. If the widget is an \l{QAbstractItemView}{item view class}, + then the result of scrolling one \e line depends on the setting of the + widget's \l{QAbstractItemView::verticalScrollMode()}{scroll mode}. Scroll + one \e line can mean \l{QAbstractItemView::ScrollPerItem}{scroll one item} + or \l{QAbstractItemView::ScrollPerPixel}{scroll one pixel}. By default, this property has a value of 3. */ @@ -4832,11 +4788,11 @@ bool QApplication::keypadNavigationEnabled() /*! \fn void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) - Enables the UI effect \a effect if \a enable is true, otherwise - the effect will not be used. + Enables the UI effect \a effect if \a enable is true, otherwise the effect + will not be used. - Note: All effects are disabled on screens running at less than - 16-bit color depth. + \note All effects are disabled on screens running at less than 16-bit color + depth. \sa isEffectEnabled(), Qt::UIEffect, setDesktopSettingsAware() */ @@ -4846,11 +4802,11 @@ bool QApplication::keypadNavigationEnabled() Returns true if \a effect is enabled; otherwise returns false. - By default, Qt will try to use the desktop settings. Call - setDesktopSettingsAware(false) to prevent this. + By default, Qt will try to use the desktop settings. To prevent this, call + setDesktopSettingsAware(false). - Note: All effects are disabled on screens running at less than - 16-bit color depth. + \note All effects are disabled on screens running at less than 16-bit color + depth. \sa setEffectEnabled(), Qt::UIEffect */ @@ -4858,8 +4814,7 @@ bool QApplication::keypadNavigationEnabled() /*! \fn QWidget *QApplication::mainWidget() - Returns the main application widget, or 0 if there is no main - widget. + Returns the main application widget, or 0 if there is no main widget. */ /*! @@ -4867,19 +4822,17 @@ bool QApplication::keypadNavigationEnabled() Sets the application's main widget to \a mainWidget. - In most respects the main widget is like any other widget, except - that if it is closed, the application exits. Note that - QApplication does \e not take ownership of the \a mainWidget, so - if you create your main widget on the heap you must delete it - yourself. + In most respects the main widget is like any other widget, except that if + it is closed, the application exits. QApplication does \e not take + ownership of the \a mainWidget, so if you create your main widget on the + heap you must delete it yourself. - You need not have a main widget; connecting lastWindowClosed() to - quit() is an alternative. + You need not have a main widget; connecting lastWindowClosed() to quit() + is an alternative. - For X11, this function also resizes and moves the main widget - according to the \e -geometry command-line option, so you should - set the default geometry (using \l QWidget::setGeometry()) before - calling setMainWidget(). + For X11, this function also resizes and moves the main widget according + to the \e -geometry command-line option, so you should set the default + geometry (using \l QWidget::setGeometry()) before calling setMainWidget(). \sa mainWidget(), exec(), quit() */ @@ -4887,8 +4840,8 @@ bool QApplication::keypadNavigationEnabled() /*! \fn void QApplication::beep() - Sounds the bell, using the default volume and sound. The function - is \e not available in Qt for Embedded Linux. + Sounds the bell, using the default volume and sound. The function is \e not + available in Qt for Embedded Linux. */ /*! @@ -4896,26 +4849,25 @@ bool QApplication::keypadNavigationEnabled() Sets the application override cursor to \a cursor. - Application override cursors are intended for showing the user - that the application is in a special state, for example during an - operation that might take some time. + Application override cursors are intended for showing the user that the + application is in a special state, for example during an operation that + might take some time. - This cursor will be displayed in all the application's widgets - until restoreOverrideCursor() or another setOverrideCursor() is - called. + This cursor will be displayed in all the application's widgets until + restoreOverrideCursor() or another setOverrideCursor() is called. - Application cursors are stored on an internal stack. - setOverrideCursor() pushes the cursor onto the stack, and - restoreOverrideCursor() pops the active cursor off the - stack. changeOverrideCursor() changes the curently active - application override cursor. Every setOverrideCursor() must + Application cursors are stored on an internal stack. setOverrideCursor() + pushes the cursor onto the stack, and restoreOverrideCursor() pops the + active cursor off the stack. changeOverrideCursor() changes the curently + active application override cursor. Every setOverrideCursor() must eventually be followed by a corresponding restoreOverrideCursor(), otherwise the stack will never be emptied. Example: \snippet doc/src/snippets/code/src_gui_kernel_qapplication_x11.cpp 0 - \sa overrideCursor() restoreOverrideCursor() changeOverrideCursor() QWidget::setCursor() + \sa overrideCursor(), restoreOverrideCursor(), changeOverrideCursor(), + QWidget::setCursor() */ /*! @@ -4924,9 +4876,8 @@ bool QApplication::keypadNavigationEnabled() Undoes the last setOverrideCursor(). If setOverrideCursor() has been called twice, calling - restoreOverrideCursor() will activate the first cursor set. - Calling this function a second time restores the original widgets' - cursors. + restoreOverrideCursor() will activate the first cursor set. Calling this + function a second time restores the original widgets' cursors. \sa setOverrideCursor(), overrideCursor() */ @@ -4936,9 +4887,9 @@ bool QApplication::keypadNavigationEnabled() \relates QApplication A global pointer referring to the unique application object. It is - equivalent to the pointer returned by the - QCoreApplication::instance() function except that, in GUI applications, - it is a pointer to a QApplication instance. + equivalent to the pointer returned by the QCoreApplication::instance() + function except that, in GUI applications, it is a pointer to a + QApplication instance. Only one application object can be created. @@ -4950,8 +4901,8 @@ bool QApplication::keypadNavigationEnabled() // ************************************************************************ /*! - This function replaces the QInputContext instance used by the - application with \a inputContext. + This function replaces the QInputContext instance used by the application + with \a inputContext. \sa inputContext() */ @@ -4982,7 +4933,11 @@ QInputContext *QApplication::inputContext() const return 0; if (!d->inputContext) { QApplication *that = const_cast<QApplication *>(this); - that->d_func()->inputContext = QInputContextFactory::create(X11->default_im, that); + QInputContext *qic = QInputContextFactory::create(X11->default_im, that); + // fallback to default X Input Method. + if (!qic) + qic = QInputContextFactory::create(QLatin1String("xim"), that); + that->d_func()->inputContext = qic; } #endif return d->inputContext; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 1df442f..b1270bc 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -829,8 +829,11 @@ bool QApplicationPrivate::x11_apply_settings() QColor(strlist[i])); } - if (groupCount == QPalette::NColorGroups) - QApplicationPrivate::setSystemPalette(pal); + // ### Fix properly for 4.6 + if (!(QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle"))) { + if (groupCount == QPalette::NColorGroups) + QApplicationPrivate::setSystemPalette(pal); + } int kdeSessionVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt(); @@ -887,11 +890,15 @@ bool QApplicationPrivate::x11_apply_settings() } } + static QString currentStyleName = stylename; if (QCoreApplication::startingUp()) { if (!stylename.isEmpty() && !QApplicationPrivate::styleOverride) QApplicationPrivate::styleOverride = new QString(stylename); } else { - QApplication::setStyle(stylename); + if (currentStyleName != stylename) { + currentStyleName = stylename; + QApplication::setStyle(stylename); + } } int num = @@ -1355,8 +1362,10 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue); } - QApplicationPrivate::setSystemPalette(pal); - + // QGtkStyle sets it's own system palette + if (!(QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle"))) { + QApplicationPrivate::setSystemPalette(pal); + } QColor::setAllowX11ColorNames(allowX11ColorNames); } @@ -3351,15 +3360,24 @@ int QApplication::x11ProcessEvent(XEvent* event) // update the size for desktop widget int scr = X11->ptrXRRRootToScreen(X11->display, event->xany.window); - QWidget *w = desktop()->screen(scr); + QDesktopWidget *desktop = QApplication::desktop(); + QWidget *w = desktop->screen(scr); QSize oldSize(w->size()); w->data->crect.setWidth(DisplayWidth(X11->display, scr)); w->data->crect.setHeight(DisplayHeight(X11->display, scr)); - if (w->size() != oldSize) { - QResizeEvent e(w->size(), oldSize); - QApplication::sendEvent(w, &e); - emit desktop()->resized(scr); - } + QVarLengthArray<QRect> oldSizes(desktop->numScreens()); + for (int i = 0; i < desktop->numScreens(); ++i) + oldSizes[i] = desktop->screenGeometry(i); + QResizeEvent e(w->size(), oldSize); + QApplication::sendEvent(w, &e); + for (int i = 0; i < qMin(oldSizes.count(), desktop->numScreens()); ++i) { + if (oldSizes[i] != desktop->screenGeometry(i)) + emit desktop->resized(i); + } + for (int i = oldSizes.count(); i < desktop->numScreens(); ++i) + emit desktop->resized(i); // added + for (int i = desktop->numScreens(); i < oldSizes.count(); ++i) + emit desktop->resized(i); // removed } #endif // QT_NO_XRANDR diff --git a/src/gui/kernel/qcocoaapplication_mac.mm b/src/gui/kernel/qcocoaapplication_mac.mm index f95f004f..a3cc2c1 100644 --- a/src/gui/kernel/qcocoaapplication_mac.mm +++ b/src/gui/kernel/qcocoaapplication_mac.mm @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) - ** - ** This file is part of the QtGui module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 @@ -36,11 +36,11 @@ ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ /**************************************************************************** ** diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 650ebbd..6571068 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) - ** - ** This file is part of the QtGui module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 @@ -36,11 +36,11 @@ ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ /**************************************************************************** ** @@ -107,6 +107,8 @@ static void cleanupCocoaApplicationDelegate() - (id)init { self = [super init]; + if (self) + inLaunch = true; return self; } @@ -198,12 +200,26 @@ static void cleanupCocoaApplicationDelegate() return reply; } +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification +{ + Q_UNUSED(aNotification); + inLaunch = false; +} + - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { - unsigned int ix; - for( ix = 0; ix < [filenames count]; ix++) { - NSString *fileName = [filenames objectAtIndex:ix]; - qApp->postEvent(qApp, new QFileOpenEvent(QCFString::toQString((CFStringRef)fileName))); + for (NSString *fileName in filenames) { + QString qtFileName = qt_mac_NSStringToQString(fileName); + if (inLaunch) { + // We need to be careful because Cocoa will be nice enough to take + // command line arguments and send them to us as events. Given the history + // of Qt Applications, this will result in behavior people don't want, as + // they might be doing the opening themselves with the command line parsing. + if (qApp->arguments().contains(qtFileName)) + continue; + } + QFileOpenEvent foe(qtFileName); + qt_sendSpontaneousEvent(qAppInstance(), &foe); } if (reflectionDelegate && diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h index c5336f1..fca2a15 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h @@ -107,6 +107,7 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); NSMenu *dockMenu; QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader; id <NSApplicationDelegate> reflectionDelegate; + bool inLaunch; } + (QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate)*)sharedDelegate; - (void)setDockMenu:(NSMenu *)newMenu; diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 7ecb765..e836286 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) - ** - ** This file is part of the QtGui module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 @@ -36,11 +36,11 @@ ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ #include "qmacdefines_mac.h" #ifdef QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm index 6aeee34..c69826f 100644 --- a/src/gui/kernel/qcocoapanel_mac.mm +++ b/src/gui/kernel/qcocoapanel_mac.mm @@ -43,10 +43,16 @@ #ifdef QT_MAC_USE_COCOA #import <private/qt_cocoa_helpers_mac_p.h> #import <private/qcocoawindow_mac_p.h> +#import <private/qcocoawindowdelegate_mac_p.h> +#import <private/qcocoaview_mac_p.h> #import <private/qcocoawindowcustomthemeframe_mac_p.h> #include <QtGui/QWidget> +QT_FORWARD_DECLARE_CLASS(QWidget); +QT_BEGIN_NAMESPACE +extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm +QT_END_NAMESPACE QT_USE_NAMESPACE @implementation QT_MANGLE_NAMESPACE(QCocoaPanel) @@ -60,18 +66,115 @@ QT_USE_NAMESPACE return !(isPopup || isToolTip); } +/*********************************************************************** + BEGIN Copy and Paste between QCocoaWindow and QCocoaPanel + This is a bit unfortunate, but thanks to the dynamic dispatch we + have to duplicate this code or resort to really silly forwarding methods +**************************************************************************/ + +/* + The methods keyDown, keyUp, and flagsChanged... These really shouldn't ever + get hit. We automatically say we can be first responder if we are a window. + So, the handling should get handled by the view. This is here more as a + last resort (i.e., this is code that can potentially be removed). + */ + +- (void)keyDown:(NSEvent *)theEvent +{ + bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]); + if (!keyOK) + [super keyDown:theEvent]; +} + +- (void)keyUp:(NSEvent *)theEvent +{ + bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]); + if (!keyOK) + [super keyUp:theEvent]; +} + +- (void)flagsChanged:(NSEvent *)theEvent +{ + qt_dispatchModifiersChanged(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]); + [super flagsChanged:theEvent]; +} + + +- (void)tabletProximity:(NSEvent *)tabletEvent +{ + qt_dispatchTabletProximityEvent(tabletEvent); +} + - (void)sendEvent:(NSEvent *)event { [self retain]; - [super sendEvent:event]; + + QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; + QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget)); + Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]); + + // sometimes need to redirect mouse events to the popup. + QWidget *popup = qAppInstance()->activePopupWidget(); + if (popup && popup != widget) { + switch([event type]) + { + case NSLeftMouseDown: + qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonPress, mouseButton); + // Don't call super here. This prevents us from getting the mouseUp event, + // which we need to send even if the mouseDown event was not accepted. + // (this is standard Qt behavior.) + break; + case NSRightMouseDown: + case NSOtherMouseDown: + if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonPress, mouseButton)) + [super sendEvent:event]; + break; + case NSLeftMouseUp: + case NSRightMouseUp: + case NSOtherMouseUp: + if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonRelease, mouseButton)) + [super sendEvent:event]; + break; + case NSMouseMoved: + qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, Qt::NoButton); + break; + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSOtherMouseDragged: + [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->view = view; + [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent = event; + if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, mouseButton)) + [super sendEvent:event]; + break; + default: + [super sendEvent:event]; + break; + } + } else { + [super sendEvent:event]; + } qt_mac_dispatchNCMouseMessage(self, event, [self QT_MANGLE_NAMESPACE(qt_qwidget)], leftButtonIsRightButton); + + [self release]; } +- (BOOL)makeFirstResponder:(NSResponder *)responder +{ + // For some reason Cocoa wants to flip the first responder + // when Qt doesn't want to, sorry, but "No" :-) + if (responder == nil && qApp->focusWidget()) + return NO; + return [super makeFirstResponder:responder]; +} + +/*********************************************************************** + END Copy and Paste between QCocoaWindow and QCocoaPanel +***********************************************************************/ + (Class)frameViewClassForStyleMask:(NSUInteger)styleMask { if (styleMask & QtMacCustomizeWindow) - return [QCocoaWindowCustomThemeFrame class]; + return [QT_MANGLE_NAMESPACE(QCocoaWindowCustomThemeFrame) class]; return [super frameViewClassForStyleMask:styleMask]; } diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index df42e79..e84af90 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -181,6 +181,7 @@ QT_FORWARD_DECLARE_CLASS(QAbstractScrollAreaPrivate) QT_FORWARD_DECLARE_CLASS(QPaintEvent) QT_FORWARD_DECLARE_CLASS(QPainter) QT_FORWARD_DECLARE_CLASS(QHoverEvent) +QT_FORWARD_DECLARE_CLASS(QCursor) QT_USE_NAMESPACE extern "C" { extern NSString *NSTextInputReplacementRangeAttributeName; @@ -236,6 +237,34 @@ extern "C" { } } +- (void)resetCursorRects +{ + QWidget *cursorWidget = qwidget; + + if (cursorWidget->testAttribute(Qt::WA_TransparentForMouseEvents)) + cursorWidget = QApplication::widgetAt(qwidget->mapToGlobal(qwidget->rect().center())); + + if (cursorWidget == 0) + return; + + if (!cursorWidget->testAttribute(Qt::WA_SetCursor)) { + [super resetCursorRects]; + return; + } + + QRegion mask = qt_widget_private(cursorWidget)->extra->mask; + NSCursor *nscursor = static_cast<NSCursor *>(nsCursorForQCursor(cursorWidget->cursor())); + if (mask.isEmpty()) { + [self addCursorRect:[qt_mac_nativeview_for(cursorWidget) visibleRect] cursor:nscursor]; + } else { + const QVector<QRect> &rects = mask.rects(); + for (int i = 0; i < rects.size(); ++i) { + const QRect &rect = rects.at(i); + [self addCursorRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()) cursor:nscursor]; + } + } +} + - (void)removeDropData { if (dropData) { @@ -300,11 +329,13 @@ extern "C" { NSPoint windowPoint = [sender draggingLocation]; NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; + NSDragOperation nsActions = [sender draggingSourceOperationMask]; QPoint posDrag(localPoint.x, localPoint.y); - if (qt_mac_mouse_inside_answer_rect(posDrag)) + if (qt_mac_mouse_inside_answer_rect(posDrag) + && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions) return QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction)); // send drag move event to the widget - NSDragOperation nsActions = [sender draggingSourceOperationMask]; + QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions; Qt::DropActions qtAllowed = QT_PREPEND_NAMESPACE(qt_mac_mapNSDragOperations)(nsActions); QMimeData *mimeData = dropData; if (QDragManager::self()->source()) @@ -599,7 +630,7 @@ extern "C" { for (NSView *lookView in viewsToLookAt) { NSPoint tmpPoint = [lookView convertPoint:windowPoint fromView:nil]; for (NSView *view in [lookView subviews]) { - if (view == mouseView) + if (view == mouseView || [view isHidden]) continue; NSRect frameRect = [view frame]; if (NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) @@ -618,7 +649,7 @@ extern "C" { NSPoint tmpPoint = [viewForDescent convertPoint:windowPoint fromView:nil]; // Apply same rule as above wrt z-order. for (NSView *view in [viewForDescent subviews]) { - if (NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) + if (![view isHidden] && NSMouseInRect(tmpPoint, [view frame], [view isFlipped])) lowerView = view; } if (!lowerView) // Low as we can be at this point. @@ -887,15 +918,18 @@ extern "C" { QWidget *widgetToGetKey = qwidget; QWidget *popup = qAppInstance()->activePopupWidget(); - if (popup && popup != qwidget->window()) + bool sendToPopup = false; + if (popup && popup != qwidget->window()) { widgetToGetKey = popup->focusWidget() ? popup->focusWidget() : popup; + sendToPopup = true; + } if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)) { [qt_mac_nativeview_for(widgetToGetKey) interpretKeyEvents:[NSArray arrayWithObject: theEvent]]; } if (sendKeyEvents && !composing) { bool keyOK = qt_dispatchKeyEvent(theEvent, widgetToGetKey); - if (!keyOK) + if (!keyOK && !sendToPopup) [super keyDown:theEvent]; } } @@ -910,6 +944,27 @@ extern "C" { } } +- (void)viewWillMoveToWindow:(NSWindow *)window +{ + if (qwidget->windowFlags() & Qt::MSWindowsOwnDC + && (window != [self window])) { // OpenGL Widget + // Create a stupid ClearDrawable Event + QEvent event(QEvent::MacGLClearDrawable); + qApp->sendEvent(qwidget, &event); + } +} + +- (void)viewDidMoveToWindow +{ + if (qwidget->windowFlags() & Qt::MSWindowsOwnDC && [self window]) { + // call update paint event + qwidgetprivate->needWindowChange = true; + QEvent event(QEvent::MacGLWindowChange); + qApp->sendEvent(qwidget, &event); + } +} + + // NSTextInput Protocol implementation - (void) insertText:(id)aString diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm index 6b30444..89f481f 100644 --- a/src/gui/kernel/qcocoawindow_mac.mm +++ b/src/gui/kernel/qcocoawindow_mac.mm @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) - ** - ** This file is part of the QtGui module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 @@ -36,11 +36,11 @@ ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ #include "qmacdefines_mac.h" #ifdef QT_MAC_USE_COCOA @@ -53,9 +53,10 @@ #include <QtGui/QWidget> QT_FORWARD_DECLARE_CLASS(QWidget); -QT_USE_NAMESPACE - +QT_BEGIN_NAMESPACE extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm +QT_END_NAMESPACE +QT_USE_NAMESPACE @implementation NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration)) @@ -86,6 +87,12 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview. return YES; } +/*********************************************************************** + BEGIN Copy and Paste between QCocoaWindow and QCocoaPanel + This is a bit unfortunate, but thanks to the dynamic dispatch we + have to duplicate this code or resort to really silly forwarding methods +**************************************************************************/ + /* The methods keyDown, keyUp, and flagsChanged... These really shouldn't ever get hit. We automatically say we can be first responder if we are a window. @@ -124,7 +131,7 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview. [self retain]; QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; - QCocoaView *view = static_cast<QCocoaView *>(qt_mac_nativeview_for(widget)); + QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget)); Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]); // sometimes need to redirect mouse events to the popup. @@ -173,6 +180,20 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview. [self release]; } + +- (BOOL)makeFirstResponder:(NSResponder *)responder +{ + // For some reason Cocoa wants to flip the first responder + // when Qt doesn't want to, sorry, but "No" :-) + if (responder == nil && qApp->focusWidget()) + return NO; + return [super makeFirstResponder:responder]; +} + +/*********************************************************************** + END Copy and Paste between QCocoaWindow and QCocoaPanel +***********************************************************************/ + + (Class)frameViewClassForStyleMask:(NSUInteger)styleMask { if (styleMask & QtMacCustomizeWindow) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 8cd97b9..03b2fce 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) - ** - ** This file is part of the QtGui module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 @@ -36,11 +36,11 @@ ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ #import "private/qcocoawindowdelegate_mac_p.h" #ifdef QT_MAC_USE_COCOA @@ -266,18 +266,18 @@ static void cleanupCocoaWindowDelegate() -(void)windowDidBecomeMain:(NSNotification*)notification { - NSWindow *window = [notification object]; - if ([window isKeyWindow]) - return; // Should have already got an activate notification from "become key." - QWidget *qwidget = m_windowHash->value([notification object]); + Q_ASSERT(qwidget); + if (qwidget->isActiveWindow()) + return; // Widget is already active, no need to go through re-activation. + onApplicationWindowChangedActivation(qwidget, true); } -(void)windowDidResignMain:(NSNotification*)notification { QWidget *qwidget = m_windowHash->value([notification object]); - + Q_ASSERT(qwidget); onApplicationWindowChangedActivation(qwidget, false); } @@ -285,11 +285,11 @@ static void cleanupCocoaWindowDelegate() // tiny difference between main and key windows. -(void)windowDidBecomeKey:(NSNotification*)notification { - NSWindow *window = [notification object]; - if ([window isMainWindow]) - return; // Should have already got an activate notification from "become main." + QWidget *qwidget = m_windowHash->value([notification object]); + Q_ASSERT(qwidget); + if (qwidget->isActiveWindow()) + return; // Widget is already active, no need to go through re-activation - QWidget *qwidget = m_windowHash->value(window); onApplicationWindowChangedActivation(qwidget, true); } @@ -297,6 +297,7 @@ static void cleanupCocoaWindowDelegate() -(void)windowDidResignKey:(NSNotification*)notification { QWidget *qwidget = m_windowHash->value([notification object]); + Q_ASSERT(qwidget); onApplicationWindowChangedActivation(qwidget, false); } diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index 15b4597..ad1860d 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -77,6 +77,7 @@ class QBitmap; class QPixmap; #if defined(Q_WS_MAC) +void *nsCursorForQCursor(const QCursor &c); void qt_mac_set_cursor(const QCursor *c, const QPoint &p); #endif @@ -128,6 +129,7 @@ public: private: QCursorData *d; #if defined(Q_WS_MAC) + friend void *nsCursorForQCursor(const QCursor &c); friend void qt_mac_set_cursor(const QCursor *c, const QPoint &p); #endif }; diff --git a/src/gui/kernel/qcursor_mac.mm b/src/gui/kernel/qcursor_mac.mm index d632eb79..ae98f2e 100644 --- a/src/gui/kernel/qcursor_mac.mm +++ b/src/gui/kernel/qcursor_mac.mm @@ -95,9 +95,19 @@ protected: } }; +void *nsCursorForQCursor(const QCursor &c) +{ + c.d->update(); + return [[static_cast<NSCursor *>(c.d->curs.cp.nscursor) retain] autorelease]; +} + static QCursorData *currentCursor = 0; //current cursor void qt_mac_set_cursor(const QCursor *c, const QPoint &) { +#ifdef QT_MAC_USE_COCOA + Q_UNUSED(c); + return; +#else if (!c) { currentCursor = 0; return; @@ -128,10 +138,15 @@ void qt_mac_set_cursor(const QCursor *c, const QPoint &) } } currentCursor = c->d; +#endif } void qt_mac_update_cursor_at_global_pos(const QPoint &globalPos) { +#ifdef QT_MAC_USE_COCOA + Q_UNUSED(globalPos); + return; +#else QCursor cursor(Qt::ArrowCursor); if (QApplication::overrideCursor()) { cursor = *QApplication::overrideCursor(); @@ -144,6 +159,7 @@ void qt_mac_update_cursor_at_global_pos(const QPoint &globalPos) } } qt_mac_set_cursor(&cursor, globalPos); +#endif } void qt_mac_update_cursor() diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 3f1df5e..8c7e47d 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1656,7 +1656,7 @@ Qt::ButtonState QContextMenuEvent::state() const The variant contains a QLocale object specifying the language of a certain part of the preedit string. There should be at most one language set for every part of the preedit string. If several are - specified for any character in the string the behaviour is undefined. + specified for any character in the string the behavior is undefined. \value Ruby The ruby text for a part of the preedit string. There should be at diff --git a/src/gui/kernel/qmacdefines_mac.h b/src/gui/kernel/qmacdefines_mac.h index 97ec544..035b8c5 100644 --- a/src/gui/kernel/qmacdefines_mac.h +++ b/src/gui/kernel/qmacdefines_mac.h @@ -105,7 +105,7 @@ Yes, it is an informative comment ;-) # undef qDebug #endif -#if __LP64__ +#ifdef __LP64__ typedef signed int OSStatus; #else typedef signed long OSStatus; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 9c381b4..52e76d8 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -555,12 +555,15 @@ bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widge int keyLength = [keyChars length]; if (keyLength == 0) return false; // Dead Key, nothing to do! + bool ignoreText = false; Qt::Key qtKey = Qt::Key_unknown; if (keyLength == 1) { QChar ch([keyChars characterAtIndex:0]); if (ch.isLower()) ch = ch.toUpper(); qtKey = cocoaKey2QtKey(ch); + // Do not set the text for Function-Key Unicodes characters (0xF700–0xF8FF). + ignoreText = (ch.unicode() >= 0xF700 && ch.unicode() <= 0xF8FF); } Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([event modifierFlags]); QString text; @@ -568,7 +571,7 @@ bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widge // To quote from the Carbon port: This is actually wrong--but it is the best that // can be done for now because of the Control/Meta mapping issues // (we always get text on the Mac) - if (!(keyMods & (Qt::ControlModifier | Qt::MetaModifier))) + if (!ignoreText && !(keyMods & (Qt::ControlModifier | Qt::MetaModifier))) text = QCFString::toQString(reinterpret_cast<CFStringRef>(keyChars)); UInt32 macScanCode = 1; diff --git a/src/gui/kernel/qt_mac.cpp b/src/gui/kernel/qt_mac.cpp index b462b13..b1247e8 100644 --- a/src/gui/kernel/qt_mac.cpp +++ b/src/gui/kernel/qt_mac.cpp @@ -93,6 +93,8 @@ static QColor qcolorFromCGColor(CGColorRef cgcolor) pc.setRgbF(components[0], components[1], components[2], components[3]); } else if (model == kCGColorSpaceModelCMYK) { pc.setCmykF(components[0], components[1], components[2], components[3]); + } else if (model == kCGColorSpaceModelMonochrome) { + pc.setRgbF(components[0], components[0], components[0], components[1]); } else { // Colorspace we can't deal with. qWarning("Qt: qcolorFromCGColor: cannot convert from colorspace model: %d", model); @@ -129,16 +131,47 @@ QColor qcolorForTheme(ThemeBrush brush) QColor qcolorForThemeTextColor(ThemeTextColor themeColor) { -#ifndef QT_MAC_USE_COCOA +#ifdef QT_OS_MAC32 RGBColor c; GetThemeTextColor(themeColor, 32, true, &c); - return QColor(c.red / 265, c.green / 256, c.blue / 256); + QColor color = QColor(c.red / 265, c.green / 256, c.blue / 256); + return color; #else - QNativeImage nativeImage(16,16, QNativeImage::systemFormat()); - CGRect cgrect = CGRectMake(0, 0, 16, 16); - HIThemeSetTextFill(themeColor, 0, nativeImage.cg, kHIThemeOrientationNormal); - CGContextFillRect(nativeImage.cg, cgrect); - return QColor(nativeImage.image.pixel(0 , 0)); + // There is no equivalent to GetThemeTextColor in 64-bit and it was rather bad that + // I didn't file a request to implement this for Snow Leopard. So, in the meantime + // I've encoded the values from the GetThemeTextColor. This is not exactly ideal + // as if someone really wants to mess with themeing, these colors will be wrong. + // It also means that we need to make sure the values for differences between + // OS releases (and it will be likely that we are a step behind.) + switch (themeColor) { + case kThemeTextColorAlertActive: + case kThemeTextColorTabFrontActive: + case kThemeTextColorBevelButtonActive: + case kThemeTextColorListView: + case kThemeTextColorPlacardActive: + case kThemeTextColorPopupButtonActive: + case kThemeTextColorPopupLabelActive: + case kThemeTextColorPushButtonActive: + return Qt::black; + case kThemeTextColorAlertInactive: + case kThemeTextColorDialogInactive: + case kThemeTextColorPlacardInactive: + return QColor(67, 69, 69, 255); + case kThemeTextColorPopupButtonInactive: + case kThemeTextColorPopupLabelInactive: + case kThemeTextColorPushButtonInactive: + case kThemeTextColorTabFrontInactive: + case kThemeTextColorBevelButtonInactive: + return QColor(123, 127, 127, 255); + default: { + QNativeImage nativeImage(16,16, QNativeImage::systemFormat()); + CGRect cgrect = CGRectMake(0, 0, 16, 16); + HIThemeSetTextFill(themeColor, 0, nativeImage.cg, kHIThemeOrientationNormal); + CGContextFillRect(nativeImage.cg, cgrect); + QColor color = nativeImage.image.pixel(0,0); + return QColor(nativeImage.image.pixel(0 , 0)); + } + } #endif } QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_mac_p.h b/src/gui/kernel/qt_mac_p.h index 3aec23f..ca995dc 100644 --- a/src/gui/kernel/qt_mac_p.h +++ b/src/gui/kernel/qt_mac_p.h @@ -233,6 +233,7 @@ extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp extern OSWindowRef qt_mac_window_for(const QWidget*); //qwidget_mac.mm extern OSViewRef qt_mac_nativeview_for(const QWidget *); //qwidget_mac.mm +extern QPoint qt_mac_nativeMapFromParent(const QWidget *child, const QPoint &pt); //qwidget_mac.mm #ifdef check # undef check @@ -249,11 +250,13 @@ struct QMacDndAnswerRecord { Qt::KeyboardModifiers modifiers; Qt::MouseButtons buttons; Qt::DropAction lastAction; + unsigned int lastOperation; void clear() { rect = QRect(); modifiers = Qt::NoModifier; buttons = Qt::NoButton; lastAction = Qt::IgnoreAction; + lastOperation = 0; } }; extern QMacDndAnswerRecord qt_mac_dnd_answer_rec; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 63d31b5..31fed5e 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -66,6 +66,7 @@ #ifdef Q_WS_MAC # include "qt_mac_p.h" # include "qt_cocoa_helpers_mac_p.h" +# include "qmainwindow.h" #endif #if defined(Q_WS_QWS) # include "qwsdisplay_qws.h" @@ -164,6 +165,7 @@ static inline bool bypassGraphicsProxyWidget(QWidget *p) #endif extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp +extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp QWidgetPrivate::QWidgetPrivate(int version) : QObjectPrivate(version), extra(0), focus_child(0) @@ -234,28 +236,6 @@ QWindowSurface *QWidgetPrivate::createDefaultWindowSurface() /*! \internal - This is an internal function, you should never call this. - - This function is called to focus associated input context. The - code intends to eliminate duplicate focus for the context even if - the context is shared between widgets - - \sa QInputContext::setFocus() - */ -void QWidgetPrivate::focusInputContext() -{ -#ifndef QT_NO_IM - Q_Q(QWidget); - QInputContext *qic = q->inputContext(); - if (qic) { - if(qic->focusWidget() != q) - qic->setFocusWidget(q); - } -#endif // QT_NO_IM -} - -/*! - \internal */ void QWidgetPrivate::scrollChildren(int dx, int dy) { @@ -329,20 +309,24 @@ void QWidget::setInputContext(QInputContext *context) /*! + \obsolete + This function can be called on the widget that currently has focus to reset the input method operating on it. - \sa QInputContext, QInputContext::reset() + This function is providing for convenience, instead you should use + \l{QInputContext::}{reset()} on the input context that was + returned by inputContext(). + + \sa QInputContext, inputContext(), QInputContext::reset() */ void QWidget::resetInputContext() { if (!hasFocus()) return; #ifndef QT_NO_IM - if (!d_func()->ic) - return; QInputContext *qic = this->inputContext(); - if( qic ) + if(qic) qic->reset(); #endif // QT_NO_IM } @@ -1400,7 +1384,13 @@ int QWidgetPrivate::maxInstances = 0; // Maximum number of widget instances void QWidgetPrivate::setWinId(WId id) // set widget identifier { Q_Q(QWidget); - if (mapper && data.winid) { + // the user might create a widget with Qt::Desktop window + // attribute (or create another QDesktopWidget instance), which + // will have the same windowid (the root window id) as the + // qt_desktopWidget. We should not add the second desktop widget + // to the mapper. + bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop; + if (mapper && data.winid && !userDesktopWidget) { mapper->remove(data.winid); uncreatedWidgets->insert(q); } @@ -1409,7 +1399,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier #if defined(Q_WS_X11) hd = id; // X11: hd == ident #endif - if (mapper && id) { + if (mapper && id && !userDesktopWidget) { mapper->insert(data.winid, q); uncreatedWidgets->remove(q); } @@ -4653,6 +4643,8 @@ void QWidget::unsetCursor() */ /*! + \since 4.3 + Renders the \a sourceRegion of this widget into the \a target using \a renderFlags to determine how to render. Rendering starts at \a targetOffset in the \a target. For example: @@ -4662,12 +4654,13 @@ void QWidget::unsetCursor() If \a sourceRegion is a null region, this function will use QWidget::rect() as the region, i.e. the entire widget. - \bold{Note:} Make sure to call QPainter::end() for the given \a target's + Ensure that you call QPainter::end() for the \a target device's active painter (if any) before rendering. For example: \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 8 - \since 4.3 + \note To obtain the contents of an OpenGL widget, use QGLWidget::grabFrameBuffer() + or QGLWidget::renderPixmap() instead. */ void QWidget::render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, RenderFlags renderFlags) @@ -5928,12 +5921,12 @@ bool QWidget::isActiveWindow() const return true; #endif if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) { - if(((tlw->windowType() == Qt::Dialog) || (tlw->windowType() == Qt::Tool)) && + if(tlw->windowType() == Qt::Tool && !tlw->isModal() && (!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow())) return true; QWidget *w = qApp->activeWindow(); - while(w && ((tlw->windowType() == Qt::Dialog) || (tlw->windowType() == Qt::Tool)) && + while(w && tlw->windowType() == Qt::Tool && !w->isModal() && w->parentWidget()) { w = w->parentWidget()->window(); if(w == tlw) @@ -8974,17 +8967,36 @@ QWidget *QWidget::childAt(const QPoint &p) const QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDestructor) const { Q_Q(const QWidget); - if (!q->rect().contains(p)) +#ifdef Q_WS_MAC + bool includeFrame = q->isWindow() && qobject_cast<const QMainWindow *>(q) + && static_cast<const QMainWindow *>(q)->unifiedTitleAndToolBarOnMac(); +#endif + + if ( +#ifdef Q_WS_MAC + !includeFrame && +#endif + !q->rect().contains(p)) return 0; + for (int i = children.size(); i > 0 ;) { --i; QWidget *w = qobject_cast<QWidget *>(children.at(i)); - if (w && !w->isWindow() && !w->isHidden() && w->geometry().contains(p)) { + if (w && !w->isWindow() && !w->isHidden() + && (w->geometry().contains(p) +#ifdef Q_WS_MAC + || (includeFrame && w->geometry().contains(qt_mac_nativeMapFromParent(w, p))) +#endif + )) { if (ignoreChildrenInDestructor && w->data->in_destructor) continue; if (w->testAttribute(Qt::WA_TransparentForMouseEvents)) continue; QPoint childPoint = w->mapFromParent(p); +#ifdef Q_WS_MAC + if (includeFrame && !w->geometry().contains(p)) + childPoint = qt_mac_nativeMapFromParent(w, p); +#endif if (QWidget *t = w->d_func()->childAt_helper(childPoint, ignoreChildrenInDestructor)) return t; // if WMouseNoMask is set the widget mask is ignored, if @@ -9425,11 +9437,13 @@ void QWidget::repaint(const QRect &rect) if (!isVisible() || !updatesEnabled() || rect.isEmpty()) return; - QTLWExtra *tlwExtra = !d->paintOnScreen() ? window()->d_func()->maybeTopData() : 0; - if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { - tlwExtra->inRepaint = true; - tlwExtra->backingStore->markDirty(rect, this, true); - tlwExtra->inRepaint = false; + if (hasBackingStoreSupport()) { + QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); + if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { + tlwExtra->inRepaint = true; + tlwExtra->backingStore->markDirty(rect, this, true); + tlwExtra->inRepaint = false; + } } else { d->repaint_sys(rect); } @@ -9452,11 +9466,13 @@ void QWidget::repaint(const QRegion &rgn) if (!isVisible() || !updatesEnabled() || rgn.isEmpty()) return; - QTLWExtra *tlwExtra = !d->paintOnScreen() ? window()->d_func()->maybeTopData() : 0; - if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { - tlwExtra->inRepaint = true; - tlwExtra->backingStore->markDirty(rgn, this, true); - tlwExtra->inRepaint = false; + if (hasBackingStoreSupport()) { + QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); + if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { + tlwExtra->inRepaint = true; + tlwExtra->backingStore->markDirty(rgn, this, true); + tlwExtra->inRepaint = false; + } } else { d->repaint_sys(rgn); } @@ -9638,7 +9654,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); #ifdef Q_WS_WIN - if (attribute == Qt::WA_PaintOnScreen) { + if (attribute == Qt::WA_PaintOnScreen && on) { // see qwidget_win.cpp, ::paintEngine for details paintEngine(); if (d->noPaintOnScreen) @@ -9783,12 +9799,21 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } break; #endif - case Qt::WA_NativeWindow: + case Qt::WA_NativeWindow: { + QInputContext *ic = 0; + if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) { + ic = d->inputContext(); + ic->reset(); + ic->setFocusWidget(0); + } if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()) parentWidget()->d_func()->enforceNativeChildren(); if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created)) d->createWinId(); + if (ic) + ic->setFocusWidget(this); break; + } case Qt::WA_PaintOnScreen: d->updateIsOpaque(); #if defined(Q_WS_WIN) || defined(Q_WS_X11) @@ -11268,7 +11293,7 @@ QT_END_NAMESPACE currently the active one then it will not make it the active window. It will change the color of the taskbar entry to indicate that the window has changed in some way. This is because Microsoft - do not allow an application to interrupt what the user is currently + does not allow an application to interrupt what the user is currently doing in another application. \sa isActiveWindow(), window(), show() diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 7cceb4f..2c3f7f1 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -295,9 +295,7 @@ bool qt_mac_is_macsheet(const QWidget *w) Qt::WindowModality modality = w->windowModality(); if (modality == Qt::ApplicationModal) return false; - if (modality == Qt::WindowModal || w->windowType() == Qt::Sheet) - return true; - return false; + return w->parentWidget() && (modality == Qt::WindowModal || w->windowType() == Qt::Sheet); } bool qt_mac_is_macdrawer(const QWidget *w) @@ -467,7 +465,18 @@ Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget *w) if (hiview){ OSWindowRef window = qt_mac_window_for(hiview); if (!window && qt_isGenuineQWidget(hiview)) { - w->window()->d_func()->createWindow_sys(); + QWidget *myWindow = w->window(); + // This is a workaround for NSToolbar. When a widget is hidden + // by clicking the toolbar button, Cocoa reparents the widgets + // to another window (but Qt doesn't know about it). + // When we start showing them, it reparents back, + // but at this point it's window is nil, but the window it's being brought + // into (the Qt one) is for sure created. + // This stops the hierarchy moving under our feet. + if (myWindow != w && qt_mac_window_for(qt_mac_nativeview_for(myWindow))) + return qt_mac_window_for(qt_mac_nativeview_for(myWindow)); + + myWindow->d_func()->createWindow_sys(); // Reget the hiview since the "create window could potentially move the view (I guess). hiview = qt_mac_nativeview_for(w); window = qt_mac_window_for(hiview); @@ -2174,11 +2183,13 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin if ((popup || type == Qt::Tool || type == Qt::ToolTip) && !q->isModal()) { [windowRef setHidesOnDeactivate:YES]; [windowRef setHasShadow:YES]; + } else { + [windowRef setHidesOnDeactivate:NO]; } + Q_UNUSED(parentWidget); Q_UNUSED(dialog); - // May need to do something the equivalent to ReshapeCustomWindow from Carbon here stuff, currently seems OK. data.fstrut_dirty = true; // when we create a toplevel widget, the frame strut should be dirty OSViewRef nsview = (OSViewRef)data.winid; OSViewRef window_contentview = qt_mac_get_contentview_for(windowRef); @@ -2515,6 +2526,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } updateIsOpaque(); + if (q->hasFocus()) + setFocus_sys(); if (!topLevel && initializeWindow) setWSGeometry(); @@ -2845,12 +2858,26 @@ void QWidgetPrivate::updateSystemBackground() void QWidgetPrivate::setCursor_sys(const QCursor &) { +#ifndef QT_MAC_USE_COCOA qt_mac_update_cursor(); +#else + Q_Q(QWidget); + if (q->testAttribute(Qt::WA_WState_Created)) { + [qt_mac_window_for(q) invalidateCursorRectsForView:qt_mac_nativeview_for(q)]; + } +#endif } void QWidgetPrivate::unsetCursor_sys() { +#ifndef QT_MAC_USE_COCOA qt_mac_update_cursor(); +#else + Q_Q(QWidget); + if (q->testAttribute(Qt::WA_WState_Created)) { + [qt_mac_window_for(q) invalidateCursorRectsForView:qt_mac_nativeview_for(q)]; + } +#endif } void QWidgetPrivate::setWindowTitle_sys(const QString &caption) @@ -3275,6 +3302,20 @@ void QWidgetPrivate::show_sys() qt_event_request_window_change(q); } + +QPoint qt_mac_nativeMapFromParent(const QWidget *child, const QPoint &pt) +{ +#ifndef QT_MAC_USE_COCOA + CGPoint nativePoint = CGPointMake(pt.x(), pt.y()); + HIViewConvertPoint(&nativePoint, qt_mac_nativeview_for(child->parentWidget()), + qt_mac_nativeview_for(child)); +#else + NSPoint nativePoint = [qt_mac_nativeview_for(child) convertPoint:NSMakePoint(pt.x(), pt.y()) fromView:qt_mac_nativeview_for(child->parentWidget())]; +#endif + return QPoint(nativePoint.x, nativePoint.y); +} + + void QWidgetPrivate::hide_sys() { Q_Q(QWidget); @@ -3556,7 +3597,10 @@ void QWidgetPrivate::raise_sys() #if QT_MAC_USE_COCOA QMacCocoaAutoReleasePool pool; if (isRealWindow()) { - [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)]; + // Calling orderFront shows the window on Cocoa too. + if (!q->testAttribute(Qt::WA_DontShowOnScreen)) { + [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)]; + } if (qt_mac_raise_process) { //we get to be the active process now ProcessSerialNumber psn; GetCurrentProcess(&psn); @@ -4579,11 +4623,11 @@ void QWidgetPrivate::setModal_sys() OSWindowRef windowRef = qt_mac_window_for(q); #ifdef QT_MAC_USE_COCOA - bool windowIsSheet = [windowRef styleMask] & NSDocModalWindowMask; + bool alreadySheet = [windowRef styleMask] & NSDocModalWindowMask; - if (q->windowModality() == Qt::WindowModal){ + if (windowParent && q->windowModality() == Qt::WindowModal){ // Window should be window-modal, which implies a sheet. - if (!windowIsSheet) + if (!alreadySheet) recreateMacWindow(); if ([windowRef isKindOfClass:[NSPanel class]]){ // If the primary window of the sheet parent is a child of a modal dialog, @@ -4597,7 +4641,7 @@ void QWidgetPrivate::setModal_sys() } } else { // Window shold not be window-modal, and as such, not a sheet. - if (windowIsSheet){ + if (alreadySheet){ // NB: the following call will call setModal_sys recursivly: recreateMacWindow(); windowRef = qt_mac_window_for(q); @@ -4612,6 +4656,7 @@ void QWidgetPrivate::setModal_sys() if ([windowRef isKindOfClass:[NSPanel class]]) [static_cast<NSPanel *>(windowRef) setWorksWhenModal:YES]; } else { + // INVARIANT: q should not be modal. NSInteger winLevel = -1; if (q->windowType() == Qt::Popup) { winLevel = NSPopUpMenuWindowLevel; @@ -4622,9 +4667,10 @@ void QWidgetPrivate::setModal_sys() } } else if (q->windowType() == Qt::Tool) { winLevel = NSFloatingWindowLevel; + } else if (q->windowType() == Qt::Dialog) { + winLevel = NSModalPanelWindowLevel; } - // StayOnTop window should appear above Tool windows. if (data.window_flags & Qt::WindowStaysOnTopHint) winLevel = NSPopUpMenuWindowLevel; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index f254c4a..9e93f66 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -354,8 +354,6 @@ public: void setWindowIcon_sys(bool forceReset = false); void setWindowOpacity_sys(qreal opacity); - void focusInputContext(); - void adjustQuitOnCloseAttribute(); #if defined(Q_WS_X11) diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 228ef7c..ffbb341 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -1037,6 +1037,8 @@ void QWidget::setWindowState(Qt::WindowStates newstate) #else UINT style = WS_POPUP; #endif + if (d->topData()->savedFlags & WS_SYSMENU) + style |= WS_SYSMENU; if (isVisible()) style |= WS_VISIBLE; SetWindowLongA(internalWinId(), GWL_STYLE, style); diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index a12b50c..76734d4 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -898,7 +898,7 @@ void QWidgetPrivate::x11UpdateIsOpaque() bool visible = q->isVisible(); if (visible) q->hide(); - q->setParent(q->parentWidget(), q->windowFlags() & ~Qt::WindowType_Mask); + q->setParent(q->parentWidget(), q->windowFlags()); q->move(pos); if (visible) q->show(); @@ -1516,7 +1516,6 @@ void QWidget::activateWindow() X11->userTime = X11->time; qt_net_update_user_time(tlw, X11->userTime); XSetInputFocus(X11->display, tlw->internalWinId(), XRevertToParent, X11->time); - d->focusInputContext(); } } @@ -1751,8 +1750,8 @@ void QWidgetPrivate::show_sys() mwmhints.functions &= ~MWM_FUNC_RESIZE; } - mwmhints.flags |= MWM_HINTS_DECORATIONS; if (mwmhints.decorations == MWM_DECOR_ALL) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; mwmhints.decorations = (MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU); @@ -1761,10 +1760,12 @@ void QWidgetPrivate::show_sys() } if (q->windowFlags() & Qt::WindowMinimizeButtonHint) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; mwmhints.decorations |= MWM_DECOR_MINIMIZE; mwmhints.functions |= MWM_FUNC_MINIMIZE; } if (q->windowFlags() & Qt::WindowMaximizeButtonHint) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; mwmhints.decorations |= MWM_DECOR_MAXIMIZE; mwmhints.functions |= MWM_FUNC_MAXIMIZE; } diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index e49c4d6..6329135 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -481,7 +481,7 @@ QX11EmbedWidget::QX11EmbedWidget(QWidget *parent) | ExposureMask | StructureNotifyMask | SubstructureNotifyMask | PropertyChangeMask); - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), internalWinId(), ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*) data, 2); @@ -1571,7 +1571,7 @@ void QX11EmbedContainer::showEvent(QShowEvent *) { Q_D(QX11EmbedContainer); if (d->client) { - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), d->client, ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char *) data, 2); } @@ -1587,8 +1587,7 @@ void QX11EmbedContainer::hideEvent(QHideEvent *) { Q_D(QX11EmbedContainer); if (d->client) { - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; - + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), d->client, ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char *) data, 2); } diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index cf73eb7..6589439 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -153,12 +153,13 @@ struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha { template <typename SRC, typename T> void qt_scale_image_16bit(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, - const QRectF &targetRect, + const QRectF &target, const QRectF &srcRect, const QRect &clip, T blender) { - + const QRectF targetRect = target.translated(aliasedCoordinateDelta, + aliasedCoordinateDelta); qreal sx = targetRect.width() / (qreal) srcRect.width(); qreal sy = targetRect.height() / (qreal) srcRect.height(); @@ -177,10 +178,10 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, int cy1 = clip.top(); int cy2 = clip.y() + clip.height(); - int tx1 = qFloor(targetRect.left() + aliasedCoordinateDelta); - int tx2 = qFloor(targetRect.right() + aliasedCoordinateDelta); - int ty1 = qFloor(targetRect.top() + aliasedCoordinateDelta); - int ty2 = qFloor(targetRect.bottom() + aliasedCoordinateDelta); + int tx1 = qRound(targetRect.left()); + int tx2 = qRound(targetRect.right()); + int ty1 = qRound(targetRect.top()); + int ty2 = qRound(targetRect.bottom()); if (tx2 < tx1) qSwap(tx2, tx1); @@ -534,6 +535,8 @@ static void qt_blend_argb32_on_rgb16(uchar *destPixels, int dbpl, s += BYTE_MUL_RGB16(*dst, 255 - alpha); *dst = s; } + ++dst; + ++src; } dst += dstExtraStride; src += srcExtraStride; @@ -702,11 +705,14 @@ struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha { template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, - const QRectF &targetRect, + const QRectF &target, const QRectF &srcRect, const QRect &clip, T blender) { + const QRectF targetRect = target.translated(aliasedCoordinateDelta, + aliasedCoordinateDelta); + qreal sx = targetRect.width() / (qreal) srcRect.width(); qreal sy = targetRect.height() / (qreal) srcRect.height(); @@ -724,10 +730,10 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, int cy1 = clip.top(); int cy2 = clip.y() + clip.height(); - int tx1 = qFloor(targetRect.left() + aliasedCoordinateDelta); - int tx2 = qFloor(targetRect.right() + aliasedCoordinateDelta); - int ty1 = qFloor(targetRect.top() + aliasedCoordinateDelta); - int ty2 = qFloor(targetRect.bottom() + aliasedCoordinateDelta); + int tx1 = qRound(targetRect.left()); + int tx2 = qRound(targetRect.right()); + int ty1 = qRound(targetRect.top()); + int ty2 = qRound(targetRect.bottom()); if (tx2 < tx1) qSwap(tx2, tx1); diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index d44e2a6..5d7d4ab 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -526,7 +526,6 @@ void QColor::setNamedColor(const QString &name) if (qt_get_hex_rgb(name.constData(), name.length(), &rgb)) { setRgb(rgb); } else { - qWarning("QColor::setNamedColor: Could not parse color '%s'", name.toLatin1().constData()); invalidate(); } return; diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index 40ff379..4439d52 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -633,6 +633,8 @@ QPolygonF QMatrix::map(const QPolygonF &a) const \sa QMatrix::map() */ +extern QPainterPath qt_regionToPath(const QRegion ®ion); + /*! \fn QRegion QMatrix::map(const QRegion ®ion) const \overload @@ -653,7 +655,6 @@ QRegion QMatrix::map(const QRegion &r) const return copy; } - extern QPainterPath qt_regionToPath(const QRegion ®ion); QPainterPath p = map(qt_regionToPath(r)); return p.toFillPolygon().toPolygon(); } diff --git a/src/gui/painting/qpaintengine_alpha.cpp b/src/gui/painting/qpaintengine_alpha.cpp index e38f6a4..74cbebe 100644 --- a/src/gui/painting/qpaintengine_alpha.cpp +++ b/src/gui/painting/qpaintengine_alpha.cpp @@ -80,6 +80,7 @@ bool QAlphaPaintEngine::begin(QPaintDevice *pdev) d->m_advancedPen = false; d->m_advancedBrush = false; d->m_complexTransform = false; + d->m_emulateProjectiveTransforms = false; // clear alpha region d->m_alphargn = QRegion(); @@ -116,6 +117,9 @@ void QAlphaPaintEngine::updateState(const QPaintEngineState &state) if (flags & QPaintEngine::DirtyTransform) { d->m_transform = state.transform(); d->m_complexTransform = (d->m_transform.type() > QTransform::TxScale); + d->m_emulateProjectiveTransforms = !(d->m_savedcaps & QPaintEngine::PerspectiveTransform) + && !(d->m_savedcaps & QPaintEngine::AlphaBlend) + && (d->m_transform.type() >= QTransform::TxProject); } if (flags & QPaintEngine::DirtyPen) { d->m_pen = state.pen(); @@ -163,7 +167,9 @@ void QAlphaPaintEngine::drawPath(const QPainterPath &path) if (d->m_pass == 0) { d->m_continueCall = false; - if (d->m_hasalpha || d->m_advancedPen || d->m_advancedBrush) { + if (d->m_hasalpha || d->m_advancedPen || d->m_advancedBrush + || d->m_emulateProjectiveTransforms) + { d->addAlphaRect(tr); } if (d->m_picengine) @@ -187,7 +193,9 @@ void QAlphaPaintEngine::drawPolygon(const QPointF *points, int pointCount, Polyg if (d->m_pass == 0) { d->m_continueCall = false; - if (d->m_hasalpha || d->m_advancedPen || d->m_advancedBrush) { + if (d->m_hasalpha || d->m_advancedPen || d->m_advancedBrush + || d->m_emulateProjectiveTransforms) + { d->addAlphaRect(tr); } diff --git a/src/gui/painting/qpaintengine_alpha_p.h b/src/gui/painting/qpaintengine_alpha_p.h index f510c73..f7d7a34 100644 --- a/src/gui/painting/qpaintengine_alpha_p.h +++ b/src/gui/painting/qpaintengine_alpha_p.h @@ -113,6 +113,7 @@ public: bool m_advancedPen; bool m_advancedBrush; bool m_complexTransform; + bool m_emulateProjectiveTransforms; bool m_continueCall; QTransform m_transform; diff --git a/src/gui/painting/qpaintengine_d3d.cpp b/src/gui/painting/qpaintengine_d3d.cpp index 26708b0..bb81623 100644 --- a/src/gui/painting/qpaintengine_d3d.cpp +++ b/src/gui/painting/qpaintengine_d3d.cpp @@ -2866,9 +2866,10 @@ void QDirect3DPaintEnginePrivate::updateClipPath(const QPainterPath &path, Qt::C m_draw_helper->setClipPath(m_clip_path, aaitem); */ } +extern QPainterPath qt_regionToPath(const QRegion ®ion); + void QDirect3DPaintEnginePrivate::updateClipRegion(const QRegion &clipregion, Qt::ClipOperation op) { - extern QPainterPath qt_regionToPath(const QRegion ®ion); if (m_draw_helper->needsFlushing()) flushBatch(); if (m_has_complex_clipping) { diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 495e6c4..addd63d 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -104,6 +104,8 @@ QT_BEGIN_NAMESPACE +extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp + #define qreal_to_fixed_26_6(f) (int(f * 64)) #define qt_swap_int(x, y) { int tmp = (x); (x) = (y); (y) = tmp; } #define qt_swap_qreal(x, y) { qreal tmp = (x); (x) = (y); (y) = tmp; } @@ -607,7 +609,6 @@ void QRasterPaintEngine::updateMatrix(const QTransform &matrix) break; } - extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp s->flags.tx_noshear = qt_scaleForTransform(s->matrix, &s->txscale); ensureOutlineMapper(); @@ -1528,7 +1529,7 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount) d->initializeRasterizer(&s->brushData); for (int i = 0; i < rectCount; ++i) { const QRectF &rect = rects[i].normalized(); - if (rects[i].isEmpty()) + if (rect.isEmpty()) continue; const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f); const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f); @@ -1701,10 +1702,10 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) static inline QRect toNormalizedFillRect(const QRectF &rect) { - const int x1 = qFloor(rect.x() + aliasedCoordinateDelta); - const int y1 = qFloor(rect.y() + aliasedCoordinateDelta); - const int x2 = qFloor(rect.right() + aliasedCoordinateDelta); - const int y2 = qFloor(rect.bottom() + aliasedCoordinateDelta); + const int x1 = qRound(rect.x() + aliasedCoordinateDelta); + const int y1 = qRound(rect.y() + aliasedCoordinateDelta); + const int x2 = qRound(rect.right() + aliasedCoordinateDelta); + const int y2 = qRound(rect.bottom() + aliasedCoordinateDelta); return QRect(x1, y1, x2 - x1, y2 - y1).normalized(); } @@ -1906,7 +1907,6 @@ void QRasterPaintEngine::drawPath(const QPainterPath &path) } else { Q_ASSERT(s->stroker); d->outlineMapper->beginOutline(Qt::WindingFill); - extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp qreal txscale = 1; if (s->pen.isCosmetic() || (qt_scaleForTransform(s->matrix, &txscale) && txscale != 1)) { const qreal strokeWidth = d->basicStroker.strokeWidth(); @@ -2355,11 +2355,6 @@ void QRasterPaintEngine::strokePolygonCosmetic(const QPoint *points, int pointCo } } -#define IMAGE_FROM_PIXMAP(pixmap) \ - pixmap.data->classId() == QPixmapData::RasterClass \ - ? ((QRasterPixmapData *) pixmap.data)->image \ - : pixmap.toImage() - /*! \internal */ @@ -2368,16 +2363,33 @@ void QRasterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pixmap) #ifdef QT_DEBUG_DRAW qDebug() << " - QRasterPaintEngine::drawPixmap(), pos=" << pos << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth(); #endif - if (pixmap.depth() == 1) { - Q_D(QRasterPaintEngine); - QRasterPaintEngineState *s = state(); - if (s->matrix.type() <= QTransform::TxTranslate) { - drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), pixmap, &s->penData); + + if (pixmap.data->classId() == QPixmapData::RasterClass) { + const QImage &image = ((QRasterPixmapData *) pixmap.data)->image; + if (image.depth() == 1) { + Q_D(QRasterPaintEngine); + QRasterPaintEngineState *s = state(); + if (s->matrix.type() <= QTransform::TxTranslate) { + drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); + } else { + drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); + } } else { - drawImage(pos, d->rasterBuffer->colorizeBitmap(IMAGE_FROM_PIXMAP(pixmap), s->pen.color())); + QRasterPaintEngine::drawImage(pos, image); } } else { - QRasterPaintEngine::drawImage(pos, IMAGE_FROM_PIXMAP(pixmap)); + const QImage image = pixmap.toImage(); + if (pixmap.depth() == 1) { + Q_D(QRasterPaintEngine); + QRasterPaintEngineState *s = state(); + if (s->matrix.type() <= QTransform::TxTranslate) { + drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); + } else { + drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); + } + } else { + QRasterPaintEngine::drawImage(pos, image); + } } } @@ -2390,22 +2402,40 @@ void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, cons qDebug() << " - QRasterPaintEngine::drawPixmap(), r=" << r << " sr=" << sr << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth(); #endif - Q_D(QRasterPaintEngine); - QRasterPaintEngineState *s = state(); - - if (pixmap.depth() == 1) { - if (s->matrix.type() <= QTransform::TxTranslate - && r.size() == sr.size() - && r.size() == pixmap.size()) { - ensurePen(); - drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), pixmap, &s->penData); - return; + if (pixmap.data->classId() == QPixmapData::RasterClass) { + const QImage &image = ((QRasterPixmapData *) pixmap.data)->image; + if (image.depth() == 1) { + Q_D(QRasterPaintEngine); + QRasterPaintEngineState *s = state(); + if (s->matrix.type() <= QTransform::TxTranslate + && r.size() == sr.size() + && r.size() == pixmap.size()) { + ensurePen(); + drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); + return; + } else { + drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), sr); + } } else { - drawImage(r, d->rasterBuffer->colorizeBitmap(IMAGE_FROM_PIXMAP(pixmap), - s->pen.color()), sr); + drawImage(r, image, sr); } } else { - drawImage(r, IMAGE_FROM_PIXMAP(pixmap), sr); + const QImage image = pixmap.toImage(); + if (image.depth() == 1) { + Q_D(QRasterPaintEngine); + QRasterPaintEngineState *s = state(); + if (s->matrix.type() <= QTransform::TxTranslate + && r.size() == sr.size() + && r.size() == pixmap.size()) { + ensurePen(); + drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); + return; + } else { + drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), sr); + } + } else { + drawImage(r, image, sr); + } } } @@ -2614,10 +2644,15 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, QRasterPaintEngineState *s = state(); QImage image; - if (pixmap.depth() == 1) - image = d->rasterBuffer->colorizeBitmap(IMAGE_FROM_PIXMAP(pixmap), s->pen.color()); - else - image = IMAGE_FROM_PIXMAP(pixmap); + + if (pixmap.data->classId() == QPixmapData::RasterClass) { + image = ((QRasterPixmapData *) pixmap.data)->image; + } else { + image = pixmap.toImage(); + } + + if (image.depth() == 1) + image = d->rasterBuffer->colorizeBitmap(image, s->pen.color()); if (s->matrix.type() > QTransform::TxTranslate) { QTransform copy = s->matrix; @@ -3650,14 +3685,13 @@ void QRasterPaintEngine::drawBufferSpan(const uint *buffer, int bufsize, } #endif // Q_WS_QWS -void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QPixmap &pm, QSpanData *fg) +void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fg) { Q_ASSERT(fg); if (!fg->blend) return; Q_D(QRasterPaintEngine); - const QImage image = IMAGE_FROM_PIXMAP(pm); Q_ASSERT(image.depth() == 1); const int spanCount = 256; @@ -3665,8 +3699,8 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QPixmap &pm, QSpan int n = 0; // Boundaries - int w = pm.width(); - int h = pm.height(); + int w = image.width(); + int h = image.height(); int ymax = qMin(qRound(pos.y() + h), d->rasterBuffer->height()); int ymin = qMax(qRound(pos.y()), 0); int xmax = qMin(qRound(pos.x() + w), d->rasterBuffer->width()); diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 0f8060a..26a2b3f 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -256,7 +256,7 @@ private: void init(); void fillRect(const QRectF &rect, QSpanData *data); - void drawBitmap(const QPointF &pos, const QPixmap &image, QSpanData *fill); + void drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fill); void drawCachedGlyphs(const QPointF &p, const QTextItemInt &ti); diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index e9f1bb3..39ce59f 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -62,6 +62,7 @@ #include <private/qpaintengine_x11_p.h> #include <private/qfontengine_x11_p.h> #include <private/qwidget_p.h> +#include <private/qpainterpath_p.h> #include "qpen.h" #include "qcolor.h" @@ -1479,14 +1480,10 @@ void QX11PaintEngine::drawEllipse(const QRect &rect) return; } d->setupAdaptedOrigin(rect.topLeft()); - if (d->has_brush) { // draw filled ellipse - if (!d->has_pen) { - XFillArc(d->dpy, d->hd, d->gc_brush, x, y, w-1, h-1, 0, 360*64); + if (d->has_brush) { // draw filled ellipse + XFillArc(d->dpy, d->hd, d->gc_brush, x, y, w, h, 0, 360*64); + if (!d->has_pen) // make smoother outline XDrawArc(d->dpy, d->hd, d->gc_brush, x, y, w-1, h-1, 0, 360*64); - return; - } else{ - XFillArc(d->dpy, d->hd, d->gc_brush, x, y, w, h, 0, 360*64); - } } if (d->has_pen) // draw outline XDrawArc(d->dpy, d->hd, d->gc, x, y, w, h, 0, 360*64); @@ -1760,9 +1757,14 @@ void QX11PaintEngine::drawPath(const QPainterPath &path) QPainterPath stroke; qreal width = d->cpen.widthF(); QPolygonF poly; + QRectF deviceRect(0, 0, d->pdev->width(), d->pdev->height()); // necessary to get aliased alphablended primitives to be drawn correctly if (d->cpen.isCosmetic() || d->has_scaling_xform) { - stroker.setWidth(width == 0 ? 1 : width * d->xform_scale); + if (d->cpen.isCosmetic()) + stroker.setWidth(width == 0 ? 1 : width); + else + stroker.setWidth(width * d->xform_scale); + stroker.d_ptr->stroker.setClipRect(deviceRect); stroke = stroker.createStroke(path * d->matrix); if (stroke.isEmpty()) return; @@ -1770,6 +1772,7 @@ void QX11PaintEngine::drawPath(const QPainterPath &path) d->fillPath(stroke, QX11PaintEnginePrivate::PenGC, false); } else { stroker.setWidth(width); + stroker.d_ptr->stroker.setClipRect(d->matrix.inverted().mapRect(deviceRect)); stroke = stroker.createStroke(path); if (stroke.isEmpty()) return; diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 72dd189..8eaad60 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -258,6 +258,8 @@ QPainterState *QPaintEngineEx::createState(QPainterState *orig) const return new QPainterState(orig); } +extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp + void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) { #ifdef QT_DEBUG_DRAW @@ -326,7 +328,6 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) flags |= QVectorPath::CurvedShapeHint; // ### Perspective Xforms are currently not supported... - extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp qreal txscale = 1; if (!(pen.isCosmetic() || (qt_scaleForTransform(state()->matrix, &txscale) && txscale != 1))) { // We include cosmetic pens in this case to avoid having to diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 1f61e2f..2fa6a56 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1293,7 +1293,7 @@ void QPainterPrivate::updateState(QPainterState *newState) destination. Note that composition transformation operates pixelwise. For that - reason, there is a difference between using the grahic primitive + reason, there is a difference between using the graphic primitive itself and its bounding rectangle: The bounding rect contains pixels with alpha == 0 (i.e the pixels surrounding the primitive). These pixels will overwrite the other image's pixels, @@ -1465,8 +1465,8 @@ bool QPainter::isActive() const /*! Initializes the painters pen, background and font to the same as - the given \a widget. Call this function after begin() while the - painter is active. + the given \a widget. This function is called automatically when the + painter is opened on a QWidget. \sa begin(), {QPainter#Settings}{Settings} */ @@ -2371,6 +2371,11 @@ void QPainter::setClipping(bool enable) Returns the currently set clip region. Note that the clip region is given in logical coordinates. + \warning QPainter does not store the combined clip explicitly as + this is handled by the underlying QPaintEngine, so the path is + recreated on demand and transformed to the current logical + coordinate system. This is potentially an expensive operation. + \sa setClipRegion(), clipPath(), setClipping() */ @@ -2480,10 +2485,17 @@ QRegion QPainter::clipRegion() const return region; } +extern QPainterPath qt_regionToPath(const QRegion ®ion); + /*! Returns the currently clip as a path. Note that the clip path is given in logical coordinates. + \warning QPainter does not store the combined clip explicitly as + this is handled by the underlying QPaintEngine, so the path is + recreated on demand and transformed to the current logical + coordinate system. This is potentially an expensive operation. + \sa setClipPath(), clipRegion(), setClipping() */ QPainterPath QPainter::clipPath() const @@ -2520,7 +2532,6 @@ QPainterPath QPainter::clipPath() const return path * matrix; } else { // Fallback to clipRegion() for now, since we don't have isect/unite for paths - extern QPainterPath qt_regionToPath(const QRegion ®ion); return qt_regionToPath(clipRegion()); } } @@ -3084,6 +3095,9 @@ void QPainter::strokePath(const QPainterPath &path, const QPen &pen) return; } + if (path.isEmpty()) + return; + if (d->extended) { const QGradient *g = qpen_brush(pen).gradient(); if (!g || g->coordinateMode() == QGradient::LogicalMode) { @@ -3124,6 +3138,9 @@ void QPainter::fillPath(const QPainterPath &path, const QBrush &brush) return; } + if (path.isEmpty()) + return; + if (d->extended) { const QGradient *g = brush.gradient(); if (!g || g->coordinateMode() == QGradient::LogicalMode) { @@ -5148,9 +5165,6 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) Q_D(QPainter); - if (!d->engine || pm.isNull()) - return; - #ifndef QT_NO_DEBUG qt_painter_thread_test(d->device->devType(), "drawPixmap()"); #endif @@ -5160,12 +5174,18 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) return; } + if (!d->engine) + return; + qreal x = p.x(); qreal y = p.y(); int w = pm.width(); int h = pm.height(); + if (w <= 0) + return; + // Emulate opaque background for bitmaps if (d->state->bgMode == Qt::OpaqueMode && pm.isQBitmap()) { fillRect(QRectF(x, y, w, h), d->state->bgBrush.color()); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index bb07f81..e1f5eea 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1725,7 +1725,7 @@ static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt, */ bool QPainterPath::contains(const QPointF &pt) const { - if (isEmpty()) + if (isEmpty() || !controlPointRect().contains(pt)) return false; QPainterPathData *d = d_func(); @@ -2387,21 +2387,13 @@ void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y, \sa QPen, QBrush */ -class QPainterPathStrokerPrivate +QPainterPathStrokerPrivate::QPainterPathStrokerPrivate() + : dashOffset(0) { -public: - QPainterPathStrokerPrivate() - : dashOffset(0) - { - stroker.setMoveToHook(qt_path_stroke_move_to); - stroker.setLineToHook(qt_path_stroke_line_to); - stroker.setCubicToHook(qt_path_stroke_cubic_to); - } - - QStroker stroker; - QVector<qfixed> dashPattern; - qreal dashOffset; -}; + stroker.setMoveToHook(qt_path_stroke_move_to); + stroker.setLineToHook(qt_path_stroke_line_to); + stroker.setCubicToHook(qt_path_stroke_cubic_to); +} /*! Creates a new stroker. @@ -2445,6 +2437,7 @@ QPainterPath QPainterPathStroker::createStroke(const QPainterPath &path) const QDashStroker dashStroker(&d->stroker); dashStroker.setDashPattern(d->dashPattern); dashStroker.setDashOffset(d->dashOffset); + dashStroker.setClipRect(d->stroker.clipRect()); dashStroker.strokePath(path, &stroke, QTransform()); } stroke.setFillRule(Qt::WindingFill); diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index 88fb19d..6cd2af8 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -277,6 +277,8 @@ public: QPainterPath createStroke(const QPainterPath &path) const; private: + friend class QX11PaintEngine; + QPainterPathStrokerPrivate *d_ptr; }; diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 93f9704..29c48df 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -61,9 +61,20 @@ #include <qdebug.h> #include <private/qvectorpath_p.h> +#include <private/qstroker_p.h> QT_BEGIN_NAMESPACE +class QPainterPathStrokerPrivate +{ +public: + QPainterPathStrokerPrivate(); + + QStroker stroker; + QVector<qfixed> dashPattern; + qreal dashOffset; +}; + class QPolygonF; class QVectorPathConverter; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 4a87f6a..55006f6 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1106,6 +1106,11 @@ void QPdfBaseEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) if (!d->hasPen || (d->clipEnabled && d->allClipped)) return; + if (d->stroker.matrix.type() >= QTransform::TxProject) { + QPaintEngine::drawTextItem(p, textItem); + return; + } + *d->currentPage << "q\n"; if(!d->simplePen) *d->currentPage << QPdf::generateMatrix(d->stroker.matrix); @@ -1226,6 +1231,8 @@ void QPdfBaseEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags) setPen(); } +extern QPainterPath qt_regionToPath(const QRegion ®ion); + void QPdfBaseEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op) { Q_D(QPdfBaseEngine); @@ -1252,7 +1259,6 @@ void QPdfBaseEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op) // if we have an alpha region, we have to subtract that from the // any existing clip region since that region will be filled in // later with images - extern QPainterPath qt_regionToPath(const QRegion ®ion); QPainterPath alphaClip = qt_regionToPath(alphaClipping()); if (!alphaClip.isEmpty()) { if (!d->clipEnabled) { diff --git a/src/gui/painting/qprintengine_mac.mm b/src/gui/painting/qprintengine_mac.mm index 7a77e47..b1216b7 100644 --- a/src/gui/painting/qprintengine_mac.mm +++ b/src/gui/painting/qprintengine_mac.mm @@ -62,6 +62,10 @@ bool QMacPrintEngine::begin(QPaintDevice *dev) { Q_D(QMacPrintEngine); + Q_ASSERT(dev && dev->devType() == QInternal::Printer); + if (!static_cast<QPrinter *>(dev)->isValid()) + return false; + if (d->state == QPrinter::Idle && !d->isPrintSessionInitialized()) // Need to reinitialize d->initialize(); @@ -121,24 +125,8 @@ bool QMacPrintEngine::end() if(d->paintEngine->type() == QPaintEngine::CoreGraphics) static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->hd = 0; d->paintEngine->end(); - if (d->state != QPrinter::Idle) { -#ifndef QT_MAC_USE_COCOA - if (d->shouldSuppressStatus()) { - PMSessionEndPageNoDialog(d->session); - PMSessionEndDocumentNoDialog(d->session); - } else { - PMSessionEndPage(d->session); - PMSessionEndDocument(d->session); - } - PMRelease(d->session); -#else - PMSessionEndPageNoDialog(d->session); - PMSessionEndDocumentNoDialog(d->session); - [d->printInfo release]; -#endif - d->printInfo = 0; - d->session = 0; - } + if (d->state != QPrinter::Idle) + d->releaseSession(); d->state = QPrinter::Idle; return true; } @@ -509,6 +497,26 @@ void QMacPrintEnginePrivate::initialize() } } +void QMacPrintEnginePrivate::releaseSession() +{ +#ifndef QT_MAC_USE_COCOA + if (shouldSuppressStatus()) { + PMSessionEndPageNoDialog(session); + PMSessionEndDocumentNoDialog(session); + } else { + PMSessionEndPage(session); + PMSessionEndDocument(session); + } + PMRelease(session); +#else + PMSessionEndPageNoDialog(session); + PMSessionEndDocumentNoDialog(session); + [printInfo release]; +#endif + printInfo = 0; + session = 0; +} + bool QMacPrintEnginePrivate::newPage_helper() { Q_Q(QMacPrintEngine); @@ -737,6 +745,7 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va d->setPaperSize(QPrinter::PaperSize(value.toInt())); break; case PPK_PrinterName: { + bool printerNameSet = false; OSStatus status = noErr; QCFType<CFArrayRef> printerList; status = PMServerCreatePrinterList(kPMServerLocal, &printerList); @@ -747,12 +756,18 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va QString name = QCFString::toQString(PMPrinterGetName(printer)); if (name == value.toString()) { status = PMSessionSetCurrentPMPrinter(d->session, printer); + printerNameSet = true; break; } } } if (status != noErr) qWarning("QMacPrintEngine::setPrinterName: Error setting printer: %ld", long(status)); + if (!printerNameSet) { + qWarning("QMacPrintEngine::setPrinterName: Failed to set printer named '%s'.", qPrintable(value.toString())); + d->releaseSession(); + d->state = QPrinter::Idle; + } break; } case PPK_SuppressSystemPrintStatus: d->suppressStatus = value.toBool(); @@ -876,17 +891,12 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const ret = r; break; } case PPK_PrinterName: { - CFIndex currIndex; - PMPrinter unused; - QCFType<CFArrayRef> printerList; - OSStatus status = PMSessionCreatePrinterList(d->session, &printerList, &currIndex, &unused); + PMPrinter printer; + OSStatus status = PMSessionGetCurrentPrinter(d->session, &printer); if (status != noErr) - qWarning("QMacPrintEngine::printerName: Problem getting list of printers: %ld", long(status)); - if (currIndex != -1 && printerList && currIndex < CFArrayGetCount(printerList)) { - const CFStringRef name = static_cast<CFStringRef>(CFArrayGetValueAtIndex(printerList, currIndex)); - if (name) - ret = QCFString::toQString(name); - } + qWarning("QMacPrintEngine::printerName: Failed getting current PMPrinter: %ld", long(status)); + if (printer) + ret = QCFString::toQString(PMPrinterGetName(printer)); break; } case PPK_Resolution: { ret = d->resolution.hRes; diff --git a/src/gui/painting/qprintengine_mac_p.h b/src/gui/painting/qprintengine_mac_p.h index 5e18845..bc917e7 100644 --- a/src/gui/painting/qprintengine_mac_p.h +++ b/src/gui/painting/qprintengine_mac_p.h @@ -143,6 +143,7 @@ public: hasCustomPaperSize(false), hasCustomPageMargins(false) {} ~QMacPrintEnginePrivate(); void initialize(); + void releaseSession(); bool newPage_helper(); void setPaperSize(QPrinter::PaperSize ps); QPrinter::PaperSize paperSize() const; diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp index fdd44ba..c8674b7 100644 --- a/src/gui/painting/qprintengine_win.cpp +++ b/src/gui/painting/qprintengine_win.cpp @@ -58,12 +58,13 @@ QT_BEGIN_NAMESPACE +extern QPainterPath qt_regionToPath(const QRegion ®ion); + // #define QT_DEBUG_DRAW static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC hdc, bool convertToText, const QTransform &xform, const QPointF &topLeft); - static const struct { int winSizeName; QPrinter::PaperSize qtSizeName; @@ -368,7 +369,7 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem QRgb brushColor = state->pen().brush().color().rgb(); bool fallBack = state->pen().brush().style() != Qt::SolidPattern || qAlpha(brushColor) != 0xff - || QT_WA_INLINE(false, d->txop >= QTransform::TxScale) + || QT_WA_INLINE(d->txop >= QTransform::TxProject, d->txop >= QTransform::TxScale) || ti.fontEngine->type() != QFontEngine::Win; @@ -586,7 +587,6 @@ void QWin32PrintEngine::updateState(const QPaintEngineState &state) if (state.state() & DirtyClipRegion) { QRegion clipRegion = state.clipRegion(); - extern QPainterPath qt_regionToPath(const QRegion ®ion); QPainterPath clipPath = qt_regionToPath(clipRegion); updateClipPath(clipPath, state.clipOperation()); } @@ -621,7 +621,6 @@ void QWin32PrintEngine::updateClipPath(const QPainterPath &clipPath, Qt::ClipOpe } } - extern QPainterPath qt_regionToPath(const QRegion ®ion); QPainterPath aclip = qt_regionToPath(alphaClipping()); if (!aclip.isEmpty()) { QTransform tx(d->stretch_x, 0, 0, d->stretch_y, d->origin_x, d->origin_y); diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 413f4a1..4f3e71c 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -284,6 +284,10 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke to send PostScript or PDF output to the printer. As an alternative, the printProgram() function can be used to specify the command or utility to use instead of the system default. + + Note that setting parameters like paper size and resolution on an + invalid printer is undefined. You can use QPrinter::isValid() to + verify this before changing any parameters. QPrinter supports a number of parameters, most of which can be changed by the end user through a \l{QPrintDialog}{print dialog}. In @@ -849,7 +853,7 @@ void QPrinter::setPrinterName(const QString &name) Returns true if the printer currently selected is a valid printer in the system, or a pure PDF/PostScript printer; otherwise returns false. - To detect other failures check the output of QPainter::begin() or QPainter::nextPage(). + To detect other failures check the output of QPainter::begin() or QPrinter::newPage(). \snippet doc/src/snippets/printing-qprinter/errors.cpp 0 diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index f728f9d..c88af7c 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qregion.h" +#include "qpainterpath.h" #include "qpolygon.h" #include "qbuffer.h" #include "qdatastream.h" @@ -49,7 +50,6 @@ #include <qdebug.h> #if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) -#include "qpainterpath.h" #include "qimage.h" #include "qbitmap.h" #include <stdlib.h> @@ -65,9 +65,17 @@ QT_BEGIN_NAMESPACE \ingroup shared QRegion is used with QPainter::setClipRegion() to limit the paint - area to what needs to be painted. There is also a - QWidget::repaint() function that takes a QRegion parameter. - QRegion is the best tool for reducing flicker. + area to what needs to be painted. There is also a QWidget::repaint() + function that takes a QRegion parameter. QRegion is the best tool for + minimizing the amount of screen area to be updated by a repaint. + + This class is not suitable for constructing shapes for rendering, especially + as outlines. Use QPainterPath to create paths and shapes for use with + QPainter. + + QRegion is an \l{implicitly shared} class. + + \section1 Creating and Using Regions A region can be created from a rectangle, an ellipse, a polygon or a bitmap. Complex regions may be created by combining simple @@ -84,8 +92,6 @@ QT_BEGIN_NAMESPACE Example of using complex regions: \snippet doc/src/snippets/code/src_gui_painting_qregion.cpp 0 - QRegion is an \l{implicitly shared} class. - \warning Due to window system limitations, the whole coordinate space for a region is limited to the points between -32767 and 32767 on Windows 95/98/ME. You can circumvent this limitation by using a QPainterPath. @@ -93,7 +99,7 @@ QT_BEGIN_NAMESPACE \section1 Additional License Information On Embedded Linux, Windows CE and X11 platforms, parts of this class rely on - code obtained under the following license: + code obtained under the following licenses: \legalese Copyright (c) 1987 X Consortium @@ -120,9 +126,7 @@ QT_BEGIN_NAMESPACE in this Software without prior written authorization from the X Consortium. \endlegalese - \raw HTML - <hr /> - \endraw + \br \legalese Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index c2e2a80..39e429d 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -168,10 +168,10 @@ QT_BEGIN_NAMESPACE \image qtransform-representation.png - A QTransform object contains a 3 x 3 matrix. The \c dx and \c dy - elements specify horizontal and vertical translation. The \c m11 - and \c m22 elements specify horizontal and vertical scaling. The - \c m21 and \c m12 elements specify horizontal and vertical \e shearing. + A QTransform object contains a 3 x 3 matrix. The \c m31 (\c dx) and + \c m32 (\c dy) elements specify horizontal and vertical translation. + The \c m11 and \c m22 elements specify horizontal and vertical scaling. + The \c m21 and \c m12 elements specify horizontal and vertical \e shearing. And finally, the \c m13 and \c m23 elements specify horizontal and vertical projection, with \c m33 as an additional projection factor. @@ -246,8 +246,10 @@ QTransform::QTransform() } /*! - Constructs a matrix with the elements, \a h11, \a h12, \a h13, - \a h21, \a h22, \a h23, \a h31, \a h32, \a h33. + \fn QTransform::QTransform(qreal m11, qreal m12, qreal m13, qreal m21, qreal m22, qreal m23, qreal m31, qreal m32, qreal m33) + + Constructs a matrix with the elements, \a m11, \a m12, \a m13, + \a m21, \a m22, \a m23, \a m31, \a m32, \a m33. \sa setMatrix() */ @@ -263,8 +265,9 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h13, } /*! - Constructs a matrix with the elements, \a h11, \a h12, \a h21, \a - h22, \a dx and \a dy. + \fn QTransform::QTransform(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy) + + Constructs a matrix with the elements, \a m11, \a m12, \a m21, \a m22, \a dx and \a dy. \sa setMatrix() */ @@ -396,6 +399,9 @@ QTransform QTransform::inverted(bool *invertible) const */ QTransform & QTransform::translate(qreal dx, qreal dy) { + if (dx == 0 && dy == 0) + return *this; + switch(type()) { case TxNone: affine._dx = dx; @@ -432,7 +438,10 @@ QTransform & QTransform::translate(qreal dx, qreal dy) QTransform QTransform::fromTranslate(qreal dx, qreal dy) { QTransform transform(1, 0, 0, 1, dx, dy); - transform.m_dirty = TxTranslate; + if (dx == 0 && dy == 0) + transform.m_dirty = TxNone; + else + transform.m_dirty = TxTranslate; return transform; } @@ -444,6 +453,9 @@ QTransform QTransform::fromTranslate(qreal dx, qreal dy) */ QTransform & QTransform::scale(qreal sx, qreal sy) { + if (sx == 1 && sy == 1) + return *this; + switch(type()) { case TxNone: case TxTranslate: @@ -478,7 +490,10 @@ QTransform & QTransform::scale(qreal sx, qreal sy) QTransform QTransform::fromScale(qreal sx, qreal sy) { QTransform transform(sx, 0, 0, sy, 0, 0); - transform.m_dirty = TxScale; + if (sx == 1 && sy == 1) + transform.m_dirty = TxNone; + else + transform.m_dirty = TxScale; return transform; } @@ -541,6 +556,9 @@ const qreal inv_dist_to_plane = 1. / 1024.; */ QTransform & QTransform::rotate(qreal a, Qt::Axis axis) { + if (a == 0) + return *this; + qreal sina = 0; qreal cosa = 0; if (a == 90. || a == -270.) @@ -712,7 +730,15 @@ bool QTransform::operator!=(const QTransform &o) const */ QTransform & QTransform::operator*=(const QTransform &o) { - TransformationType t = qMax(type(), o.type()); + const TransformationType otherType = o.type(); + if (otherType == TxNone) + return *this; + + const TransformationType thisType = type(); + if (thisType == TxNone) + return operator=(o); + + TransformationType t = qMax(thisType, otherType); switch(t) { case TxNone: break; @@ -1219,7 +1245,8 @@ static QPolygonF mapProjective(const QTransform &transform, const QPolygonF &pol */ QPolygonF QTransform::map(const QPolygonF &a) const { - if (type() >= QTransform::TxProject) + TransformationType t = type(); + if (t >= QTransform::TxProject) return mapProjective(*this, a); int size = a.size(); @@ -1228,7 +1255,6 @@ QPolygonF QTransform::map(const QPolygonF &a) const const QPointF *da = a.constData(); QPointF *dp = p.data(); - TransformationType t = type(); for(i = 0; i < size; ++i) { MAP(da[i].xp, da[i].yp, dp[i].xp, dp[i].yp); } @@ -1246,7 +1272,8 @@ QPolygonF QTransform::map(const QPolygonF &a) const */ QPolygon QTransform::map(const QPolygon &a) const { - if (type() >= QTransform::TxProject) + TransformationType t = type(); + if (t >= QTransform::TxProject) return mapProjective(*this, QPolygonF(a)).toPolygon(); int size = a.size(); @@ -1255,7 +1282,6 @@ QPolygon QTransform::map(const QPolygon &a) const const QPoint *da = a.constData(); QPoint *dp = p.data(); - TransformationType t = type(); for(i = 0; i < size; ++i) { qreal nx = 0, ny = 0; MAP(da[i].xp, da[i].yp, nx, ny); @@ -1274,6 +1300,8 @@ QPolygon QTransform::map(const QPolygon &a) const \sa QTransform::map() */ +extern QPainterPath qt_regionToPath(const QRegion ®ion); + /*! \fn QRegion QTransform::map(const QRegion ®ion) const \overload @@ -1295,7 +1323,6 @@ QRegion QTransform::map(const QRegion &r) const return copy; } - extern QPainterPath qt_regionToPath(const QRegion ®ion); QPainterPath p = map(qt_regionToPath(r)); return p.toFillPolygon(QTransform()).toPolygon(); } @@ -1688,13 +1715,12 @@ QRect QTransform::mapRect(const QRect &rect) const return QRect(x, y, w, h); } else if (t < TxProject) { // see mapToPolygon for explanations of the algorithm. - qreal x0 = 0, y0 = 0; - qreal x, y; - MAP(rect.left(), rect.top(), x0, y0); - qreal xmin = x0; - qreal ymin = y0; - qreal xmax = x0; - qreal ymax = y0; + qreal x = 0, y = 0; + MAP(rect.left(), rect.top(), x, y); + qreal xmin = x; + qreal ymin = y; + qreal xmax = x; + qreal ymax = y; MAP(rect.right() + 1, rect.top(), x, y); xmin = qMin(xmin, x); ymin = qMin(ymin, y); @@ -1755,13 +1781,12 @@ QRectF QTransform::mapRect(const QRectF &rect) const } return QRectF(x, y, w, h); } else if (t < TxProject) { - qreal x0 = 0, y0 = 0; - qreal x, y; - MAP(rect.x(), rect.y(), x0, y0); - qreal xmin = x0; - qreal ymin = y0; - qreal xmax = x0; - qreal ymax = y0; + qreal x = 0, y = 0; + MAP(rect.x(), rect.y(), x, y); + qreal xmin = x; + qreal ymin = y; + qreal xmax = x; + qreal ymax = y; MAP(rect.x() + rect.width(), rect.y(), x, y); xmin = qMin(xmin, x); ymin = qMin(ymin, y); @@ -2057,10 +2082,11 @@ QTransform::operator QVariant() const Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale) { - if (transform.type() <= QTransform::TxTranslate) { + const QTransform::TransformationType type = transform.type(); + if (type <= QTransform::TxTranslate) { *scale = 1; return true; - } else if (transform.type() == QTransform::TxScale) { + } else if (type == QTransform::TxScale) { const qreal xScale = qAbs(transform.m11()); const qreal yScale = qAbs(transform.m22()); *scale = qMax(xScale, yScale); @@ -2072,7 +2098,7 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale) const qreal yScale = transform.m12() * transform.m12() + transform.m22() * transform.m22(); *scale = qSqrt(qMax(xScale, yScale)); - return transform.type() == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); + return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); } QT_END_NAMESPACE diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index de7ebcd..c76409b 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -257,6 +257,8 @@ inline qreal QTransform::dy() const inline QTransform &QTransform::operator*=(qreal num) { + if (num == 1.) + return *this; affine._m11 *= num; affine._m12 *= num; m_13 *= num; @@ -271,11 +273,15 @@ inline QTransform &QTransform::operator*=(qreal num) } inline QTransform &QTransform::operator/=(qreal div) { + if (div == 0) + return *this; div = 1/div; return operator*=(div); } inline QTransform &QTransform::operator+=(qreal num) { + if (num == 0) + return *this; affine._m11 += num; affine._m12 += num; m_13 += num; @@ -290,6 +296,8 @@ inline QTransform &QTransform::operator+=(qreal num) } inline QTransform &QTransform::operator-=(qreal num) { + if (num == 0) + return *this; affine._m11 -= num; affine._m12 -= num; m_13 -= num; diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index bcb0380..d941a24 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -310,10 +310,13 @@ void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) int lineskip = img.bytesPerLine(); int depth = img.depth() >> 3; - - const QRect r = rect & QRect(0, 0, img.width(), img.height()); + const QRect imageRect(0, 0, img.width(), img.height()); + const QRect r = rect & imageRect & imageRect.translated(-offset); const QPoint p = rect.topLeft() + offset; + if (r.isEmpty()) + return; + const uchar *src; uchar *dest; diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index 947f9a2..acb8437 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -75,6 +75,7 @@ QT_BEGIN_NAMESPACE static bool displayDepth = -1; +Q_GLOBAL_STATIC(QGtkStyleUpdateScheduler, styleScheduler) typedef QHash<QString, GtkWidget*> WidgetMap; Q_GLOBAL_STATIC(WidgetMap, gtkWidgetMap) @@ -486,11 +487,11 @@ static void init_gtk_menu() } // Updates window/windowtext palette based on the indicated gtk widget -static void ensureWidgetPalette(QWidget* widget, const QString >kWidgetName) +static QPalette gtkWidgetPalette(const QString >kWidgetName) { GtkWidget *gtkWidget = QGtk::gtkWidget(gtkWidgetName); Q_ASSERT(gtkWidget); - QPalette pal = widget->palette(); + QPalette pal = QApplication::palette(); GdkColor gdkBg = gtkWidget->style->bg[GTK_STATE_NORMAL]; GdkColor gdkText = gtkWidget->style->fg[GTK_STATE_NORMAL]; GdkColor gdkDisabledText = gtkWidget->style->fg[GTK_STATE_INSENSITIVE]; @@ -503,8 +504,7 @@ static void ensureWidgetPalette(QWidget* widget, const QString >kWidgetName) pal.setBrush(QPalette::Disabled, QPalette::WindowText, disabledTextColor); pal.setBrush(QPalette::All, QPalette::ButtonText, textColor); pal.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledTextColor); - widget->setPalette(pal); - widget->setAttribute(Qt::WA_SetPalette, false); + return pal; } bool QGtk::isKDE4Session() @@ -515,44 +515,47 @@ bool QGtk::isKDE4Session() return (version == 4); } -// Maps a Gtk widget palettes to a Qt widget -void QGtk::applyGtkSystemPalette(QWidget *widget) +void QGtk::applyCustomPaletteHash() { - // Do not apply if the widget has a custom palette; - if (widget->testAttribute(Qt::WA_SetPalette)) - return; + QPalette menuPal = gtkWidgetPalette(QLS("GtkMenu")); + GdkColor gdkBg = QGtk::gtkWidget(QLS("GtkMenu"))->style->bg[GTK_STATE_NORMAL]; + QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); + menuPal.setBrush(QPalette::Base, bgColor); + menuPal.setBrush(QPalette::Window, bgColor); + qApp->setPalette(menuPal, "QMenu"); - QPalette pal; - if (QStatusBar *statusbar = qobject_cast<QStatusBar*> (widget)) - ensureWidgetPalette(statusbar, QLS("GtkStatusbar")); - else if (QMenuBar *menubar = qobject_cast<QMenuBar*> (widget)) - ensureWidgetPalette(menubar, QLS("GtkMenuBar")); - else if (QToolBar *toolbar = qobject_cast<QToolBar*> (widget)) - ensureWidgetPalette(toolbar, QLS("GtkToolbar")); - else if (QMenu *menubar = qobject_cast<QMenu*> (widget)) { - // This really applies to the combo box rendering since - // QComboBox copies the palette from a QMenu - QPalette pal = widget->palette(); - GdkColor gdkBg = QGtk::gtkWidget(QLS("GtkMenu"))->style->bg[GTK_STATE_NORMAL]; - QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); - pal.setBrush(QPalette::Base, bgColor); - menubar->setPalette(pal); - } - widget->setAttribute(Qt::WA_SetPalette, false); + QPalette toolbarPal = gtkWidgetPalette(QLS("GtkToolbar")); + qApp->setPalette(toolbarPal, "QToolBar"); + + QPalette menuBarPal = gtkWidgetPalette(QLS("GtkMenuBar")); + qApp->setPalette(menuBarPal, "QMenuBar"); } static void gtkStyleSetCallback(GtkWidget*, GtkStyle*, void*) { + // We have to let this function return and complete the event + // loop to ensure that all gtk widgets have been styled before + // updating + QMetaObject::invokeMethod(styleScheduler(), "updateTheme", Qt::QueuedConnection); +} + +void QGtkStyleUpdateScheduler::updateTheme() +{ static QString oldTheme(QLS("qt_not_set")); QPixmapCache::clear(); - qApp->setFont(QGtk::getThemeFont()); - QGtk::initGtkWidgets(); if (oldTheme != getThemeName()) { oldTheme = getThemeName(); - QApplicationPrivate::setSystemPalette(qApp->style()->standardPalette()); + qApp->setFont(QGtk::getThemeFont()); + QPalette newPalette = qApp->style()->standardPalette(); + QApplicationPrivate::setSystemPalette(newPalette); + QApplication::setPalette(newPalette); + QGtk::initGtkWidgets(); + QGtk::applyCustomPaletteHash(); QList<QWidget*> widgets = QApplication::allWidgets(); + // Notify all widgets that size metrics might have changed foreach (QWidget *widget, widgets) { - QGtk::applyGtkSystemPalette(widget); + QEvent e(QEvent::StyleChange); + QApplication::sendEvent(widget, &e); } } } @@ -629,17 +632,26 @@ GtkStyle* QGtk::gtkStyle(const QString &path) return gtkWidgetMap()->value(path)->style; return 0; } + +#ifdef Q_OS_LINUX QT_END_NAMESPACE int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); QT_BEGIN_NAMESPACE +#endif + void QGtk::initGtkWidgets() { // From gtkmain.c + uid_t ruid, rgid, euid, egid, suid, sgid; - if (getresuid (&ruid, &euid, &suid) != 0 || getresgid (&rgid, &egid, &sgid) != 0) { + +#ifdef Q_OS_LINUX + if (getresuid (&ruid, &euid, &suid) != 0 || getresgid (&rgid, &egid, &sgid) != 0) +#endif + { suid = ruid = getuid (); sgid = rgid = getgid (); euid = geteuid (); @@ -652,7 +664,7 @@ void QGtk::initGtkWidgets() "See http://www.gtk.org/setuid.html for more information.\n"); return; } - + init_gtk_window(); if (QGtk::gtk_init) { diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h index 0cea542..74c5dc3 100644 --- a/src/gui/styles/gtksymbols_p.h +++ b/src/gui/styles/gtksymbols_p.h @@ -204,7 +204,7 @@ public: static void cleanup_gtk_widgets(); static void initGtkWidgets(); static bool isKDE4Session(); - static void applyGtkSystemPalette(QWidget* widget); + static void applyCustomPaletteHash(); static QFont getThemeFont(); static bool isThemeAvailable() { return gtkStyle() != 0; } @@ -329,6 +329,15 @@ public: static Ptr_gconf_client_get_string gconf_client_get_string; }; +// Helper to ensure that we have polished all our gtk widgets +// before updating our own palettes +class QGtkStyleUpdateScheduler : public QObject +{ + Q_OBJECT +public slots: + void updateTheme(); +}; + QT_END_NAMESPACE #endif // !QT_NO_STYLE_GTK diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 103e97f..b7fa575 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -38,7 +38,6 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include "qgtkstyle.h" #if !defined(QT_NO_STYLE_GTK) @@ -138,6 +137,30 @@ static const char * const dock_widget_restore_xpm[] = }; +class QGtkStyleFilter : public QObject +{ +public: + QGtkStyleFilter() { + qApp->installEventFilter(this); + } + +private: + bool eventFilter(QObject *obj, QEvent *e); +}; + +bool QGtkStyleFilter::eventFilter(QObject *obj, QEvent *e) +{ + if (e->type() == QEvent::ApplicationPaletteChange) { + // Only do this the first time since this will also + // generate applicationPaletteChange events + extern QHash<QByteArray, QPalette> *qt_app_palettes_hash(); //qapplication.cpp + if (!qt_app_palettes_hash() || qt_app_palettes_hash()->isEmpty()) { + QGtk::applyCustomPaletteHash(); + } + } + return QObject::eventFilter(obj, e); +} + class QGtkStylePrivate : public QCleanlooksStylePrivate { Q_DECLARE_PUBLIC(QGtkStyle) @@ -145,6 +168,7 @@ public: QGtkStylePrivate() : QCleanlooksStylePrivate() {} + QGtkStyleFilter filter; }; static const int groupBoxBottomMargin = 2; // space below the groupbox @@ -217,6 +241,7 @@ static QString uniqueName(const QString &key, const QStyleOption *option, const Constructs a QGtkStyle object. */ QGtkStyle::QGtkStyle() + : QCleanlooksStyle(*new QGtkStylePrivate) { QGtk::initGtkWidgets(); } @@ -313,7 +338,7 @@ void QGtkStyle::polish(QPalette &palette) if (!QGtk::isThemeAvailable()) QCleanlooksStyle::polish(palette); else - palette = standardPalette(); + palette = palette.resolve(standardPalette()); } /*! @@ -328,6 +353,7 @@ void QGtkStyle::polish(QApplication *app) if (app->desktopSettingsAware() && QGtk::isThemeAvailable()) { QApplicationPrivate::setSystemPalette(standardPalette()); QApplicationPrivate::setSystemFont(QGtk::getThemeFont()); + QGtk::applyCustomPaletteHash(); if (!QGtk::isKDE4Session()) { qt_filedialog_open_filename_hook = &QGtk::openFilename; qt_filedialog_save_filename_hook = &QGtk::saveFilename; @@ -357,12 +383,12 @@ void QGtkStyle::unpolish(QApplication *app) /*! \reimp */ + void QGtkStyle::polish(QWidget *widget) { QCleanlooksStyle::polish(widget); if (!QGtk::isThemeAvailable()) return; - if (qobject_cast<QAbstractButton*>(widget) || qobject_cast<QToolButton*>(widget) || qobject_cast<QComboBox*>(widget) @@ -375,8 +401,6 @@ void QGtkStyle::polish(QWidget *widget) widget->setAttribute(Qt::WA_Hover); else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) tree->viewport()->setAttribute(Qt::WA_Hover); - - QGtk::applyGtkSystemPalette(widget); } /*! @@ -399,6 +423,17 @@ int QGtkStyle::pixelMetric(PixelMetric metric, return QCleanlooksStyle::pixelMetric(metric, option, widget); switch (metric) { + case PM_DefaultFrameWidth: + if (qobject_cast<const QFrame*>(widget)) { + if (GtkStyle *style = + QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(), + "*.GtkScrolledWindow", + "*.GtkScrolledWindow", + Q_GTK_TYPE_WINDOW)) + return qMax(style->xthickness, style->ythickness); + } + return 2; + case PM_MenuButtonIndicator: return 20; @@ -635,6 +670,66 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, QGtkPainter gtkPainter(painter); switch (element) { + case PE_Frame: { + if (widget && widget->inherits("QComboBoxPrivateContainer")){ + QStyleOption copy = *option; + copy.state |= State_Raised; + drawPrimitive(PE_PanelMenu, ©, painter, widget); + break; + } + // Drawing the entire itemview frame is very expensive, especially on the native X11 engine + // Instead we cheat a bit and draw a border image without the center part, hence only scaling + // thin rectangular images + const int pmSize = 64; + const int border = pixelMetric(PM_DefaultFrameWidth, option, widget); + const QString pmKey = QString(QLS("windowframe %0")).arg(option->state); + + QPixmap pixmap; + QPixmapCache::find(pmKey, pixmap); + QRect pmRect(QPoint(0,0), QSize(pmSize, pmSize)); + + // Only draw through style once + if (pixmap.isNull()) { + pixmap = QPixmap(pmSize, pmSize); + pixmap.fill(Qt::transparent); + QPainter pmPainter(&pixmap); + QGtkPainter gtkFramePainter(&pmPainter); + gtkFramePainter.setUsePixmapCache(false); // Don't cache twice + + GtkShadowType shadow_type = GTK_SHADOW_NONE; + if (option->state & State_Sunken) + shadow_type = GTK_SHADOW_IN; + else if (option->state & State_Raised) + shadow_type = GTK_SHADOW_OUT; + + GtkStyle *style = QGtk::gtk_rc_get_style_by_paths(QGtk::gtk_settings_get_default(), + "*.GtkScrolledWindow", "*.GtkScrolledWindow", Q_GTK_TYPE_WINDOW); + if (style) + gtkFramePainter.paintShadow(QGtk::gtkWidget(QLS("GtkFrame")), "viewport", pmRect, + option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, + shadow_type, style); + QPixmapCache::insert(pmKey, pixmap); + } + + QRect rect = option->rect; + const int rw = rect.width() - border; + const int rh = rect.height() - border; + const int pw = pmRect.width() - border; + const int ph = pmRect.height() - border; + + // Sidelines + painter->drawPixmap(rect.adjusted(border, 0, -border, -rh), pixmap, pmRect.adjusted(border, 0, -border,-ph)); + painter->drawPixmap(rect.adjusted(border, rh, -border, 0), pixmap, pmRect.adjusted(border, ph,-border,0)); + painter->drawPixmap(rect.adjusted(0, border, -rw, -border), pixmap, pmRect.adjusted(0, border, -pw, -border)); + painter->drawPixmap(rect.adjusted(rw, border, 0, -border), pixmap, pmRect.adjusted(pw, border, 0, -border)); + + // Corners + painter->drawPixmap(rect.adjusted(0, 0, -rw, -rh), pixmap, pmRect.adjusted(0, 0, -pw,-ph)); + painter->drawPixmap(rect.adjusted(rw, 0, 0, -rh), pixmap, pmRect.adjusted(pw, 0, 0,-ph)); + painter->drawPixmap(rect.adjusted(0, rh, -rw, 0), pixmap, pmRect.adjusted(0, ph, -pw,0)); + painter->drawPixmap(rect.adjusted(rw, rh, 0, 0), pixmap, pmRect.adjusted(pw, ph, 0,0)); + } + break; case PE_PanelTipLabel: { GtkWidget *gtkWindow = QGtk::gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed @@ -882,7 +977,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, if (widget && widget->testAttribute(Qt::WA_SetPalette) && resolve_mask & (1 << QPalette::Base)) // Palette overridden by user - painter->fillRect(textRect, option->palette.base().color()); + painter->fillRect(textRect, option->palette.base()); else gtkPainter.paintFlatBox( gtkEntry, "entry_bg", textRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, gtkEntry->style); @@ -2412,6 +2507,10 @@ void QGtkStyle::drawControl(ControlElement element, if (selected) { QRect rect = option->rect.adjusted(0, 0, -1, -1); +#ifndef QT_NO_COMBOBOX + if (qobject_cast<const QComboBox*>(widget)) + rect = option->rect; +#endif gtkPainter.paintBox( gtkMenuItem, "menuitem", rect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style); } @@ -2528,16 +2627,24 @@ void QGtkStyle::drawControl(ControlElement element, opt.rect = vCheckRect; drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); } - painter->drawPixmap(pmr.topLeft(), pixmap); } GdkColor gdkText = gtkMenuItem->style->fg[GTK_STATE_NORMAL]; GdkColor gdkDText = gtkMenuItem->style->fg[GTK_STATE_INSENSITIVE]; GdkColor gdkHText = gtkMenuItem->style->fg[GTK_STATE_PRELIGHT]; + uint resolve_mask = option->palette.resolve(); QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); QColor disabledTextColor = QColor(gdkDText.red>>8, gdkDText.green>>8, gdkDText.blue>>8); + if (resolve_mask & (1 << QPalette::ButtonText)) { + textColor = option->palette.buttonText().color(); + disabledTextColor = option->palette.brush(QPalette::Disabled, QPalette::ButtonText).color(); + } + QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8); + if (resolve_mask & (1 << QPalette::HighlightedText)) { + highlightedTextColor = option->palette.highlightedText().color(); + } if (selected) painter->setPen(highlightedTextColor); @@ -2653,10 +2760,13 @@ void QGtkStyle::drawControl(ControlElement element, if (tab->state & State_Selected) state = GTK_STATE_NORMAL; - bool first = tab->position == QStyleOptionTab::Beginning || tab->position == QStyleOptionTab::OnlyOneTab; - bool last = tab->position == QStyleOptionTab::End || tab->position == QStyleOptionTab::OnlyOneTab; bool selected = (tab->state & State_Selected); - if (option->direction == Qt::RightToLeft) { + bool first = false, last = false; + if (widget) { + // This is most accurate and avoids resizing tabs while moving + first = tab->rect.left() == widget->rect().left(); + last = tab->rect.right() == widget->rect().right(); + } else if (option->direction == Qt::RightToLeft) { bool tmp = first; first = last; last = tmp; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 2634d44..398e11d 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -529,6 +529,7 @@ public: QPointer<QFocusFrame> focusWidget; CFAbsoluteTime defaultButtonStart; QMacStyle *q; + bool mouseDown; }; QT_BEGIN_INCLUDE_NAMESPACE @@ -1477,7 +1478,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti #endif QMacStylePrivate::QMacStylePrivate(QMacStyle *style) - : timerID(-1), progressFrame(0), q(style) + : timerID(-1), progressFrame(0), q(style), mouseDown(false) { defaultButtonStart = CFAbsoluteTimeGetCurrent(); memset(&buttonState, 0, sizeof(ButtonState)); @@ -1494,7 +1495,7 @@ bool QMacStylePrivate::animatable(QMacStylePrivate::Animates as, const QWidget * { if (as == AquaPushButton) { QPushButton *pb = const_cast<QPushButton *>(static_cast<const QPushButton *>(w)); - if (w->window()->isActiveWindow() && pb) { + if (w->window()->isActiveWindow() && pb && !mouseDown) { if (static_cast<const QPushButton *>(w) != defaultButton) { // Changed on its own, update the value. const_cast<QMacStylePrivate *>(this)->stopAnimate(as, defaultButton); @@ -1514,8 +1515,7 @@ void QMacStylePrivate::stopAnimate(QMacStylePrivate::Animates as, QWidget *w) if (as == AquaPushButton && defaultButton) { QPushButton *tmp = defaultButton; defaultButton = 0; - if (tmp->isVisible()) - tmp->update(); + tmp->update(); } else if (as == AquaProgressBar) { progressBars.removeAll(w); } @@ -1841,10 +1841,15 @@ bool QMacStylePrivate::eventFilter(QObject *o, QEvent *e) break; case QEvent::MouseButtonPress: // It is very confusing to keep the button pulsing, so just stop the animation. + if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton) + mouseDown = true; stopAnimate(AquaPushButton, btn); break; - case QEvent::FocusOut: case QEvent::MouseButtonRelease: + if (static_cast<QMouseEvent *>(e)->button() == Qt::LeftButton) + mouseDown = false; + // fall through + case QEvent::FocusOut: case QEvent::Show: case QEvent::WindowActivate: { QList<QPushButton *> list = qFindChildren<QPushButton *>(btn->window()); @@ -2184,7 +2189,7 @@ void QMacStyle::polish(QWidget* w) } if (qobject_cast<QMenu*>(w) || qobject_cast<QComboBoxPrivateContainer *>(w)) { - w->setWindowOpacity(0.94); + w->setWindowOpacity(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5 ? 0.985 : 0.94); if (!w->testAttribute(Qt::WA_SetPalette)) { QPixmap px(64, 64); HIThemeMenuDrawInfo mtinfo; @@ -3849,13 +3854,16 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; case CE_TabBarTabShape: - if (const QStyleOptionTabV3 *tabOpt = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { - if (tabOpt->documentMode) { - p->save(); - QRect tabRect = tabOpt->rect; - drawTabShape(p, tabOpt); - p->restore(); - return; + if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) { + + if (const QStyleOptionTabV3 *tabOptV3 = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { + if (tabOptV3->documentMode) { + p->save(); + QRect tabRect = tabOptV3->rect; + drawTabShape(p, tabOptV3); + p->restore(); + return; + } } #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index f42792d..49ac57a 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -1514,20 +1514,11 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorRole fr, QPalette void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const QWidget *w, bool embedded) { -#ifdef QT_NO_COMBOBOX - const bool isReadOnlyCombo = false; -#else - const bool isReadOnlyCombo = qobject_cast<const QComboBox *>(w) != 0; -#endif - if (bg && bg->brush.style() != Qt::NoBrush) { - if (isReadOnlyCombo) { - p->setBrush(cg, QPalette::Base, bg->brush); // for windows, windowxp - p->setBrush(cg, QPalette::Button, bg->brush); // for plastique - } else { - p->setBrush(cg, w->backgroundRole(), bg->brush); - //p->setBrush(cg, QPalette::Window, bg->brush); - } + p->setBrush(cg, QPalette::Base, bg->brush); // for windows, windowxp + p->setBrush(cg, QPalette::Button, bg->brush); // for plastique + p->setBrush(cg, w->backgroundRole(), bg->brush); + p->setBrush(cg, QPalette::Window, bg->brush); } if (embedded) { @@ -1542,12 +1533,9 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q return; if (pal->foreground.style() != Qt::NoBrush) { - if (isReadOnlyCombo) { - p->setBrush(cg, QPalette::ButtonText, pal->foreground); - } else { - p->setBrush(cg, w->foregroundRole(), pal->foreground); - p->setBrush(cg, QPalette::WindowText, pal->foreground); - } + p->setBrush(cg, QPalette::ButtonText, pal->foreground); + p->setBrush(cg, w->foregroundRole(), pal->foreground); + p->setBrush(cg, QPalette::WindowText, pal->foreground); p->setBrush(cg, QPalette::Text, pal->foreground); } if (pal->selectionBackground.style() != Qt::NoBrush) @@ -2916,6 +2904,10 @@ void QStyleSheetStyle::polish(QWidget *w) if (ew->autoFillBackground()) { ew->setAutoFillBackground(false); autoFillDisabledWidgets->insert(w); + if (ew != w) { //eg. viewport of a scrollarea + //(in order to draw the background anyway in case we don't.) + ew->setAttribute(Qt::WA_StyledBackground, true); + } } if (!rule.hasBackground() || rule.background()->isTransparent() || rule.hasBox() || (!rule.hasNativeBorder() && !rule.border()->isOpaque())) @@ -4345,8 +4337,16 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op return; case PE_Widget: - if (!rule.hasBackground()) + if (!rule.hasBackground()) { + QWidget *container = containerWidget(w); + if (autoFillDisabledWidgets->contains(container) + && (container == w || !renderRule(container, opt).hasBackground())) { + //we do not have a background, but we disabled the autofillbackground anyway. so fill the background now. + // (this may happen if we have rules like :focus) + p->fillRect(opt->rect, opt->palette.brush(w->backgroundRole())); + } break; + } #ifndef QT_NO_SCROLLAREA if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) { @@ -4623,15 +4623,6 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const break; case PM_DefaultFrameWidth: -#ifndef QT_NO_COMBOBOX - // QComboBox uses this for resizing its popup - if (qobject_cast<const QComboBox *>(w)) { - QAbstractItemView *view = qFindChild<QAbstractItemView *>(w); - QRenderRule subRule = renderRule(view, PseudoElement_None); - if (!subRule.hasNativeBorder()) - return subRule.border()->borders[TopEdge] + (subRule.hasBox() ? subRule.box()->paddings[TopEdge] : 0); - } else -#endif if (!rule.hasNativeBorder()) return rule.border()->borders[LeftEdge]; break; @@ -4849,7 +4840,8 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const if (subRule.hasContentsSize()) return subRule.size().height(); else if (subRule.hasBox() || subRule.hasBorder()) { - return subRule.size(QSize(0, opt->fontMetrics.lineSpacing())).height(); + QFontMetrics fm = opt ? opt->fontMetrics : w->fontMetrics(); + return subRule.size(QSize(0, fm.lineSpacing())).height(); } break; } diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp index c52c700..1c03b9e 100644 --- a/src/gui/styles/qwindowsmobilestyle.cpp +++ b/src/gui/styles/qwindowsmobilestyle.cpp @@ -3401,6 +3401,9 @@ int QWindowsMobileStyle::styleHint(StyleHint hint, const QStyleOption *opt, cons case SH_ScrollBar_ContextMenu: ret = false; break; + case SH_MenuBar_AltKeyNavigation: + ret = false; + break; default: ret = QWindowsStyle::styleHint(hint, opt, widget, returnData); break; diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 4c3060d..013ca1e 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -801,12 +801,20 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt if (vopt->viewItemPosition == QStyleOptionViewItemV4::OnlyOne || vopt->viewItemPosition == QStyleOptionViewItemV4::Invalid) painter->drawPixmap(pixmapRect.topLeft(), pixmap); - else if (reverse ? rightSection : leftSection) - painter->drawPixmap(pixmapRect, pixmap, srcRect.adjusted(0, 0, -frame, 0)); - else if (reverse ? leftSection : rightSection) - painter->drawPixmap(pixmapRect, pixmap, - srcRect.adjusted(frame, 0, 0, 0)); - else if (vopt->viewItemPosition == QStyleOptionViewItemV4::Middle) + else if (reverse ? rightSection : leftSection){ + painter->drawPixmap(QRect(pixmapRect.topLeft(), + QSize(frame, pixmapRect.height())), pixmap, + QRect(QPoint(0, 0), QSize(frame, pixmapRect.height()))); + painter->drawPixmap(pixmapRect.adjusted(frame, 0, 0, 0), + pixmap, srcRect.adjusted(frame, 0, -frame, 0)); + } else if (reverse ? leftSection : rightSection) { + painter->drawPixmap(QRect(pixmapRect.topRight() - QPoint(frame - 1, 0), + QSize(frame, pixmapRect.height())), pixmap, + QRect(QPoint(pixmapRect.width() - frame, 0), + QSize(frame, pixmapRect.height()))); + painter->drawPixmap(pixmapRect.adjusted(0, 0, -frame, 0), + pixmap, srcRect.adjusted(frame, 0, -frame, 0)); + } else if (vopt->viewItemPosition == QStyleOptionViewItemV4::Middle) painter->drawPixmap(pixmapRect, pixmap, srcRect.adjusted(frame, 0, -frame, 0)); } else { @@ -2388,6 +2396,9 @@ void QWindowsVistaStyle::polish(QWidget *widget) else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) { tree->viewport()->setAttribute(Qt::WA_Hover); } + else if (QListView *list = qobject_cast<QListView *> (widget)) { + list->viewport()->setAttribute(Qt::WA_Hover); + } } /*! diff --git a/src/gui/styles/qwindowsvistastyle_p.h b/src/gui/styles/qwindowsvistastyle_p.h index 877bc50..cef2b71 100644 --- a/src/gui/styles/qwindowsvistastyle_p.h +++ b/src/gui/styles/qwindowsvistastyle_p.h @@ -76,6 +76,7 @@ #include <qscrollbar.h> #include <qprogressbar.h> #include <qdockwidget.h> +#include <qlistview.h> #include <qtreeview.h> #include <qtextedit.h> #include <qmessagebox.h> diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 9d735a7..2f4254e 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -607,7 +607,7 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) QPainter *painter = themeData.painter; Q_ASSERT_X(painter != 0, "QWindowsXPStylePrivate::drawBackground()", "Trying to draw a theme part without a painter"); - if (!painter) + if (!painter || !painter->isActive()) return; painter->save(); @@ -2834,7 +2834,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo bflags |= State_MouseOver; } } - + QStyleOption tool(0); tool.palette = toolbutton->palette; if (toolbutton->subControls & SC_ToolButton) { diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 02fe2b2..db1e781 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -2682,7 +2682,10 @@ bool Parser::parseFunction(QString *name, QString *args) bool Parser::parseHexColor(QColor *col) { col->setNamedColor(lexem()); - if (!col->isValid()) return false; + if (!col->isValid()) { + qWarning("QCssParser::parseHexColor: Unknown color name '%s'",lexem().toLatin1().constData()); + return false; + } skipSpace(); return true; } diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 8538040..43f5b1e 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -249,9 +249,10 @@ QFontPrivate::~QFontPrivate() } #if !defined(Q_WS_MAC) +extern QMutex *qt_fontdatabase_mutex(); + QFontEngine *QFontPrivate::engineForScript(int script) const { - extern QMutex *qt_fontdatabase_mutex(); QMutexLocker locker(qt_fontdatabase_mutex()); if (script >= QUnicodeTables::Inherited) script = QUnicodeTables::Common; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index c4dffdf..47fe5c2 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -542,7 +542,7 @@ void QFontEngine::addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &glyp advanceY += glyphs.advances_y[i]; continue; } - QImage alphaMask = alphaMapForGlyph(glyphs.glyphs[i]); + const QImage alphaMask = alphaMapForGlyph(glyphs.glyphs[i]); const int w = alphaMask.width(); const int h = alphaMask.height(); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 264d8de..cb0b436 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -521,15 +521,28 @@ QFontEngineFT::Glyph::~Glyph() delete [] data; } -#if !defined(QT_USE_FREETYPE_LCDFILTER) static const uint subpixel_filter[3][3] = { { 180, 60, 16 }, { 38, 180, 38 }, { 16, 60, 180 } }; -#endif -static void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr) +static inline uint filterPixel(uint red, uint green, uint blue, bool legacyFilter) +{ + uint res; + if (legacyFilter) { + uint high = (red*subpixel_filter[0][0] + green*subpixel_filter[0][1] + blue*subpixel_filter[0][2]) >> 8; + uint mid = (red*subpixel_filter[1][0] + green*subpixel_filter[1][1] + blue*subpixel_filter[1][2]) >> 8; + uint low = (red*subpixel_filter[2][0] + green*subpixel_filter[2][1] + blue*subpixel_filter[2][2]) >> 8; + res = (mid << 24) + (high << 16) + (mid << 8) + low; + } else { + uint alpha = green; + res = (alpha << 24) + (red << 16) + (green << 8) + blue; + } + return res; +} + +static void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr, bool legacyFilter) { int h = height; const int offs = bgr ? -1 : 1; @@ -540,9 +553,7 @@ static void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, uint red = src[x+1-offs]; uint green = src[x+1]; uint blue = src[x+1+offs]; - uint alpha = green; - uint res = (alpha << 24) + (red << 16) + (green << 8) + blue; - *dd = res; + *dd = filterPixel(red, green, blue, legacyFilter); ++dd; } dst += width; @@ -550,7 +561,7 @@ static void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, } } -static void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr) +static void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr, bool legacyFilter) { int h = height; const int offs = bgr ? -src_pitch : src_pitch; @@ -559,16 +570,7 @@ static void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int heigh uint red = src[x+src_pitch-offs]; uint green = src[x+src_pitch]; uint blue = src[x+src_pitch+offs]; -#if defined(QT_USE_FREETYPE_LCDFILTER) - uint alpha = green; - uint res = (alpha << 24) + (red << 16) + (green << 8) + blue; -#else - uint high = (red*subpixel_filter[0][0] + green*subpixel_filter[0][1] + blue*subpixel_filter[0][2]) >> 8; - uint mid = (red*subpixel_filter[1][0] + green*subpixel_filter[1][1] + blue*subpixel_filter[1][2]) >> 8; - uint low = (red*subpixel_filter[2][0] + green*subpixel_filter[2][1] + blue*subpixel_filter[2][2]) >> 8; - uint res = (mid << 24) + (high << 16) + (mid << 8) + low; -#endif - dst[x] = res; + dst[x] = filterPixel(red, green, blue, legacyFilter); } dst += width; src += 3*src_pitch; @@ -923,8 +925,14 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph uchar *glyph_buffer = 0; int glyph_buffer_size = 0; #if defined(QT_USE_FREETYPE_LCDFILTER) + bool useFreetypeRenderGlyph = false; if (slot->format == FT_GLYPH_FORMAT_OUTLINE && (hsubpixel || vfactor != 1)) { - FT_Library_SetLcdFilter(library, (FT_LcdFilter)lcdFilterType); + err = FT_Library_SetLcdFilter(library, (FT_LcdFilter)lcdFilterType); + if (err == FT_Err_Ok) + useFreetypeRenderGlyph = true; + } + + if (useFreetypeRenderGlyph) { err = FT_Render_Glyph(slot, hsubpixel ? FT_RENDER_MODE_LCD : FT_RENDER_MODE_LCD_V); if (err != FT_Err_Ok) @@ -932,8 +940,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph FT_Library_SetLcdFilter(library, FT_LCD_FILTER_NONE); - info.height = slot->bitmap.rows; - info.width = slot->bitmap.width / 3; + info.height = slot->bitmap.rows / vfactor; + info.width = hsubpixel ? slot->bitmap.width / 3 : slot->bitmap.width; info.x = -slot->bitmap_left; info.y = slot->bitmap_top; @@ -941,9 +949,9 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph glyph_buffer = new uchar[glyph_buffer_size]; if (hsubpixel) - convertRGBToARGB(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB); + convertRGBToARGB(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB, false); else if (vfactor != 1) - convertRGBToARGB_V(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB); + convertRGBToARGB_V(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB, false); } else #endif { @@ -1042,11 +1050,19 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph Q_ASSERT (bitmap.pixel_mode == FT_PIXEL_MODE_GRAY); Q_ASSERT(antialias); uchar *convoluted = new uchar[bitmap.rows*bitmap.pitch]; - convoluteBitmap(bitmap.buffer, convoluted, bitmap.width, info.height, bitmap.pitch); - convertRGBToARGB(convoluted + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB); + bool useLegacyLcdFilter = false; +#if defined(FC_LCD_FILTER) && defined(FT_LCD_FILTER_H) + useLegacyLcdFilter = (lcdFilterType == FT_LCD_FILTER_LEGACY); +#endif + uchar *buffer = bitmap.buffer; + if (!useLegacyLcdFilter) { + convoluteBitmap(bitmap.buffer, convoluted, bitmap.width, info.height, bitmap.pitch); + buffer = convoluted; + } + convertRGBToARGB(buffer + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB, useLegacyLcdFilter); delete [] convoluted; } else if (vfactor != 1) { - convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB); + convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB, true); } if (bitmap.buffer != glyph_buffer) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 40d145a..425cab2 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -120,7 +120,7 @@ OSStatus QMacFontPath::closePath(void *data) #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, const ATSFontRef &atsFontRef, const QFontDef &fontDef, bool) +QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, const ATSFontRef &atsFontRef, const QFontDef &fontDef, bool kerning) : QFontEngineMulti(0) { this->fontDef = fontDef; @@ -149,11 +149,15 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, con CFRetain(ctfont); } - const void *keys[] = { NSFontAttributeName }; - const void *values[] = { ctfont }; - attributeDict = CFDictionaryCreate(0, keys, values, 1, + attributeDict = CFDictionaryCreateMutable(0, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFDictionaryAddValue(attributeDict, NSFontAttributeName, ctfont); + if (!kerning) { + float zero = 0.0; + QCFType<CFNumberRef> noKern = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero); + CFDictionaryAddValue(attributeDict, kCTKernAttributeName, &noKern); + } QCoreTextFontEngine *fe = new QCoreTextFontEngine(ctfont, fontDef, this); fe->ref.ref(); @@ -277,10 +281,11 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay outAdvances_x[idx] = QFixed::fromReal(tmpPoints[i + 1].x - tmpPoints[i].x); outAdvances_y[idx] = QFixed::fromReal(tmpPoints[i + 1].y - tmpPoints[i].y); } - double runWidth = ceil(CTRunGetTypographicBounds(run, range, 0, 0, 0)); - runWidth += tmpPoints[0].x; + CGSize lastGlyphAdvance; + CTFontGetAdvancesForGlyphs(runFont, kCTFontHorizontalOrientation, tmpGlyphs + glyphCount - 1, &lastGlyphAdvance, 1); + outGlyphs[rtl ? 0 : (glyphCount - 1)] = tmpGlyphs[glyphCount - 1] | fontIndex; - outAdvances_x[rtl ? 0 : (glyphCount - 1)] = QFixed::fromReal(runWidth - tmpPoints[glyphCount - 1].x); + outAdvances_x[rtl ? 0 : (glyphCount - 1)] = QFixed::fromReal(lastGlyphAdvance.width).ceil(); } outGlyphs += glyphCount; outAttributes += glyphCount; @@ -365,26 +370,26 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph) ret.y = -QFixed::fromReal(rect.origin.y) - ret.height; CGSize advances[1]; CTFontGetAdvancesForGlyphs(ctfont, kCTFontHorizontalOrientation, &g, advances, 1); - ret.xoff = QFixed::fromReal(advances[0].width); - ret.yoff = QFixed::fromReal(advances[0].height); + ret.xoff = QFixed::fromReal(advances[0].width).ceil(); + ret.yoff = QFixed::fromReal(advances[0].height).ceil(); return ret; } QFixed QCoreTextFontEngine::ascent() const { - return QFixed::fromReal(CTFontGetAscent(ctfont)); + return QFixed::fromReal(CTFontGetAscent(ctfont)).ceil(); } QFixed QCoreTextFontEngine::descent() const { - return QFixed::fromReal(CTFontGetDescent(ctfont)); + return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil(); } QFixed QCoreTextFontEngine::leading() const { - return QFixed::fromReal(CTFontGetLeading(ctfont)); + return QFixed::fromReal(CTFontGetLeading(ctfont)).ceil(); } QFixed QCoreTextFontEngine::xHeight() const { - return QFixed::fromReal(CTFontGetXHeight(ctfont)); + return QFixed::fromReal(CTFontGetXHeight(ctfont)).ceil(); } QFixed QCoreTextFontEngine::averageCharWidth() const { diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index e289aa9..176c728 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -480,7 +480,7 @@ private: uint fontIndexForFont(CTFontRef id) const; CTFontRef ctfont; - mutable QCFType<CFDictionaryRef> attributeDict; + mutable QCFType<CFMutableDictionaryRef> attributeDict; friend class QFontDialogPrivate; }; diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index e9f1c99..1996d44 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -1438,6 +1438,7 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin extern bool qt_cleartype_enabled; +extern uint qt_pow_gamma[256]; QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) { @@ -1461,8 +1462,6 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) colors[i] = qRgba(0, 0, 0, i); indexed.setColorTable(colors); - extern uint qt_pow_gamma[256]; - // Copy data... Cannot use QPainter here as GDI has messed up the // Alpha channel of the ni.image pixels... for (int y=0; y<mask->height(); ++y) { diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index c337783..9c3d6c2 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -287,6 +287,7 @@ public: private: Q_DISABLE_COPY(QTextDocument) Q_DECLARE_PRIVATE(QTextDocument) + friend class QTextObjectPrivate; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QTextDocument::FindFlags) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 320ecbf..05ddf47 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -1484,7 +1484,6 @@ QTextObject *QTextDocumentPrivate::createObject(const QTextFormat &f, int object QTextObject *obj = document()->createObject(f); if (obj) { - obj->d_func()->pieceTable = this; obj->d_func()->objectIndex = objectIndex == -1 ? formats.createObjectIndex(f) : objectIndex; objects[obj->d_func()->objectIndex] = obj; } diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 86a1f68..b1f1b75 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1525,6 +1525,8 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) node->charFormat.setFontFamily(value); } else if (key == QLatin1String("color")) { QColor c; c.setNamedColor(value); + if (!c.isValid()) + qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData()); node->charFormat.setForeground(c); } break; @@ -1570,6 +1572,8 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) case Html_body: if (key == QLatin1String("bgcolor")) { QColor c; c.setNamedColor(value); + if (!c.isValid()) + qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData()); node->charFormat.setBackground(c); } else if (key == QLatin1String("background")) { node->applyBackgroundImage(value, resourceProvider); @@ -1581,6 +1585,8 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) setWidthAttribute(&node->width, value); } else if (key == QLatin1String("bgcolor")) { QColor c; c.setNamedColor(value); + if (!c.isValid()) + qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData()); node->charFormat.setBackground(c); } else if (key == QLatin1String("background")) { node->applyBackgroundImage(value, resourceProvider); @@ -1597,6 +1603,8 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) setFloatAttribute(&node->tableBorder, value); } else if (key == QLatin1String("bgcolor")) { QColor c; c.setNamedColor(value); + if (!c.isValid()) + qWarning("QTextHtmlParser::applyAttributes: Unknown color name '%s'",value.toLatin1().constData()); node->charFormat.setBackground(c); } else if (key == QLatin1String("background")) { node->applyBackgroundImage(value, resourceProvider); diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index e305027..d1a3361 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -50,6 +50,11 @@ QT_BEGIN_NAMESPACE class QTextListPrivate : public QTextBlockGroupPrivate { +public: + QTextListPrivate(QTextDocument *doc) + : QTextBlockGroupPrivate(doc) + { + } }; /*! @@ -111,7 +116,7 @@ class QTextListPrivate : public QTextBlockGroupPrivate /*! \internal */ QTextList::QTextList(QTextDocument *doc) - : QTextBlockGroup(*new QTextListPrivate, doc) + : QTextBlockGroup(*new QTextListPrivate(doc), doc) { } diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 1645a21..3f4c8e5 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -88,7 +88,7 @@ QT_BEGIN_NAMESPACE from QTextDocument::createObject(). */ QTextObject::QTextObject(QTextDocument *doc) - : QObject(*new QTextObjectPrivate, doc) + : QObject(*new QTextObjectPrivate(doc), doc) { } @@ -98,7 +98,7 @@ QTextObject::QTextObject(QTextDocument *doc) \internal */ QTextObject::QTextObject(QTextObjectPrivate &p, QTextDocument *doc) - :QObject(p, doc) + : QObject(p, doc) { } @@ -221,7 +221,7 @@ void QTextBlockGroupPrivate::markBlocksDirty() QTextDocument::createObject(). */ QTextBlockGroup::QTextBlockGroup(QTextDocument *doc) - : QTextObject(*new QTextBlockGroupPrivate, doc) + : QTextObject(*new QTextBlockGroupPrivate(doc), doc) { } @@ -410,7 +410,7 @@ QTextFrameLayoutData::~QTextFrameLayoutData() Creates a new empty frame for the text \a document. */ QTextFrame::QTextFrame(QTextDocument *doc) - : QTextObject(*new QTextFramePrivate, doc) + : QTextObject(*new QTextFramePrivate(doc), doc) { Q_D(QTextFrame); d->fragment_start = 0; diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h index b00a16a..dd05eb4 100644 --- a/src/gui/text/qtextobject_p.h +++ b/src/gui/text/qtextobject_p.h @@ -55,6 +55,7 @@ #include "QtGui/qtextobject.h" #include "private/qobject_p.h" +#include "QtGui/qtextdocument.h" QT_BEGIN_NAMESPACE @@ -64,6 +65,10 @@ class QTextObjectPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QTextObject) public: + QTextObjectPrivate(QTextDocument *doc) + : pieceTable(doc->d_func()), objectIndex(-1) + { + } QTextDocumentPrivate *pieceTable; int objectIndex; }; @@ -72,7 +77,10 @@ class QTextBlockGroupPrivate : public QTextObjectPrivate { Q_DECLARE_PUBLIC(QTextBlockGroup) public: - + QTextBlockGroupPrivate(QTextDocument *doc) + : QTextObjectPrivate(doc) + { + } typedef QList<QTextBlock> BlockList; BlockList blocks; void markBlocksDirty(); @@ -85,7 +93,10 @@ class QTextFramePrivate : public QTextObjectPrivate friend class QTextDocumentPrivate; Q_DECLARE_PUBLIC(QTextFrame) public: - + QTextFramePrivate(QTextDocument *doc) + : QTextObjectPrivate(doc) + { + } virtual void fragmentAdded(const QChar &type, uint fragment); virtual void fragmentRemoved(const QChar &type, uint fragment); void remove_me(); diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 375bb09..ba1c04f 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -553,7 +553,7 @@ void QTextTablePrivate::update() const /*! \internal */ QTextTable::QTextTable(QTextDocument *doc) - : QTextFrame(*new QTextTablePrivate, doc) + : QTextFrame(*new QTextTablePrivate(doc), doc) { } diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h index 1ba3a3f..f2b45b6 100644 --- a/src/gui/text/qtexttable_p.h +++ b/src/gui/text/qtexttable_p.h @@ -62,7 +62,7 @@ class QTextTablePrivate : public QTextFramePrivate { Q_DECLARE_PUBLIC(QTextTable) public: - QTextTablePrivate() : grid(0), nRows(0), dirty(true), blockFragmentUpdates(false) {} + QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), grid(0), nRows(0), dirty(true), blockFragmentUpdates(false) {} ~QTextTablePrivate(); static QTextTable *createTable(QTextDocumentPrivate *, int pos, int rows, int cols, const QTextTableFormat &tableFormat); diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 8b07163..7571dfe 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -824,9 +824,9 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted) Q_Q(QCompleter); QString completion; - if (!index.isValid()) + if (!index.isValid() || (index.row() >= proxy->engine->matchCount())) { completion = prefix; - else { + } else { QModelIndex si = proxy->mapToSource(index); si = si.sibling(si.row(), column); // for clicked() completion = q->pathFromIndex(si); @@ -1079,7 +1079,14 @@ void QCompleter::setPopup(QAbstractItemView *popup) popup->setModel(d->proxy); popup->hide(); popup->setParent(0, Qt::Popup); + + Qt::FocusPolicy origPolicy; + if (d->widget) + origPolicy = d->widget->focusPolicy(); popup->setFocusPolicy(Qt::NoFocus); + if (d->widget) + d->widget->setFocusPolicy(origPolicy); + popup->setFocusProxy(d->widget); popup->installEventFilter(this); popup->setItemDelegate(new QCompleterItemDelegate(popup)); diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 1056fa0..84aa16e 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -157,6 +157,11 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler) If the URL is a reference to a local file (i.e., the URL scheme is "file") then it will be opened with a suitable application instead of a Web browser. + The following example opens a file on the Windows file system residing on a path + that contains spaces: + + \snippet doc/src/snippets/code/src_gui_util_qdesktopservices.cpp 2 + If a \c mailto URL is specified, the user's e-mail client will be used to open a composer window containing the options specified in the URL, similar to the way \c mailto links are handled by a Web browser. @@ -280,6 +285,17 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) \note The storage location returned can be a directory that does not exist; i.e., it may need to be created by the system or the user. + + \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName. + Use code like this to add it: + + \code + QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation); + #ifdef Q_WS_MAC + location.insert(location.count() - QCoreApplication::applicationName().count(), + QCoreApplication::organizationName() + "/"); + #endif + \endcode */ /*! diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index 330a7f8..61ed0ea 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -1248,15 +1248,6 @@ void QAbstractButton::timerEvent(QTimerEvent *e) } } -#if defined(Q_OS_WINCE) && !defined(QT_NO_CONTEXTMENU) -/*! \reimp */ -void QAbstractButton::contextMenuEvent(QContextMenuEvent *e) -{ - e->ignore(); - setDown(false); -} -#endif - /*! \reimp */ void QAbstractButton::focusInEvent(QFocusEvent *e) { diff --git a/src/gui/widgets/qabstractbutton.h b/src/gui/widgets/qabstractbutton.h index 6503a56..f0cbb05 100644 --- a/src/gui/widgets/qabstractbutton.h +++ b/src/gui/widgets/qabstractbutton.h @@ -143,9 +143,6 @@ protected: void focusOutEvent(QFocusEvent *e); void changeEvent(QEvent *e); void timerEvent(QTimerEvent *e); -#ifdef Q_OS_WINCE - void contextMenuEvent(QContextMenuEvent *e); -#endif #ifdef QT3_SUPPORT public: diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm index c5977e4..6434289 100644 --- a/src/gui/widgets/qcocoamenu_mac.mm +++ b/src/gui/widgets/qcocoamenu_mac.mm @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) - ** - ** This file is part of the QtGui module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 @@ -36,11 +36,11 @@ ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ #include "qmacdefines_mac.h" #include "qapplication.h" @@ -55,6 +55,16 @@ QT_FORWARD_DECLARE_CLASS(QAction) QT_FORWARD_DECLARE_CLASS(QWidget) QT_FORWARD_DECLARE_CLASS(QApplication) +QT_FORWARD_DECLARE_CLASS(QCoreApplication) +QT_FORWARD_DECLARE_CLASS(QApplicationPrivate) +QT_FORWARD_DECLARE_CLASS(QKeyEvent) +QT_FORWARD_DECLARE_CLASS(QEvent) + +QT_BEGIN_NAMESPACE +extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); //qapplication.cpp +QT_END_NAMESPACE + +QT_USE_NAMESPACE @implementation QT_MANGLE_NAMESPACE(QCocoaMenu) @@ -130,8 +140,9 @@ QT_FORWARD_DECLARE_CLASS(QApplication) // If it does, then we will first send the key sequence to the QWidget that has focus // since (in Qt's eyes) it needs to a chance at the key event first. If the widget // accepts the key event, we then return YES, but set the target and action to be nil, - // which means that the action should not be triggered. In every other case we return - // NO, which means that Cocoa can do as it pleases (i.e., fire the menu action). + // which means that the action should not be triggered, and instead dispatch the event ourselves. + // In every other case we return NO, which means that Cocoa can do as it pleases + // (i.e., fire the menu action). NSMenuItem *whichItem; if ([self hasShortcut:menu forKey:[event characters] @@ -154,9 +165,11 @@ QT_FORWARD_DECLARE_CLASS(QApplication) accel_ev.ignore(); qt_sendSpontaneousEvent(widget, &accel_ev); if (accel_ev.isAccepted()) { - *target = nil; - *action = nil; - return YES; + if (qt_dispatchKeyEvent(event, widget)) { + *target = nil; + *action = nil; + return YES; + } } } } diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 75b8b59..09a51fe 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -61,6 +61,7 @@ #endif #include <private/qcombobox_p.h> #include <private/qabstractitemmodel_p.h> +#include <private/qabstractscrollarea_p.h> #include <qdebug.h> #ifdef Q_WS_X11 @@ -108,7 +109,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt const QModelIndex &index) const { QStyleOptionMenuItem menuOption; - menuOption.palette = QComboBoxPrivate::viewContainerPalette(mCombo).resolve(QApplication::palette("QMenu")); + menuOption.palette = option.palette.resolve(QApplication::palette("QMenu")); menuOption.state = QStyle::State_None; if (mCombo->window()->isActiveWindow()) menuOption.state = QStyle::State_Active; @@ -619,7 +620,6 @@ void QComboBoxPrivateContainer::changeEvent(QEvent *e) bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e) { switch (e->type()) { - case QEvent::KeyPress: case QEvent::ShortcutOverride: switch (static_cast<QKeyEvent*>(e)->key()) { case Qt::Key_Enter: @@ -2274,7 +2274,6 @@ void QComboBox::showPopup() bool boundToScreen = !window()->testAttribute(Qt::WA_DontShowOnScreen); const bool usePopup = style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this); - { int listHeight = 0; int count = 0; @@ -2306,10 +2305,23 @@ void QComboBox::showPopup() listRect.setHeight(listHeight); } - // ### Adjusting by PM_DefaultFrameWidth is not enough. Since QFrame supports - // SE_FrameContents, QFrame needs API to return the frameWidths - listRect.setHeight(listRect.height() + 2*container->spacing() - + style->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, this) * 2); + { + // add the spacing for the grid on the top and the bottom; + int heightMargin = 2*container->spacing(); + + // add the frame of the container + int marginTop, marginBottom; + container->getContentsMargins(0, &marginTop, 0, &marginBottom); + heightMargin += marginTop + marginBottom; + + //add the frame of the view + view()->getContentsMargins(0, &marginTop, 0, &marginBottom); + marginTop += static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->top; + marginBottom += static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->bottom; + heightMargin += marginTop + marginBottom; + + listRect.setHeight(listRect.height() + heightMargin); + } // Add space for margin at top and bottom if the style wants it. if (usePopup) @@ -2322,6 +2334,8 @@ void QComboBox::showPopup() listRect.setWidth(listRect.width() + diff); } + //we need to activate the layout to make sure the min/maximum size are set when the widget was not yet show + container->layout()->activate(); //takes account of the minimum/maximum size of the container listRect.setSize( listRect.size().expandedTo(container->minimumSize()) .boundedTo(container->maximumSize())); diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h index f1203dc..c39a231 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/gui/widgets/qcombobox_p.h @@ -265,7 +265,7 @@ protected: const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyleOptionMenuItem opt = getStyleOption(option, index); - painter->eraseRect(option.rect); + painter->fillRect(option.rect, opt.palette.background()); mCombo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, mCombo); } QSize sizeHint(const QStyleOptionViewItem &option, diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 246da95..4a95292 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -752,7 +752,8 @@ QDialogButtonBox::~QDialogButtonBox() \value KdeLayout Use a policy appropriate for applications on KDE. \value GnomeLayout Use a policy appropriate for applications on GNOME. - The button layout is specified by the \l{style()}{current style}. + The button layout is specified by the \l{style()}{current style}. However, + on the X11 platform, it may be influenced by the desktop environment. */ /*! diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 9261c63..4f0ec1e 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -579,7 +579,7 @@ void QDockAreaLayoutInfo::fitItems() QLayoutStruct &ls = layout_struct_list[j++]; ls.init(); ls.empty = false; - if (gap || (item.flags & QDockAreaLayoutItem::KeepSize)) { + if (item.flags & QDockAreaLayoutItem::KeepSize) { ls.minimumSize = ls.maximumSize = ls.sizeHint = item.size; ls.expansive = false; ls.stretch = 0; diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index 5ff7bf5..a5be5f8 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -292,8 +292,11 @@ QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) co if (content.height() < 0) result.setHeight(-1); - QSize min = w->minimumSize(); - QSize max = w->maximumSize(); + int left, top, right, bottom; + w->getContentsMargins(&left, &top, &right, &bottom); + //we need to substract the contents margin (it will be added by the caller) + QSize min = w->minimumSize() - QSize(left + right, top + bottom); + QSize max = w->maximumSize() - QSize(left + right, top + bottom); /* A floating dockwidget will automatically get its minimumSize set to the layout's minimum size + deco. We're *not* interested in this, we only take minimumSize() @@ -403,10 +406,14 @@ int QDockWidgetLayout::minimumTitleWidth() const QSize closeSize(0, 0); QSize floatSize(0, 0); - if (QLayoutItem *item = item_list[CloseButton]) - closeSize = item->sizeHint(); - if (QLayoutItem *item = item_list[FloatButton]) - floatSize = item->sizeHint(); + if (hasFeature(q, QDockWidget::DockWidgetClosable)) { + if (QLayoutItem *item = item_list[CloseButton]) + closeSize = item->widget()->sizeHint(); + } + if (hasFeature(q, QDockWidget::DockWidgetFloatable)) { + if (QLayoutItem *item = item_list[FloatButton]) + floatSize = item->widget()->sizeHint(); + } int titleHeight = this->titleHeight(); diff --git a/src/gui/widgets/qmaccocoaviewcontainer_mac.mm b/src/gui/widgets/qmaccocoaviewcontainer_mac.mm index 710af6a..380e983 100644 --- a/src/gui/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/gui/widgets/qmaccocoaviewcontainer_mac.mm @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) - ** - ** This file is part of the QtGui module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 @@ -36,11 +36,11 @@ ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ #import <Cocoa/Cocoa.h> #include <private/qwidget_p.h> diff --git a/src/gui/widgets/qmacnativewidget_mac.mm b/src/gui/widgets/qmacnativewidget_mac.mm index 1bc0430..0f4edf9 100644 --- a/src/gui/widgets/qmacnativewidget_mac.mm +++ b/src/gui/widgets/qmacnativewidget_mac.mm @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) - ** - ** This file is part of the QtGui module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 @@ -36,11 +36,11 @@ ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ #import <Cocoa/Cocoa.h> #import <private/qcocoaview_mac_p.h> diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 46d6471..2abc9e8 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -481,7 +481,7 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar) oldMenuBar->deleteLater(); } #ifdef Q_OS_WINCE - if (menuBar->size().height() > 0) + if (menuBar && menuBar->size().height() > 0) #endif d->layout->setMenuBar(menuBar); } diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 768446e..eade633 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1542,8 +1542,8 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) if (!previousPath.isEmpty()) layoutState.remove(previousPath); + pluggingWidget = widget; if (dockOptions & QMainWindow::AnimatedDocks) { - pluggingWidget = widget; QRect globalRect = currentGapRect; globalRect.moveTopLeft(parentWidget()->mapToGlobal(globalRect.topLeft())); #ifndef QT_NO_DOCKWIDGET @@ -1575,6 +1575,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) #endif currentGapPos.clear(); updateGapIndicator(); + pluggingWidget = 0; } return true; diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index 950f758..c807afb 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -1,3 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + #include <private/qmainwindowlayout_p.h> #include <qtoolbar.h> #include <private/qtoolbarlayout_p.h> diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index e96856a..7396a9d 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -578,7 +578,8 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason //when the action has no QWidget, the QMenu itself should // get the focus // Since the menu is a pop-up, it uses the popup reason. - q->setFocus(Qt::PopupFocusReason); + if (!q->hasFocus()) + q->setFocus(Qt::PopupFocusReason); } } } else { //action is a separator @@ -2888,8 +2889,8 @@ void QMenu::internalDelayedPopup() int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this); const QRect actionRect(d->actionRect(d->currentAction)); const QSize menuSize(d->activeMenu->sizeHint()); - const QPoint rightPos(mapToGlobal(QPoint(rect().right() + subMenuOffset + 1, actionRect.top()))); - const QPoint leftPos(mapToGlobal(QPoint(rect().left() - subMenuOffset - menuSize.width(), actionRect.top()))); + const QPoint rightPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top()))); + const QPoint leftPos(mapToGlobal(QPoint(actionRect.left() - subMenuOffset - menuSize.width(), actionRect.top()))); QPoint pos(rightPos); QMenu *caused = qobject_cast<QMenu*>(d->activeMenu->d_func()->causedPopup.widget); diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index fc9e1a3..9bfe7a5 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -444,26 +444,19 @@ void QScrollBar::contextMenuEvent(QContextMenuEvent *event) #ifndef QT_NO_MENU bool horiz = HORIZONTAL; - QMenu menu; - QAction *actScrollHere = - menu.addAction(tr("Scroll here")); - menu.addSeparator(); - QAction *actScrollTop = - menu.addAction(horiz ? tr("Left edge") : tr("Top")); - QAction *actScrollBottom = - menu.addAction(horiz ? tr("Right edge") : tr("Bottom")); - menu.addSeparator(); - QAction *actPageUp = - menu.addAction(horiz ? tr("Page left") : tr("Page up")); - QAction *actPageDn = - menu.addAction(horiz ? tr("Page right") : tr("Page down")); - menu.addSeparator(); - QAction *actScrollUp = - menu.addAction(horiz ? tr("Scroll left") : tr("Scroll up")); - QAction *actScrollDn = - menu.addAction(horiz ? tr("Scroll right") : tr("Scroll down")); - - QAction *actionSelected = menu.exec(event->globalPos()); + QPointer<QMenu> menu = new QMenu(this); + QAction *actScrollHere = menu->addAction(tr("Scroll here")); + menu->addSeparator(); + QAction *actScrollTop = menu->addAction(horiz ? tr("Left edge") : tr("Top")); + QAction *actScrollBottom = menu->addAction(horiz ? tr("Right edge") : tr("Bottom")); + menu->addSeparator(); + QAction *actPageUp = menu->addAction(horiz ? tr("Page left") : tr("Page up")); + QAction *actPageDn = menu->addAction(horiz ? tr("Page right") : tr("Page down")); + menu->addSeparator(); + QAction *actScrollUp = menu->addAction(horiz ? tr("Scroll left") : tr("Scroll up")); + QAction *actScrollDn = menu->addAction(horiz ? tr("Scroll right") : tr("Scroll down")); + QAction *actionSelected = menu->exec(event->globalPos()); + delete menu; if (actionSelected == 0) /* do nothing */ ; else if (actionSelected == actScrollHere) diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 7d970ad..b6e6b6d 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -131,7 +131,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const option->state &= ~QStyle::State_Enabled; if (isActiveWindow()) option->state |= QStyle::State_Active; - if (option->rect == d->hoverRect) + if (!d->dragInProgress && option->rect == d->hoverRect) option->state |= QStyle::State_MouseOver; option->shape = d->shape; option->text = tab.text; @@ -454,9 +454,6 @@ void QTabBarPrivate::layoutTabs() maxExtent = maxWidth; } - if (pressedIndex != -1 && movable) - grabCache(0, tabList.count(), true); - Q_ASSERT(tabChainIndex == tabChain.count() - 1); // add an assert just to make sure. // Mirror our front item. tabChain[tabChainIndex].init(); @@ -1484,6 +1481,8 @@ void QTabBar::paintEvent(QPaintEvent *) bool vertical = verticalTabs(d->shape); QStyleOptionTab cutTab; selected = d->currentIndex; + if (d->dragInProgress) + selected = d->pressedIndex; for (int i = 0; i < d->tabList.count(); ++i) optTabBase.tabBarRect |= tabRect(i); @@ -1522,11 +1521,7 @@ void QTabBar::paintEvent(QPaintEvent *) if (i == selected) continue; - if (!d->tabList[i].animatingCache.isNull() && d->paintWithOffsets) { - p.drawPixmap(tab.rect, d->tabList[i].animatingCache); - } else { - p.drawControl(QStyle::CE_TabBarTab, tab); - } + p.drawControl(QStyle::CE_TabBarTab, tab); } // Draw the selected tab last to get it "on top" @@ -1539,7 +1534,11 @@ void QTabBar::paintEvent(QPaintEvent *) else tab.rect.moveLeft(tab.rect.x() + d->tabList[selected].dragOffset); } - p.drawControl(QStyle::CE_TabBarTab, tab); + if (!d->dragInProgress) + p.drawControl(QStyle::CE_TabBarTab, tab); + else + d->movingTab->setGeometry(tab.rect); + } // Only draw the tear indicator if necessary. Most of the time we don't need too. @@ -1680,6 +1679,7 @@ void QTabBarPrivate::_q_moveTab(int offset) if (!validIndex(index)) return; tabList[index].dragOffset = offset; + layoutTab(index); // Make buttons follow tab q->update(); } } @@ -1727,8 +1727,7 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event) if (!d->dragInProgress && d->pressedIndex != -1) { if ((event->pos() - d->dragStartPosition).manhattanLength() > QApplication::startDragDistance()) { d->dragInProgress = true; - if (d->animations.isEmpty()) - d->grabCache(0, d->tabList.count(), false); + d->setupMovableTab(); } } @@ -1773,7 +1772,6 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event) if (dragDistance > needsToBeOver) d->slide(i + offset, d->pressedIndex); } - } // Buttons needs to follow the dragged tab d->layoutTab(d->pressedIndex); @@ -1801,32 +1799,41 @@ void QTabBarPrivate::_q_moveTabFinished() } } -void QTabBarPrivate::grabCache(int start, int end, bool unhide) +void QTabBarPrivate::setupMovableTab() { Q_Q(QTabBar); - paintWithOffsets = false; - bool showButtonsAgain = rightB->isVisible(); - rightB->hide(); - leftB->hide(); - - QWidget *topLevel = q->window(); - QPoint topLevelOffset(q->mapTo(topLevel, QPoint())); - for (int i = start; i < end; ++i) { - QRect tabRect = q->tabRect(i); - tabRect.translate(topLevelOffset); - if (unhide) { - tabList[i].unHideWidgets(); - layoutWidgets(i); - } - tabList[i].animatingCache = QPixmap::grabWidget(topLevel, tabRect); - if (i != pressedIndex) - tabList[i].hideWidgets(); - } - if (showButtonsAgain) { - rightB->show(); - leftB->show(); - } - paintWithOffsets = true; + if (!movingTab) + movingTab = new QWidget(q); + + QRect grabRect = q->tabRect(pressedIndex); + + QPixmap grabImage(grabRect.size()); + grabImage.fill(Qt::transparent); + QStylePainter p(&grabImage, q); + + QStyleOptionTabV3 tab; + q->initStyleOption(&tab, pressedIndex); + tab.rect.moveTopLeft(QPoint(0, 0)); + p.drawControl(QStyle::CE_TabBarTab, tab); + p.end(); + + QPalette pal; + pal.setBrush(QPalette::All, QPalette::Window, grabImage); + movingTab->setPalette(pal); + movingTab->setGeometry(grabRect); + movingTab->setAutoFillBackground(true); + movingTab->raise(); + + // Re-arrange widget order to avoid overlaps + if (tabList[pressedIndex].leftWidget) + tabList[pressedIndex].leftWidget->raise(); + if (tabList[pressedIndex].rightWidget) + tabList[pressedIndex].rightWidget->raise(); + if (leftB) + leftB->raise(); + if (rightB) + rightB->raise(); + movingTab->setVisible(true); } void QTabBarPrivate::_q_moveTabFinished(int index) @@ -1834,10 +1841,9 @@ void QTabBarPrivate::_q_moveTabFinished(int index) Q_Q(QTabBar); bool cleanup = (pressedIndex == index) || (pressedIndex == -1) || !validIndex(index); if (animations.isEmpty() && cleanup) { + movingTab->setVisible(false); // We might not get a mouse release for (int i = 0; i < tabList.count(); ++i) { tabList[i].dragOffset = 0; - tabList[i].unHideWidgets(); - tabList[i].animatingCache = QPixmap(); } if (pressedIndex != -1 && movable) { pressedIndex = -1; @@ -1881,6 +1887,7 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event) d->_q_moveTabFinished(d->pressedIndex); } d->dragInProgress = false; + d->movingTab->setVisible(false); d->dragStartPosition = QPoint(); } @@ -2203,19 +2210,16 @@ void QTabBar::setTabButton(int index, ButtonPosition position, QWidget *widget) widget->setParent(this); // make sure our left and right widgets stay on top widget->lower(); + widget->show(); } if (position == LeftSide) { if (d->tabList[index].leftWidget) d->tabList[index].leftWidget->hide(); d->tabList[index].leftWidget = widget; - if(!d->tabList[index].hidLeft && widget) - widget->show(); } else { if (d->tabList[index].rightWidget) d->tabList[index].rightWidget->hide(); d->tabList[index].rightWidget = widget; - if(!d->tabList[index].hidRight && widget) - widget->show(); } d->layoutTabs(); update(); diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h index a117aa3..cb1a15b 100644 --- a/src/gui/widgets/qtabbar_p.h +++ b/src/gui/widgets/qtabbar_p.h @@ -70,7 +70,6 @@ QT_BEGIN_NAMESPACE - class QTabBarPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QTabBar) @@ -78,7 +77,7 @@ public: QTabBarPrivate() :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), - layoutDirty(false), drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false) {} + layoutDirty(false), drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), movingTab(0) {} int currentIndex; int pressedIndex; @@ -98,8 +97,6 @@ public: , lastTab(-1) , timeLine(0) , dragOffset(0) - , hidLeft(false) - , hidRight(false) {} bool enabled; int shortcutId; @@ -123,9 +120,6 @@ public: QTimeLine *timeLine; int dragOffset; - QPixmap animatingCache; - bool hidLeft; - bool hidRight; void makeTimeLine(QWidget *q) { if (timeLine) @@ -135,27 +129,6 @@ public: q->connect(timeLine, SIGNAL(finished()), q, SLOT(_q_moveTabFinished())); } - void hideWidgets() { - if (!hidRight && rightWidget) { - hidRight = rightWidget->isVisible(); - rightWidget->hide(); - } - - if (!hidLeft && leftWidget) { - hidLeft = leftWidget->isVisible(); - leftWidget->hide(); - } - } - - void unHideWidgets() { - if (leftWidget && hidLeft) - leftWidget->show(); - hidLeft = false; - if (rightWidget && hidRight) - rightWidget->show(); - hidRight = false; - } - }; QList<Tab> tabList; QHash<QTimeLine*, int> animations; @@ -184,12 +157,12 @@ public: void _q_moveTabFinished(int offset); QRect hoverRect; - void grabCache(int start, int end, bool unhide); void refresh(); void layoutTabs(); void layoutWidgets(int index = -1); void layoutTab(int index); void updateMacBorderMetrics(); + void setupMovableTab(); void makeVisible(int index); QSize iconSize; @@ -206,6 +179,8 @@ public: bool dragInProgress; bool documentMode; + QWidget *movingTab; + // shared by tabwidget and qtabbar static void initStyleBaseOption(QStyleOptionTabBarBaseV2 *optTabBase, QTabBar *tabbar, QSize size) { diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index b239e32..1c4df93 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1478,7 +1478,13 @@ void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e) layout->setViewport(QRect()); } -/*! \reimp +/*! \fn void QTextEdit::paintEvent(QPaintEvent *event) + +This event handler can be reimplemented in a subclass to receive paint events passed in \a event. +It is usually unnecessary to reimplement this function in a subclass of QTextEdit. + +\warning The underlying text document must not be modified from within a reimplementation +of this function. */ void QTextEdit::paintEvent(QPaintEvent *e) { diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index 85d6ea2..1babb6d 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -1153,6 +1153,17 @@ bool QToolBar::event(QEvent *event) if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event))) return true; break; +#ifdef Q_OS_WINCE + case QEvent::ContextMenu: + { + QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event); + QWidget* child = childAt(contextMenuEvent->pos()); + QAbstractButton* button = qobject_cast<QAbstractButton*>(child); + if (button) + button->setDown(false); + } + break; +#endif case QEvent::Leave: if (d->state != 0 && d->state->dragging) { #ifdef Q_OS_WIN diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 6bcca0c..3269b2e 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -2,6 +2,9 @@ HEADERS += access/qftp.h \ access/qhttp.h \ + access/qhttpnetworkheader_p.h \ + access/qhttpnetworkrequest_p.h \ + access/qhttpnetworkreply_p.h \ access/qhttpnetworkconnection_p.h \ access/qnetworkaccessmanager.h \ access/qnetworkaccessmanager_p.h \ @@ -27,6 +30,9 @@ HEADERS += access/qftp.h \ SOURCES += access/qftp.cpp \ access/qhttp.cpp \ + access/qhttpnetworkheader.cpp \ + access/qhttpnetworkrequest.cpp \ + access/qhttpnetworkreply.cpp \ access/qhttpnetworkconnection.cpp \ access/qnetworkaccessmanager.cpp \ access/qnetworkaccesscache.cpp \ diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp index 0141ae2..96ccc91 100644 --- a/src/network/access/qhttp.cpp +++ b/src/network/access/qhttp.cpp @@ -2120,6 +2120,10 @@ int QHttp::setUser(const QString &userName, const QString &password) Web proxy cache server (from \l http://www.squid.org/). For transparent proxying, such as SOCKS5, use QNetworkProxy instead. + \note setProxy() has to be called before setHost() for it to take effect. + If setProxy() is called after setHost(), then it will not apply until after + setHost() is called again. + \sa QFtp::setProxy() */ int QHttp::setProxy(const QString &host, int port, @@ -2139,7 +2143,7 @@ int QHttp::setProxy(const QString &host, int port, is QNetworkProxy::HttpCachingProxy, QHttp will behave like the previous function. - Note: for compatibility with Qt 4.3, if the proxy type is + \note for compatibility with Qt 4.3, if the proxy type is QNetworkProxy::HttpProxy and the request type is unencrypted (that is, ConnectionModeHttp), QHttp will treat the proxy as a caching proxy. diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index edb2988..980c0e0 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -45,7 +45,7 @@ #include <private/qauthenticator_p.h> #include <qnetworkproxy.h> #include <qauthenticator.h> -#include <qbytearraymatcher.h> + #include <qbuffer.h> #include <qpair.h> #include <qhttp.h> @@ -59,875 +59,9 @@ # include <QtNetwork/qsslconfiguration.h> #endif -#ifndef QT_NO_COMPRESS -# include <zlib.h> -static const unsigned char gz_magic[2] = {0x1f, 0x8b}; // gzip magic header -// gzip flag byte -#define HEAD_CRC 0x02 // bit 1 set: header CRC present -#define EXTRA_FIELD 0x04 // bit 2 set: extra field present -#define ORIG_NAME 0x08 // bit 3 set: original file name present -#define COMMENT 0x10 // bit 4 set: file comment present -#define RESERVED 0xE0 // bits 5..7: reserved -#define CHUNK 16384 -#endif - -QT_BEGIN_NAMESPACE - -class QHttpNetworkHeaderPrivate : public QSharedData -{ -public: - QUrl url; - QList<QPair<QByteArray, QByteArray> > fields; - - QHttpNetworkHeaderPrivate(const QUrl &newUrl = QUrl()); - QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPrivate &other); - inline qint64 contentLength() const; - inline void setContentLength(qint64 length); - - inline QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const; - inline QList<QByteArray> headerFieldValues(const QByteArray &name) const; - inline void setHeaderField(const QByteArray &name, const QByteArray &data); - bool operator==(const QHttpNetworkHeaderPrivate &other) const; - -}; - -QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl) - :url(newUrl) -{ -} - -QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPrivate &other) - :QSharedData(other) -{ - url = other.url; - fields = other.fields; -} - -qint64 QHttpNetworkHeaderPrivate::contentLength() const -{ - bool ok = false; - QByteArray value = headerField("content-length"); - qint64 length = value.toULongLong(&ok); - if (ok) - return length; - return -1; // the header field is not set -} - -void QHttpNetworkHeaderPrivate::setContentLength(qint64 length) -{ - setHeaderField("Content-Length", QByteArray::number(length)); -} - -QByteArray QHttpNetworkHeaderPrivate::headerField(const QByteArray &name, const QByteArray &defaultValue) const -{ - QList<QByteArray> allValues = headerFieldValues(name); - if (allValues.isEmpty()) - return defaultValue; - - QByteArray result; - bool first = true; - foreach (QByteArray value, allValues) { - if (!first) - result += ", "; - first = false; - result += value; - } - return result; -} - -QList<QByteArray> QHttpNetworkHeaderPrivate::headerFieldValues(const QByteArray &name) const -{ - QList<QByteArray> result; - QByteArray lowerName = name.toLower(); - QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(), - end = fields.constEnd(); - for ( ; it != end; ++it) - if (lowerName == it->first.toLower()) - result += it->second; - - return result; -} - -void QHttpNetworkHeaderPrivate::setHeaderField(const QByteArray &name, const QByteArray &data) -{ - QByteArray lowerName = name.toLower(); - QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(); - while (it != fields.end()) { - if (lowerName == it->first.toLower()) - it = fields.erase(it); - else - ++it; - } - fields.append(qMakePair(name, data)); -} - -bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &other) const -{ - return (url == other.url); -} - -// QHttpNetworkRequestPrivate -class QHttpNetworkRequestPrivate : public QHttpNetworkHeaderPrivate -{ -public: - QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, - QHttpNetworkRequest::Priority pri, const QUrl &newUrl = QUrl()); - QHttpNetworkRequestPrivate(const QHttpNetworkRequestPrivate &other); - ~QHttpNetworkRequestPrivate(); - bool operator==(const QHttpNetworkRequestPrivate &other) const; - QByteArray methodName() const; - QByteArray uri(bool throughProxy) const; - - static QByteArray header(const QHttpNetworkRequest &request, bool throughProxy); - - QHttpNetworkRequest::Operation operation; - QHttpNetworkRequest::Priority priority; - mutable QIODevice *data; - bool autoDecompress; -}; - -QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, - QHttpNetworkRequest::Priority pri, const QUrl &newUrl) - : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), data(0), - autoDecompress(false) -{ -} - -QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequestPrivate &other) - : QHttpNetworkHeaderPrivate(other) -{ - operation = other.operation; - priority = other.priority; - data = other.data; - autoDecompress = other.autoDecompress; -} - -QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate() -{ -} - -bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &other) const -{ - return QHttpNetworkHeaderPrivate::operator==(other) - && (operation == other.operation) - && (data == other.data); -} - -QByteArray QHttpNetworkRequestPrivate::methodName() const -{ - QByteArray ba; - switch (operation) { - case QHttpNetworkRequest::Options: - ba += "OPTIONS"; - break; - case QHttpNetworkRequest::Get: - ba += "GET"; - break; - case QHttpNetworkRequest::Head: - ba += "HEAD"; - break; - case QHttpNetworkRequest::Post: - ba += "POST"; - break; - case QHttpNetworkRequest::Put: - ba += "PUT"; - break; - case QHttpNetworkRequest::Delete: - ba += "DELETE"; - break; - case QHttpNetworkRequest::Trace: - ba += "TRACE"; - break; - case QHttpNetworkRequest::Connect: - ba += "CONNECT"; - break; - default: - break; - } - return ba; -} - -QByteArray QHttpNetworkRequestPrivate::uri(bool throughProxy) const -{ - QUrl::FormattingOptions format(QUrl::RemoveFragment); - - // for POST, query data is send as content - if (operation == QHttpNetworkRequest::Post && !data) - format |= QUrl::RemoveQuery; - // for requests through proxy, the Request-URI contains full url - if (throughProxy) - format |= QUrl::RemoveUserInfo; - else - format |= QUrl::RemoveScheme | QUrl::RemoveAuthority; - QByteArray uri = url.toEncoded(format); - if (uri.isEmpty() || (throughProxy && url.path().isEmpty())) - uri += '/'; - return uri; -} - -QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request, bool throughProxy) -{ - QByteArray ba = request.d->methodName(); - QByteArray uri = request.d->uri(throughProxy); - ba += " " + uri; - - QString majorVersion = QString::number(request.majorVersion()); - QString minorVersion = QString::number(request.minorVersion()); - ba += " HTTP/" + majorVersion.toLatin1() + "." + minorVersion.toLatin1() + "\r\n"; - - QList<QPair<QByteArray, QByteArray> > fields = request.header(); - QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin(); - for (; it != fields.constEnd(); ++it) - ba += it->first + ": " + it->second + "\r\n"; - if (request.d->operation == QHttpNetworkRequest::Post) { - // add content type, if not set in the request - if (request.headerField("content-type").isEmpty()) - ba += "Content-Type: application/x-www-form-urlencoded\r\n"; - if (!request.d->data && request.d->url.hasQuery()) { - QByteArray query = request.d->url.encodedQuery(); - ba += "Content-Length: "+ QByteArray::number(query.size()) + "\r\n"; - ba += "\r\n"; - ba += query; - } else { - ba += "\r\n"; - } - } else { - ba += "\r\n"; - } - return ba; -} - -class QHttpNetworkReplyPrivate : public QObjectPrivate, public QHttpNetworkHeaderPrivate -{ -public: - QHttpNetworkReplyPrivate(const QUrl &newUrl = QUrl()); - ~QHttpNetworkReplyPrivate(); - qint64 readStatus(QAbstractSocket *socket); - void parseStatus(const QByteArray &status); - qint64 readHeader(QAbstractSocket *socket); - void parseHeader(const QByteArray &header); - qint64 readBody(QAbstractSocket *socket, QIODevice *out); - bool findChallenge(bool forProxy, QByteArray &challenge) const; - QAuthenticatorPrivate::Method authenticationMethod(bool isProxy) const; - void clear(); - - qint64 transferRaw(QIODevice *in, QIODevice *out, qint64 size); - qint64 transferChunked(QIODevice *in, QIODevice *out); - qint64 getChunkSize(QIODevice *in, qint64 *chunkSize); - - qint64 bytesAvailable() const; - bool isChunked(); - bool connectionCloseEnabled(); - bool isGzipped(); -#ifndef QT_NO_COMPRESS - bool gzipCheckHeader(QByteArray &content, int &pos); - int gunzipBodyPartially(QByteArray &compressed, QByteArray &inflated); -#endif - void removeAutoDecompressHeader(); - - enum ReplyState { - NothingDoneState, - ReadingStatusState, - ReadingHeaderState, - ReadingDataState, - AllDoneState - } state; - - QHttpNetworkRequest request; - int statusCode; - int majorVersion; - int minorVersion; - QString errorString; - QString reasonPhrase; - qint64 bodyLength; - qint64 contentRead; - qint64 totalProgress; - QByteArray fragment; - qint64 currentChunkSize; - qint64 currentChunkRead; - QPointer<QHttpNetworkConnection> connection; - bool initInflate; - bool streamEnd; -#ifndef QT_NO_COMPRESS - z_stream inflateStrm; -#endif - bool autoDecompress; - - QByteArray responseData; // uncompressed body - QByteArray compressedData; // compressed body (temporary) - QBuffer requestDataBuffer; - bool requestIsBuffering; - bool requestIsPrepared; -}; - -QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) - : QHttpNetworkHeaderPrivate(newUrl), state(NothingDoneState), statusCode(100), - majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0), - currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false), - autoDecompress(false), requestIsBuffering(false), requestIsPrepared(false) -{ -} - -QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate() -{ -} - -void QHttpNetworkReplyPrivate::clear() -{ - state = NothingDoneState; - statusCode = 100; - bodyLength = 0; - contentRead = 0; - totalProgress = 0; - currentChunkSize = 0; - currentChunkRead = 0; - connection = 0; -#ifndef QT_NO_COMPRESS - if (initInflate) - inflateEnd(&inflateStrm); -#endif - initInflate = false; - streamEnd = false; - autoDecompress = false; - fields.clear(); -} - -// QHttpNetworkReplyPrivate -qint64 QHttpNetworkReplyPrivate::bytesAvailable() const -{ - return (state != ReadingDataState ? 0 : fragment.size()); -} - -bool QHttpNetworkReplyPrivate::isGzipped() -{ - QByteArray encoding = headerField("content-encoding"); - return encoding.toLower() == "gzip"; -} - -void QHttpNetworkReplyPrivate::removeAutoDecompressHeader() -{ - // The header "Content-Encoding = gzip" is retained. - // Content-Length is removed since the actual one send by the server is for compressed data - QByteArray name("content-length"); - QByteArray lowerName = name.toLower(); - QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(), - end = fields.end(); - while (it != end) { - if (name == it->first.toLower()) { - fields.erase(it); - break; - } - ++it; - } - -} - -bool QHttpNetworkReplyPrivate::findChallenge(bool forProxy, QByteArray &challenge) const -{ - challenge.clear(); - // find out the type of authentication protocol requested. - QByteArray header = forProxy ? "proxy-authenticate" : "www-authenticate"; - // pick the best protocol (has to match parsing in QAuthenticatorPrivate) - QList<QByteArray> challenges = headerFieldValues(header); - for (int i = 0; i<challenges.size(); i++) { - QByteArray line = challenges.at(i); - if (!line.toLower().startsWith("negotiate")) - challenge = line; - } - return !challenge.isEmpty(); -} - -QAuthenticatorPrivate::Method QHttpNetworkReplyPrivate::authenticationMethod(bool isProxy) const -{ - // The logic is same as the one used in void QAuthenticatorPrivate::parseHttpResponse() - QAuthenticatorPrivate::Method method = QAuthenticatorPrivate::None; - QByteArray header = isProxy ? "proxy-authenticate" : "www-authenticate"; - QList<QByteArray> challenges = headerFieldValues(header); - for (int i = 0; i<challenges.size(); i++) { - QByteArray line = challenges.at(i).trimmed().toLower(); - if (method < QAuthenticatorPrivate::Basic - && line.startsWith("basic")) { - method = QAuthenticatorPrivate::Basic; - } else if (method < QAuthenticatorPrivate::Ntlm - && line.startsWith("ntlm")) { - method = QAuthenticatorPrivate::Ntlm; - } else if (method < QAuthenticatorPrivate::DigestMd5 - && line.startsWith("digest")) { - method = QAuthenticatorPrivate::DigestMd5; - } - } - return method; -} - -#ifndef QT_NO_COMPRESS -bool QHttpNetworkReplyPrivate::gzipCheckHeader(QByteArray &content, int &pos) -{ - int method = 0; // method byte - int flags = 0; // flags byte - bool ret = false; - - // Assure two bytes in the buffer so we can peek ahead -- handle case - // where first byte of header is at the end of the buffer after the last - // gzip segment - pos = -1; - QByteArray &body = content; - int maxPos = body.size()-1; - if (maxPos < 1) { - return ret; - } - - // Peek ahead to check the gzip magic header - if (body[0] != char(gz_magic[0]) || - body[1] != char(gz_magic[1])) { - return ret; - } - pos += 2; - // Check the rest of the gzip header - if (++pos <= maxPos) - method = body[pos]; - if (pos++ <= maxPos) - flags = body[pos]; - if (method != Z_DEFLATED || (flags & RESERVED) != 0) { - return ret; - } - - // Discard time, xflags and OS code: - pos += 6; - if (pos > maxPos) - return ret; - if ((flags & EXTRA_FIELD) && ((pos+2) <= maxPos)) { // skip the extra field - unsigned len = (unsigned)body[++pos]; - len += ((unsigned)body[++pos])<<8; - pos += len; - if (pos > maxPos) - return ret; - } - if ((flags & ORIG_NAME) != 0) { // skip the original file name - while(++pos <= maxPos && body[pos]) {} - } - if ((flags & COMMENT) != 0) { // skip the .gz file comment - while(++pos <= maxPos && body[pos]) {} - } - if ((flags & HEAD_CRC) != 0) { // skip the header crc - pos += 2; - if (pos > maxPos) - return ret; - } - ret = (pos < maxPos); // return failed, if no more bytes left - return ret; -} - -int QHttpNetworkReplyPrivate::gunzipBodyPartially(QByteArray &compressed, QByteArray &inflated) -{ - int ret = Z_DATA_ERROR; - unsigned have; - unsigned char out[CHUNK]; - int pos = -1; - - if (!initInflate) { - // check the header - if (!gzipCheckHeader(compressed, pos)) - return ret; - // allocate inflate state - inflateStrm.zalloc = Z_NULL; - inflateStrm.zfree = Z_NULL; - inflateStrm.opaque = Z_NULL; - inflateStrm.avail_in = 0; - inflateStrm.next_in = Z_NULL; - ret = inflateInit2(&inflateStrm, -MAX_WBITS); - if (ret != Z_OK) - return ret; - initInflate = true; - streamEnd = false; - } - - //remove the header. - compressed.remove(0, pos+1); - // expand until deflate stream ends - inflateStrm.next_in = (unsigned char *)compressed.data(); - inflateStrm.avail_in = compressed.size(); - do { - inflateStrm.avail_out = sizeof(out); - inflateStrm.next_out = out; - ret = inflate(&inflateStrm, Z_NO_FLUSH); - switch (ret) { - case Z_NEED_DICT: - ret = Z_DATA_ERROR; - // and fall through - case Z_DATA_ERROR: - case Z_MEM_ERROR: - inflateEnd(&inflateStrm); - initInflate = false; - return ret; - } - have = sizeof(out) - inflateStrm.avail_out; - inflated.append(QByteArray((const char *)out, have)); - } while (inflateStrm.avail_out == 0); - // clean up and return - if (ret <= Z_ERRNO || ret == Z_STREAM_END) { - inflateEnd(&inflateStrm); - initInflate = false; - } - streamEnd = (ret == Z_STREAM_END); - return ret; -} -#endif - -qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) -{ - qint64 bytes = 0; - char c; - - while (socket->bytesAvailable()) { - // allow both CRLF & LF (only) line endings - if (socket->peek(&c, 1) == 1 && c == '\n') { - bytes += socket->read(&c, 1); // read the "n" - // remove the CR at the end - if (fragment.endsWith('\r')) { - fragment.truncate(fragment.length()-1); - } - parseStatus(fragment); - state = ReadingHeaderState; - fragment.clear(); // next fragment - break; - } else { - c = 0; - bytes += socket->read(&c, 1); - fragment.append(c); - } - } - return bytes; -} - -void QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) -{ - const QByteArrayMatcher sp(" "); - int i = sp.indexIn(status); - const QByteArray version = status.mid(0, i); - int j = sp.indexIn(status, i + 1); - const QByteArray code = status.mid(i + 1, j - i - 1); - const QByteArray reason = status.mid(j + 1, status.count() - j); - - const QByteArrayMatcher slash("/"); - int k = slash.indexIn(version); - const QByteArrayMatcher dot("."); - int l = dot.indexIn(version, k); - const QByteArray major = version.mid(k + 1, l - k - 1); - const QByteArray minor = version.mid(l + 1, version.count() - l); - - majorVersion = QString::fromAscii(major.constData()).toInt(); - minorVersion = QString::fromAscii(minor.constData()).toInt(); - statusCode = QString::fromAscii(code.constData()).toInt(); - reasonPhrase = QString::fromAscii(reason.constData()); -} - -qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) -{ - qint64 bytes = 0; - char crlfcrlf[5]; - crlfcrlf[4] = '\0'; - char c = 0; - bool allHeaders = false; - while (!allHeaders && socket->bytesAvailable()) { - if (socket->peek(&c, 1) == 1 && c == '\n') { - // check for possible header endings. As per HTTP rfc, - // the header endings will be marked by CRLFCRLF. But - // we will allow CRLFLF, LFLF & CRLFCRLF - if (fragment.endsWith("\n\r") || fragment.endsWith('\n')) - allHeaders = true; - } - bytes += socket->read(&c, 1); - fragment.append(c); - } - // we received all headers now parse them - if (allHeaders) { - parseHeader(fragment); - state = ReadingDataState; - fragment.clear(); // next fragment - bodyLength = contentLength(); // cache the length - } - return bytes; -} - -void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header) -{ - // see rfc2616, sec 4 for information about HTTP/1.1 headers. - // allows relaxed parsing here, accepts both CRLF & LF line endings - const QByteArrayMatcher lf("\n"); - const QByteArrayMatcher colon(":"); - int i = 0; - while (i < header.count()) { - int j = colon.indexIn(header, i); // field-name - if (j == -1) - break; - const QByteArray field = header.mid(i, j - i).trimmed(); - j++; - // any number of LWS is allowed before and after the value - QByteArray value; - do { - i = lf.indexIn(header, j); - if (i == -1) - break; - if (!value.isEmpty()) - value += ' '; - // check if we have CRLF or only LF - bool hasCR = (i && header[i-1] == '\r'); - int length = i -(hasCR ? 1: 0) - j; - value += header.mid(j, length).trimmed(); - j = ++i; - } while (i < header.count() && (header.at(i) == ' ' || header.at(i) == '\t')); - if (i == -1) - break; // something is wrong - - fields.append(qMakePair(field, value)); - } -} - -bool QHttpNetworkReplyPrivate::isChunked() -{ - return headerField("transfer-encoding").toLower().contains("chunked"); -} - -bool QHttpNetworkReplyPrivate::connectionCloseEnabled() -{ - return (headerField("connection").toLower().contains("close") || - headerField("proxy-connection").toLower().contains("close")); -} - -qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QIODevice *out) -{ - qint64 bytes = 0; - if (isChunked()) { - bytes += transferChunked(socket, out); // chunked transfer encoding (rfc 2616, sec 3.6) - } else if (bodyLength > 0) { // we have a Content-Length - bytes += transferRaw(socket, out, bodyLength - contentRead); - if (contentRead + bytes == bodyLength) - state = AllDoneState; - } else { - bytes += transferRaw(socket, out, socket->bytesAvailable()); - } - if (state == AllDoneState) - socket->readAll(); // Read the rest to clean (CRLF) - contentRead += bytes; - return bytes; -} - -qint64 QHttpNetworkReplyPrivate::transferRaw(QIODevice *in, QIODevice *out, qint64 size) -{ - qint64 bytes = 0; - Q_ASSERT(in); - Q_ASSERT(out); - - int toBeRead = qMin<qint64>(128*1024, qMin<qint64>(size, in->bytesAvailable())); - QByteArray raw(toBeRead, 0); - while (size > 0) { - qint64 read = in->read(raw.data(), raw.size()); - if (read == 0) - return bytes; - // ### error checking here - qint64 written = out->write(raw.data(), read); - if (written == 0) - return bytes; - if (read != written) - qDebug() << "### read" << read << "written" << written; - bytes += read; - size -= read; - out->waitForBytesWritten(-1); // throttle - } - return bytes; - -} - -qint64 QHttpNetworkReplyPrivate::transferChunked(QIODevice *in, QIODevice *out) -{ - qint64 bytes = 0; - while (in->bytesAvailable()) { // while we can read from input - // if we are done with the current chunk, get the size of the new chunk - if (currentChunkRead >= currentChunkSize) { - currentChunkSize = 0; - currentChunkRead = 0; - if (bytes) { - char crlf[2]; - bytes += in->read(crlf, 2); // read the "\r\n" after the chunk - } - bytes += getChunkSize(in, ¤tChunkSize); - if (currentChunkSize == -1) - break; - } - // if the chunk size is 0, end of the stream - if (currentChunkSize == 0) { - state = AllDoneState; - break; - } - // otherwise, read data - qint64 readSize = qMin(in->bytesAvailable(), currentChunkSize - currentChunkRead); - QByteArray buffer(readSize, 0); - qint64 read = in->read(buffer.data(), readSize); - bytes += read; - currentChunkRead += read; - qint64 written = out->write(buffer); - Q_UNUSED(written); // Avoid compile warning when building release - Q_ASSERT(read == written); - // ### error checking here - out->waitForBytesWritten(-1); - } - return bytes; -} - -qint64 QHttpNetworkReplyPrivate::getChunkSize(QIODevice *in, qint64 *chunkSize) -{ - qint64 bytes = 0; - char crlf[2]; - *chunkSize = -1; - int bytesAvailable = in->bytesAvailable(); - while (bytesAvailable > bytes) { - qint64 sniffedBytes = in->peek(crlf, 2); - int fragmentSize = fragment.size(); - // check the next two bytes for a "\r\n", skip blank lines - if ((fragmentSize && sniffedBytes == 2 && crlf[0] == '\r' && crlf[1] == '\n') - ||(fragmentSize > 1 && fragment.endsWith('\r') && crlf[0] == '\n')) - { - bytes += in->read(crlf, 1); // read the \r or \n - if (crlf[0] == '\r') - bytes += in->read(crlf, 1); // read the \n - bool ok = false; - // ignore the chunk-extension - fragment = fragment.mid(0, fragment.indexOf(';')).trimmed(); - *chunkSize = fragment.toLong(&ok, 16); - fragment.clear(); - break; // size done - } else { - // read the fragment to the buffer - char c = 0; - bytes += in->read(&c, 1); - fragment.append(c); - } - } - return bytes; -} - -// QHttpNetworkConnectionPrivate - -typedef QPair<QHttpNetworkRequest, QHttpNetworkReply*> HttpMessagePair; - -class QHttpNetworkConnectionPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QHttpNetworkConnection) -public: - QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt); - ~QHttpNetworkConnectionPrivate(); - void init(); - void connectSignals(QAbstractSocket *socket); - - enum SocketState { - IdleState = 0, // ready to send request - ConnectingState = 1, // connecting to host - WritingState = 2, // writing the data - WaitingState = 4, // waiting for reply - ReadingState = 8, // reading the reply - Wait4AuthState = 0x10, // blocked for send till the current authentication slot is done - BusyState = (ConnectingState|WritingState|WaitingState|ReadingState|Wait4AuthState) - }; - - enum { ChunkSize = 4096 }; - - int indexOf(QAbstractSocket *socket) const; - bool isSocketBusy(QAbstractSocket *socket) const; - bool isSocketWriting(QAbstractSocket *socket) const; - bool isSocketWaiting(QAbstractSocket *socket) const; - bool isSocketReading(QAbstractSocket *socket) const; - - QHttpNetworkReply *queueRequest(const QHttpNetworkRequest &request); - void unqueueRequest(QAbstractSocket *socket); - void prepareRequest(HttpMessagePair &request); - bool sendRequest(QAbstractSocket *socket); - void receiveReply(QAbstractSocket *socket, QHttpNetworkReply *reply); - void resendCurrentRequest(QAbstractSocket *socket); - void closeChannel(int channel); - void copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy); - - // private slots - void _q_bytesWritten(qint64 bytes); // proceed sending - void _q_readyRead(); // pending data to read - void _q_disconnected(); // disconnected from host - void _q_startNextRequest(); // send the next request from the queue - void _q_restartPendingRequest(); // send the currently blocked request - void _q_connected(); // start sending request - void _q_error(QAbstractSocket::SocketError); // error from socket -#ifndef QT_NO_NETWORKPROXY - void _q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); // from transparent proxy -#endif - void _q_dataReadyReadNoBuffer(); - void _q_dataReadyReadBuffer(); - - void createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request); - bool ensureConnection(QAbstractSocket *socket); - QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket); - void eraseData(QHttpNetworkReply *reply); -#ifndef QT_NO_COMPRESS - bool expand(QAbstractSocket *socket, QHttpNetworkReply *reply, bool dataComplete); -#endif - void bufferData(HttpMessagePair &request); - void removeReply(QHttpNetworkReply *reply); - - QString hostName; - quint16 port; - bool encrypt; - - struct Channel { - QAbstractSocket *socket; - SocketState state; - QHttpNetworkRequest request; // current request - QHttpNetworkReply *reply; // current reply for this request - qint64 written; - qint64 bytesTotal; - bool resendCurrent; - int lastStatus; // last status received on this channel - bool pendingEncrypt; // for https (send after encrypted) - int reconnectAttempts; // maximum 2 reconnection attempts - QAuthenticatorPrivate::Method authMehtod; - QAuthenticatorPrivate::Method proxyAuthMehtod; - QAuthenticator authenticator; - QAuthenticator proxyAuthenticator; -#ifndef QT_NO_OPENSSL - bool ignoreSSLErrors; -#endif - Channel() :state(IdleState), reply(0), written(0), bytesTotal(0), resendCurrent(false), reconnectAttempts(2), - authMehtod(QAuthenticatorPrivate::None), proxyAuthMehtod(QAuthenticatorPrivate::None) -#ifndef QT_NO_OPENSSL - , ignoreSSLErrors(false) -#endif - {} - }; - static const int channelCount; - Channel channels[2]; // maximum of 2 socket connections to the server - bool pendingAuthSignal; // there is an incomplete authentication signal - bool pendingProxyAuthSignal; // there is an incomplete proxy authentication signal - - void appendData(QHttpNetworkReply &reply, const QByteArray &fragment, bool compressed); - qint64 bytesAvailable(const QHttpNetworkReply &reply, bool compressed = false) const; - qint64 read(QHttpNetworkReply &reply, QByteArray &data, qint64 maxSize, bool compressed); - void emitReplyError(QAbstractSocket *socket, QHttpNetworkReply *reply, QNetworkReply::NetworkError errorCode); - bool handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, bool isProxy, bool &resend); - void allDone(QAbstractSocket *socket, QHttpNetworkReply *reply); - void handleStatus(QAbstractSocket *socket, QHttpNetworkReply *reply); - inline bool emitSignals(QHttpNetworkReply *reply); - inline bool expectContent(QHttpNetworkReply *reply); - -#ifndef QT_NO_OPENSSL - void _q_encrypted(); // start sending request (https) - void _q_sslErrors(const QList<QSslError> &errors); // ssl errors from the socket - QSslConfiguration sslConfiguration(const QHttpNetworkReply &reply) const; -#endif -#ifndef QT_NO_NETWORKPROXY - QNetworkProxy networkProxy; -#endif - //The request queues - QList<HttpMessagePair> highPriorityQueue; - QList<HttpMessagePair> lowPriorityQueue; -}; +QT_BEGIN_NAMESPACE const int QHttpNetworkConnectionPrivate::channelCount = 2; @@ -2150,235 +1284,6 @@ QNetworkProxy QHttpNetworkConnection::transparentProxy() const } #endif -// QHttpNetworkRequest - -QHttpNetworkRequest::QHttpNetworkRequest(const QUrl &url, Operation operation, Priority priority) - : d(new QHttpNetworkRequestPrivate(operation, priority, url)) -{ -} - -QHttpNetworkRequest::QHttpNetworkRequest(const QHttpNetworkRequest &other) - : QHttpNetworkHeader(other), d(other.d) -{ -} - -QHttpNetworkRequest::~QHttpNetworkRequest() -{ -} - -QUrl QHttpNetworkRequest::url() const -{ - return d->url; -} -void QHttpNetworkRequest::setUrl(const QUrl &url) -{ - d->url = url; -} - -qint64 QHttpNetworkRequest::contentLength() const -{ - return d->contentLength(); -} - -void QHttpNetworkRequest::setContentLength(qint64 length) -{ - d->setContentLength(length); -} - -QList<QPair<QByteArray, QByteArray> > QHttpNetworkRequest::header() const -{ - return d->fields; -} - -QByteArray QHttpNetworkRequest::headerField(const QByteArray &name, const QByteArray &defaultValue) const -{ - return d->headerField(name, defaultValue); -} - -void QHttpNetworkRequest::setHeaderField(const QByteArray &name, const QByteArray &data) -{ - d->setHeaderField(name, data); -} - -QHttpNetworkRequest &QHttpNetworkRequest::operator=(const QHttpNetworkRequest &other) -{ - d = other.d; - return *this; -} - -bool QHttpNetworkRequest::operator==(const QHttpNetworkRequest &other) const -{ - return d->operator==(*other.d); -} - -QHttpNetworkRequest::Operation QHttpNetworkRequest::operation() const -{ - return d->operation; -} - -void QHttpNetworkRequest::setOperation(Operation operation) -{ - d->operation = operation; -} - -QHttpNetworkRequest::Priority QHttpNetworkRequest::priority() const -{ - return d->priority; -} - -void QHttpNetworkRequest::setPriority(Priority priority) -{ - d->priority = priority; -} - -QIODevice *QHttpNetworkRequest::data() const -{ - return d->data; -} - -void QHttpNetworkRequest::setData(QIODevice *data) -{ - d->data = data; -} - -int QHttpNetworkRequest::majorVersion() const -{ - return 1; -} - -int QHttpNetworkRequest::minorVersion() const -{ - return 1; -} - -// QHttpNetworkReply - -QHttpNetworkReply::QHttpNetworkReply(const QUrl &url, QObject *parent) - : QObject(*new QHttpNetworkReplyPrivate(url), parent) -{ -} - -QHttpNetworkReply::~QHttpNetworkReply() -{ - Q_D(QHttpNetworkReply); - if (d->connection) { - d->connection->d_func()->removeReply(this); - } -} - -QUrl QHttpNetworkReply::url() const -{ - return d_func()->url; -} -void QHttpNetworkReply::setUrl(const QUrl &url) -{ - Q_D(QHttpNetworkReply); - d->url = url; -} - -qint64 QHttpNetworkReply::contentLength() const -{ - return d_func()->contentLength(); -} - -void QHttpNetworkReply::setContentLength(qint64 length) -{ - Q_D(QHttpNetworkReply); - d->setContentLength(length); -} - -QList<QPair<QByteArray, QByteArray> > QHttpNetworkReply::header() const -{ - return d_func()->fields; -} - -QByteArray QHttpNetworkReply::headerField(const QByteArray &name, const QByteArray &defaultValue) const -{ - return d_func()->headerField(name, defaultValue); -} - -void QHttpNetworkReply::setHeaderField(const QByteArray &name, const QByteArray &data) -{ - Q_D(QHttpNetworkReply); - d->setHeaderField(name, data); -} - -void QHttpNetworkReply::parseHeader(const QByteArray &header) -{ - Q_D(QHttpNetworkReply); - d->parseHeader(header); -} - -QHttpNetworkRequest QHttpNetworkReply::request() const -{ - return d_func()->request; -} - -void QHttpNetworkReply::setRequest(const QHttpNetworkRequest &request) -{ - Q_D(QHttpNetworkReply); - d->request = request; -} - -int QHttpNetworkReply::statusCode() const -{ - return d_func()->statusCode; -} - -void QHttpNetworkReply::setStatusCode(int code) -{ - Q_D(QHttpNetworkReply); - d->statusCode = code; -} - -QString QHttpNetworkReply::errorString() const -{ - return d_func()->errorString; -} - -QString QHttpNetworkReply::reasonPhrase() const -{ - return d_func()->reasonPhrase; -} - -void QHttpNetworkReply::setErrorString(const QString &error) -{ - Q_D(QHttpNetworkReply); - d->errorString = error; -} - -int QHttpNetworkReply::majorVersion() const -{ - return d_func()->majorVersion; -} - -int QHttpNetworkReply::minorVersion() const -{ - return d_func()->minorVersion; -} - -qint64 QHttpNetworkReply::bytesAvailable() const -{ - Q_D(const QHttpNetworkReply); - if (d->connection) - return d->connection->d_func()->bytesAvailable(*this); - else - return -1; -} - -QByteArray QHttpNetworkReply::read(qint64 maxSize) -{ - Q_D(QHttpNetworkReply); - QByteArray data; - if (d->connection) - d->connection->d_func()->read(*this, data, maxSize, false); - return data; -} - -bool QHttpNetworkReply::isFinished() const -{ - return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState; -} // SSL support below #ifndef QT_NO_OPENSSL @@ -2433,27 +1338,7 @@ void QHttpNetworkConnection::ignoreSslErrors(int channel) } } -QSslConfiguration QHttpNetworkReply::sslConfiguration() const -{ - Q_D(const QHttpNetworkReply); - if (d->connection) - return d->connection->d_func()->sslConfiguration(*this); - return QSslConfiguration(); -} -void QHttpNetworkReply::setSslConfiguration(const QSslConfiguration &config) -{ - Q_D(QHttpNetworkReply); - if (d->connection) - d->connection->setSslConfiguration(config); -} - -void QHttpNetworkReply::ignoreSslErrors() -{ - Q_D(QHttpNetworkReply); - if (d->connection) - d->connection->ignoreSslErrors(); -} #endif //QT_NO_OPENSSL diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 8dbcb3d..09bd459 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -56,6 +56,16 @@ #include <QtNetwork/qnetworkreply.h> #include <QtNetwork/qabstractsocket.h> +#include <private/qobject_p.h> +#include <qauthenticator.h> +#include <qnetworkproxy.h> +#include <qbuffer.h> + +#include <private/qhttpnetworkheader_p.h> +#include <private/qhttpnetworkrequest_p.h> +#include <private/qhttpnetworkreply_p.h> + + #ifndef QT_NO_HTTP #ifndef QT_NO_OPENSSL @@ -145,144 +155,137 @@ private: #endif }; -class Q_AUTOTEST_EXPORT QHttpNetworkHeader -{ -public: - virtual ~QHttpNetworkHeader() {}; - virtual QUrl url() const = 0; - virtual void setUrl(const QUrl &url) = 0; - virtual int majorVersion() const = 0; - virtual int minorVersion() const = 0; - virtual qint64 contentLength() const = 0; - virtual void setContentLength(qint64 length) = 0; - virtual QList<QPair<QByteArray, QByteArray> > header() const = 0; - virtual QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const = 0; - virtual void setHeaderField(const QByteArray &name, const QByteArray &data) = 0; -}; +// private classes +typedef QPair<QHttpNetworkRequest, QHttpNetworkReply*> HttpMessagePair; + -class QHttpNetworkRequestPrivate; -class Q_AUTOTEST_EXPORT QHttpNetworkRequest: public QHttpNetworkHeader +class QHttpNetworkConnectionPrivate : public QObjectPrivate { + Q_DECLARE_PUBLIC(QHttpNetworkConnection) public: - enum Operation { - Options, - Get, - Head, - Post, - Put, - Delete, - Trace, - Connect + QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt); + ~QHttpNetworkConnectionPrivate(); + void init(); + void connectSignals(QAbstractSocket *socket); + + enum SocketState { + IdleState = 0, // ready to send request + ConnectingState = 1, // connecting to host + WritingState = 2, // writing the data + WaitingState = 4, // waiting for reply + ReadingState = 8, // reading the reply + Wait4AuthState = 0x10, // blocked for send till the current authentication slot is done + BusyState = (ConnectingState|WritingState|WaitingState|ReadingState|Wait4AuthState) }; - enum Priority { - HighPriority, - NormalPriority, - LowPriority + enum { ChunkSize = 4096 }; + + int indexOf(QAbstractSocket *socket) const; + bool isSocketBusy(QAbstractSocket *socket) const; + bool isSocketWriting(QAbstractSocket *socket) const; + bool isSocketWaiting(QAbstractSocket *socket) const; + bool isSocketReading(QAbstractSocket *socket) const; + + QHttpNetworkReply *queueRequest(const QHttpNetworkRequest &request); + void unqueueRequest(QAbstractSocket *socket); + void prepareRequest(HttpMessagePair &request); + bool sendRequest(QAbstractSocket *socket); + void receiveReply(QAbstractSocket *socket, QHttpNetworkReply *reply); + void resendCurrentRequest(QAbstractSocket *socket); + void closeChannel(int channel); + void copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy); + + // private slots + void _q_bytesWritten(qint64 bytes); // proceed sending + void _q_readyRead(); // pending data to read + void _q_disconnected(); // disconnected from host + void _q_startNextRequest(); // send the next request from the queue + void _q_restartPendingRequest(); // send the currently blocked request + void _q_connected(); // start sending request + void _q_error(QAbstractSocket::SocketError); // error from socket +#ifndef QT_NO_NETWORKPROXY + void _q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); // from transparent proxy +#endif + void _q_dataReadyReadNoBuffer(); + void _q_dataReadyReadBuffer(); + + void createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request); + bool ensureConnection(QAbstractSocket *socket); + QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket); + void eraseData(QHttpNetworkReply *reply); +#ifndef QT_NO_COMPRESS + bool expand(QAbstractSocket *socket, QHttpNetworkReply *reply, bool dataComplete); +#endif + void bufferData(HttpMessagePair &request); + void removeReply(QHttpNetworkReply *reply); + + QString hostName; + quint16 port; + bool encrypt; + + struct Channel { + QAbstractSocket *socket; + SocketState state; + QHttpNetworkRequest request; // current request + QHttpNetworkReply *reply; // current reply for this request + qint64 written; + qint64 bytesTotal; + bool resendCurrent; + int lastStatus; // last status received on this channel + bool pendingEncrypt; // for https (send after encrypted) + int reconnectAttempts; // maximum 2 reconnection attempts + QAuthenticatorPrivate::Method authMehtod; + QAuthenticatorPrivate::Method proxyAuthMehtod; + QAuthenticator authenticator; + QAuthenticator proxyAuthenticator; +#ifndef QT_NO_OPENSSL + bool ignoreSSLErrors; +#endif + Channel() :state(IdleState), reply(0), written(0), bytesTotal(0), resendCurrent(false), reconnectAttempts(2), + authMehtod(QAuthenticatorPrivate::None), proxyAuthMehtod(QAuthenticatorPrivate::None) +#ifndef QT_NO_OPENSSL + , ignoreSSLErrors(false) +#endif + {} }; - - QHttpNetworkRequest(const QUrl &url = QUrl(), Operation operation = Get, Priority priority = NormalPriority); - QHttpNetworkRequest(const QHttpNetworkRequest &other); - virtual ~QHttpNetworkRequest(); - QHttpNetworkRequest &operator=(const QHttpNetworkRequest &other); - bool operator==(const QHttpNetworkRequest &other) const; - - QUrl url() const; - void setUrl(const QUrl &url); - - int majorVersion() const; - int minorVersion() const; - - qint64 contentLength() const; - void setContentLength(qint64 length); - - QList<QPair<QByteArray, QByteArray> > header() const; - QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const; - void setHeaderField(const QByteArray &name, const QByteArray &data); - - Operation operation() const; - void setOperation(Operation operation); - - Priority priority() const; - void setPriority(Priority priority); - - QIODevice *data() const; - void setData(QIODevice *data); - -private: - QSharedDataPointer<QHttpNetworkRequestPrivate> d; - friend class QHttpNetworkRequestPrivate; - friend class QHttpNetworkConnectionPrivate; -}; - -class QHttpNetworkReplyPrivate; -class Q_AUTOTEST_EXPORT QHttpNetworkReply : public QObject, public QHttpNetworkHeader -{ - Q_OBJECT -public: - - explicit QHttpNetworkReply(const QUrl &url = QUrl(), QObject *parent = 0); - virtual ~QHttpNetworkReply(); - - QUrl url() const; - void setUrl(const QUrl &url); - - int majorVersion() const; - int minorVersion() const; - - qint64 contentLength() const; - void setContentLength(qint64 length); - - QList<QPair<QByteArray, QByteArray> > header() const; - QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const; - void setHeaderField(const QByteArray &name, const QByteArray &data); - void parseHeader(const QByteArray &header); // mainly for testing - - QHttpNetworkRequest request() const; - void setRequest(const QHttpNetworkRequest &request); - - int statusCode() const; - void setStatusCode(int code); - - QString errorString() const; - void setErrorString(const QString &error); - - QString reasonPhrase() const; - - qint64 bytesAvailable() const; - QByteArray read(qint64 maxSize = -1); - - bool isFinished() const; + static const int channelCount; + Channel channels[2]; // maximum of 2 socket connections to the server + bool pendingAuthSignal; // there is an incomplete authentication signal + bool pendingProxyAuthSignal; // there is an incomplete proxy authentication signal + + void appendData(QHttpNetworkReply &reply, const QByteArray &fragment, bool compressed); + qint64 bytesAvailable(const QHttpNetworkReply &reply, bool compressed = false) const; + qint64 read(QHttpNetworkReply &reply, QByteArray &data, qint64 maxSize, bool compressed); + void emitReplyError(QAbstractSocket *socket, QHttpNetworkReply *reply, QNetworkReply::NetworkError errorCode); + bool handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, bool isProxy, bool &resend); + void allDone(QAbstractSocket *socket, QHttpNetworkReply *reply); + void handleStatus(QAbstractSocket *socket, QHttpNetworkReply *reply); + inline bool emitSignals(QHttpNetworkReply *reply); + inline bool expectContent(QHttpNetworkReply *reply); #ifndef QT_NO_OPENSSL - QSslConfiguration sslConfiguration() const; - void setSslConfiguration(const QSslConfiguration &config); - void ignoreSslErrors(); - -Q_SIGNALS: - void sslErrors(const QList<QSslError> &errors); + void _q_encrypted(); // start sending request (https) + void _q_sslErrors(const QList<QSslError> &errors); // ssl errors from the socket + QSslConfiguration sslConfiguration(const QHttpNetworkReply &reply) const; #endif -Q_SIGNALS: - void readyRead(); - void finished(); - void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail = QString()); - void headerChanged(); - void dataReadProgress(int done, int total); - void dataSendProgress(int done, int total); +#ifndef QT_NO_NETWORKPROXY + QNetworkProxy networkProxy; +#endif -private: - Q_DECLARE_PRIVATE(QHttpNetworkReply) - friend class QHttpNetworkConnection; - friend class QHttpNetworkConnectionPrivate; + //The request queues + QList<HttpMessagePair> highPriorityQueue; + QList<HttpMessagePair> lowPriorityQueue; }; + + QT_END_NAMESPACE -Q_DECLARE_METATYPE(QHttpNetworkRequest) +//Q_DECLARE_METATYPE(QHttpNetworkRequest) //Q_DECLARE_METATYPE(QHttpNetworkReply) #endif // QT_NO_HTTP diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp new file mode 100644 index 0000000..6f7f6f7 --- /dev/null +++ b/src/network/access/qhttpnetworkheader.cpp @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhttpnetworkheader_p.h" + + +QT_BEGIN_NAMESPACE + +QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl) + :url(newUrl) +{ +} + +QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPrivate &other) + :QSharedData(other) +{ + url = other.url; + fields = other.fields; +} + +qint64 QHttpNetworkHeaderPrivate::contentLength() const +{ + bool ok = false; + QByteArray value = headerField("content-length"); + qint64 length = value.toULongLong(&ok); + if (ok) + return length; + return -1; // the header field is not set +} + +void QHttpNetworkHeaderPrivate::setContentLength(qint64 length) +{ + setHeaderField("Content-Length", QByteArray::number(length)); +} + +QByteArray QHttpNetworkHeaderPrivate::headerField(const QByteArray &name, const QByteArray &defaultValue) const +{ + QList<QByteArray> allValues = headerFieldValues(name); + if (allValues.isEmpty()) + return defaultValue; + + QByteArray result; + bool first = true; + foreach (QByteArray value, allValues) { + if (!first) + result += ", "; + first = false; + result += value; + } + return result; +} + +QList<QByteArray> QHttpNetworkHeaderPrivate::headerFieldValues(const QByteArray &name) const +{ + QList<QByteArray> result; + QByteArray lowerName = name.toLower(); + QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(), + end = fields.constEnd(); + for ( ; it != end; ++it) + if (lowerName == it->first.toLower()) + result += it->second; + + return result; +} + +void QHttpNetworkHeaderPrivate::setHeaderField(const QByteArray &name, const QByteArray &data) +{ + QByteArray lowerName = name.toLower(); + QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(); + while (it != fields.end()) { + if (lowerName == it->first.toLower()) + it = fields.erase(it); + else + ++it; + } + fields.append(qMakePair(name, data)); +} + +bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &other) const +{ + return (url == other.url); +} + + +QT_END_NAMESPACE diff --git a/src/network/access/qhttpnetworkheader_p.h b/src/network/access/qhttpnetworkheader_p.h new file mode 100644 index 0000000..4e62352 --- /dev/null +++ b/src/network/access/qhttpnetworkheader_p.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHTTPNETWORKHEADER_H +#define QHTTPNETWORKHEADER_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. +// +#ifndef QT_NO_HTTP + +#include <qshareddata.h> +#include <qurl.h> + +QT_BEGIN_NAMESPACE + +class Q_AUTOTEST_EXPORT QHttpNetworkHeader +{ +public: + virtual ~QHttpNetworkHeader() {}; + virtual QUrl url() const = 0; + virtual void setUrl(const QUrl &url) = 0; + + virtual int majorVersion() const = 0; + virtual int minorVersion() const = 0; + + virtual qint64 contentLength() const = 0; + virtual void setContentLength(qint64 length) = 0; + + virtual QList<QPair<QByteArray, QByteArray> > header() const = 0; + virtual QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const = 0; + virtual void setHeaderField(const QByteArray &name, const QByteArray &data) = 0; +}; + +class QHttpNetworkHeaderPrivate : public QSharedData +{ +public: + QUrl url; + QList<QPair<QByteArray, QByteArray> > fields; + + QHttpNetworkHeaderPrivate(const QUrl &newUrl = QUrl()); + QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPrivate &other); + qint64 contentLength() const; + void setContentLength(qint64 length); + + QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const; + QList<QByteArray> headerFieldValues(const QByteArray &name) const; + void setHeaderField(const QByteArray &name, const QByteArray &data); + bool operator==(const QHttpNetworkHeaderPrivate &other) const; + +}; + + +QT_END_NAMESPACE + + +#endif // QT_NO_HTTP + + +#endif // QHTTPNETWORKHEADER_H + + + + + + diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp new file mode 100644 index 0000000..fe3f6af --- /dev/null +++ b/src/network/access/qhttpnetworkreply.cpp @@ -0,0 +1,663 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhttpnetworkreply_p.h" +#include "qhttpnetworkconnection_p.h" + +#include <qbytearraymatcher.h> + +#ifndef QT_NO_HTTP + +#ifndef QT_NO_OPENSSL +# include <QtNetwork/qsslkey.h> +# include <QtNetwork/qsslcipher.h> +# include <QtNetwork/qsslconfiguration.h> +#endif + +QT_BEGIN_NAMESPACE + +QHttpNetworkReply::QHttpNetworkReply(const QUrl &url, QObject *parent) + : QObject(*new QHttpNetworkReplyPrivate(url), parent) +{ +} + +QHttpNetworkReply::~QHttpNetworkReply() +{ + Q_D(QHttpNetworkReply); + if (d->connection) { + d->connection->d_func()->removeReply(this); + } +} + +QUrl QHttpNetworkReply::url() const +{ + return d_func()->url; +} +void QHttpNetworkReply::setUrl(const QUrl &url) +{ + Q_D(QHttpNetworkReply); + d->url = url; +} + +qint64 QHttpNetworkReply::contentLength() const +{ + return d_func()->contentLength(); +} + +void QHttpNetworkReply::setContentLength(qint64 length) +{ + Q_D(QHttpNetworkReply); + d->setContentLength(length); +} + +QList<QPair<QByteArray, QByteArray> > QHttpNetworkReply::header() const +{ + return d_func()->fields; +} + +QByteArray QHttpNetworkReply::headerField(const QByteArray &name, const QByteArray &defaultValue) const +{ + return d_func()->headerField(name, defaultValue); +} + +void QHttpNetworkReply::setHeaderField(const QByteArray &name, const QByteArray &data) +{ + Q_D(QHttpNetworkReply); + d->setHeaderField(name, data); +} + +void QHttpNetworkReply::parseHeader(const QByteArray &header) +{ + Q_D(QHttpNetworkReply); + d->parseHeader(header); +} + +QHttpNetworkRequest QHttpNetworkReply::request() const +{ + return d_func()->request; +} + +void QHttpNetworkReply::setRequest(const QHttpNetworkRequest &request) +{ + Q_D(QHttpNetworkReply); + d->request = request; +} + +int QHttpNetworkReply::statusCode() const +{ + return d_func()->statusCode; +} + +void QHttpNetworkReply::setStatusCode(int code) +{ + Q_D(QHttpNetworkReply); + d->statusCode = code; +} + +QString QHttpNetworkReply::errorString() const +{ + return d_func()->errorString; +} + +QString QHttpNetworkReply::reasonPhrase() const +{ + return d_func()->reasonPhrase; +} + +void QHttpNetworkReply::setErrorString(const QString &error) +{ + Q_D(QHttpNetworkReply); + d->errorString = error; +} + +int QHttpNetworkReply::majorVersion() const +{ + return d_func()->majorVersion; +} + +int QHttpNetworkReply::minorVersion() const +{ + return d_func()->minorVersion; +} + +qint64 QHttpNetworkReply::bytesAvailable() const +{ + Q_D(const QHttpNetworkReply); + if (d->connection) + return d->connection->d_func()->bytesAvailable(*this); + else + return -1; +} + +QByteArray QHttpNetworkReply::read(qint64 maxSize) +{ + Q_D(QHttpNetworkReply); + QByteArray data; + if (d->connection) + d->connection->d_func()->read(*this, data, maxSize, false); + return data; +} + +bool QHttpNetworkReply::isFinished() const +{ + return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState; +} + + + +QHttpNetworkReplyPrivate::QHttpNetworkReplyPrivate(const QUrl &newUrl) + : QHttpNetworkHeaderPrivate(newUrl), state(NothingDoneState), statusCode(100), + majorVersion(0), minorVersion(0), bodyLength(0), contentRead(0), totalProgress(0), + currentChunkSize(0), currentChunkRead(0), connection(0), initInflate(false), + autoDecompress(false), requestIsBuffering(false), requestIsPrepared(false) +{ +} + +QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate() +{ +} + +void QHttpNetworkReplyPrivate::clear() +{ + state = NothingDoneState; + statusCode = 100; + bodyLength = 0; + contentRead = 0; + totalProgress = 0; + currentChunkSize = 0; + currentChunkRead = 0; + connection = 0; +#ifndef QT_NO_COMPRESS + if (initInflate) + inflateEnd(&inflateStrm); +#endif + initInflate = false; + streamEnd = false; + autoDecompress = false; + fields.clear(); +} + +// QHttpNetworkReplyPrivate +qint64 QHttpNetworkReplyPrivate::bytesAvailable() const +{ + return (state != ReadingDataState ? 0 : fragment.size()); +} + +bool QHttpNetworkReplyPrivate::isGzipped() +{ + QByteArray encoding = headerField("content-encoding"); + return encoding.toLower() == "gzip"; +} + +void QHttpNetworkReplyPrivate::removeAutoDecompressHeader() +{ + // The header "Content-Encoding = gzip" is retained. + // Content-Length is removed since the actual one send by the server is for compressed data + QByteArray name("content-length"); + QByteArray lowerName = name.toLower(); + QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(), + end = fields.end(); + while (it != end) { + if (name == it->first.toLower()) { + fields.erase(it); + break; + } + ++it; + } + +} + +bool QHttpNetworkReplyPrivate::findChallenge(bool forProxy, QByteArray &challenge) const +{ + challenge.clear(); + // find out the type of authentication protocol requested. + QByteArray header = forProxy ? "proxy-authenticate" : "www-authenticate"; + // pick the best protocol (has to match parsing in QAuthenticatorPrivate) + QList<QByteArray> challenges = headerFieldValues(header); + for (int i = 0; i<challenges.size(); i++) { + QByteArray line = challenges.at(i); + if (!line.toLower().startsWith("negotiate")) + challenge = line; + } + return !challenge.isEmpty(); +} + +QAuthenticatorPrivate::Method QHttpNetworkReplyPrivate::authenticationMethod(bool isProxy) const +{ + // The logic is same as the one used in void QAuthenticatorPrivate::parseHttpResponse() + QAuthenticatorPrivate::Method method = QAuthenticatorPrivate::None; + QByteArray header = isProxy ? "proxy-authenticate" : "www-authenticate"; + QList<QByteArray> challenges = headerFieldValues(header); + for (int i = 0; i<challenges.size(); i++) { + QByteArray line = challenges.at(i).trimmed().toLower(); + if (method < QAuthenticatorPrivate::Basic + && line.startsWith("basic")) { + method = QAuthenticatorPrivate::Basic; + } else if (method < QAuthenticatorPrivate::Ntlm + && line.startsWith("ntlm")) { + method = QAuthenticatorPrivate::Ntlm; + } else if (method < QAuthenticatorPrivate::DigestMd5 + && line.startsWith("digest")) { + method = QAuthenticatorPrivate::DigestMd5; + } + } + return method; +} + +#ifndef QT_NO_COMPRESS +bool QHttpNetworkReplyPrivate::gzipCheckHeader(QByteArray &content, int &pos) +{ + int method = 0; // method byte + int flags = 0; // flags byte + bool ret = false; + + // Assure two bytes in the buffer so we can peek ahead -- handle case + // where first byte of header is at the end of the buffer after the last + // gzip segment + pos = -1; + QByteArray &body = content; + int maxPos = body.size()-1; + if (maxPos < 1) { + return ret; + } + + // Peek ahead to check the gzip magic header + if (body[0] != char(gz_magic[0]) || + body[1] != char(gz_magic[1])) { + return ret; + } + pos += 2; + // Check the rest of the gzip header + if (++pos <= maxPos) + method = body[pos]; + if (pos++ <= maxPos) + flags = body[pos]; + if (method != Z_DEFLATED || (flags & RESERVED) != 0) { + return ret; + } + + // Discard time, xflags and OS code: + pos += 6; + if (pos > maxPos) + return ret; + if ((flags & EXTRA_FIELD) && ((pos+2) <= maxPos)) { // skip the extra field + unsigned len = (unsigned)body[++pos]; + len += ((unsigned)body[++pos])<<8; + pos += len; + if (pos > maxPos) + return ret; + } + if ((flags & ORIG_NAME) != 0) { // skip the original file name + while(++pos <= maxPos && body[pos]) {} + } + if ((flags & COMMENT) != 0) { // skip the .gz file comment + while(++pos <= maxPos && body[pos]) {} + } + if ((flags & HEAD_CRC) != 0) { // skip the header crc + pos += 2; + if (pos > maxPos) + return ret; + } + ret = (pos < maxPos); // return failed, if no more bytes left + return ret; +} + +int QHttpNetworkReplyPrivate::gunzipBodyPartially(QByteArray &compressed, QByteArray &inflated) +{ + int ret = Z_DATA_ERROR; + unsigned have; + unsigned char out[CHUNK]; + int pos = -1; + + if (!initInflate) { + // check the header + if (!gzipCheckHeader(compressed, pos)) + return ret; + // allocate inflate state + inflateStrm.zalloc = Z_NULL; + inflateStrm.zfree = Z_NULL; + inflateStrm.opaque = Z_NULL; + inflateStrm.avail_in = 0; + inflateStrm.next_in = Z_NULL; + ret = inflateInit2(&inflateStrm, -MAX_WBITS); + if (ret != Z_OK) + return ret; + initInflate = true; + streamEnd = false; + } + + //remove the header. + compressed.remove(0, pos+1); + // expand until deflate stream ends + inflateStrm.next_in = (unsigned char *)compressed.data(); + inflateStrm.avail_in = compressed.size(); + do { + inflateStrm.avail_out = sizeof(out); + inflateStrm.next_out = out; + ret = inflate(&inflateStrm, Z_NO_FLUSH); + switch (ret) { + case Z_NEED_DICT: + ret = Z_DATA_ERROR; + // and fall through + case Z_DATA_ERROR: + case Z_MEM_ERROR: + inflateEnd(&inflateStrm); + initInflate = false; + return ret; + } + have = sizeof(out) - inflateStrm.avail_out; + inflated.append(QByteArray((const char *)out, have)); + } while (inflateStrm.avail_out == 0); + // clean up and return + if (ret <= Z_ERRNO || ret == Z_STREAM_END) { + inflateEnd(&inflateStrm); + initInflate = false; + } + streamEnd = (ret == Z_STREAM_END); + return ret; +} +#endif + +qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) +{ + qint64 bytes = 0; + char c; + + while (socket->bytesAvailable()) { + // allow both CRLF & LF (only) line endings + if (socket->peek(&c, 1) == 1 && c == '\n') { + bytes += socket->read(&c, 1); // read the "n" + // remove the CR at the end + if (fragment.endsWith('\r')) { + fragment.truncate(fragment.length()-1); + } + parseStatus(fragment); + state = ReadingHeaderState; + fragment.clear(); // next fragment + break; + } else { + c = 0; + bytes += socket->read(&c, 1); + fragment.append(c); + } + } + return bytes; +} + +void QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) +{ + const QByteArrayMatcher sp(" "); + int i = sp.indexIn(status); + const QByteArray version = status.mid(0, i); + int j = sp.indexIn(status, i + 1); + const QByteArray code = status.mid(i + 1, j - i - 1); + const QByteArray reason = status.mid(j + 1, status.count() - j); + + const QByteArrayMatcher slash("/"); + int k = slash.indexIn(version); + const QByteArrayMatcher dot("."); + int l = dot.indexIn(version, k); + const QByteArray major = version.mid(k + 1, l - k - 1); + const QByteArray minor = version.mid(l + 1, version.count() - l); + + majorVersion = QString::fromAscii(major.constData()).toInt(); + minorVersion = QString::fromAscii(minor.constData()).toInt(); + statusCode = QString::fromAscii(code.constData()).toInt(); + reasonPhrase = QString::fromAscii(reason.constData()); +} + +qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) +{ + qint64 bytes = 0; + char crlfcrlf[5]; + crlfcrlf[4] = '\0'; + char c = 0; + bool allHeaders = false; + while (!allHeaders && socket->bytesAvailable()) { + if (socket->peek(&c, 1) == 1 && c == '\n') { + // check for possible header endings. As per HTTP rfc, + // the header endings will be marked by CRLFCRLF. But + // we will allow CRLFLF, LFLF & CRLFCRLF + if (fragment.endsWith("\n\r") || fragment.endsWith('\n')) + allHeaders = true; + } + bytes += socket->read(&c, 1); + fragment.append(c); + } + // we received all headers now parse them + if (allHeaders) { + parseHeader(fragment); + state = ReadingDataState; + fragment.clear(); // next fragment + bodyLength = contentLength(); // cache the length + } + return bytes; +} + +void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header) +{ + // see rfc2616, sec 4 for information about HTTP/1.1 headers. + // allows relaxed parsing here, accepts both CRLF & LF line endings + const QByteArrayMatcher lf("\n"); + const QByteArrayMatcher colon(":"); + int i = 0; + while (i < header.count()) { + int j = colon.indexIn(header, i); // field-name + if (j == -1) + break; + const QByteArray field = header.mid(i, j - i).trimmed(); + j++; + // any number of LWS is allowed before and after the value + QByteArray value; + do { + i = lf.indexIn(header, j); + if (i == -1) + break; + if (!value.isEmpty()) + value += ' '; + // check if we have CRLF or only LF + bool hasCR = (i && header[i-1] == '\r'); + int length = i -(hasCR ? 1: 0) - j; + value += header.mid(j, length).trimmed(); + j = ++i; + } while (i < header.count() && (header.at(i) == ' ' || header.at(i) == '\t')); + if (i == -1) + break; // something is wrong + + fields.append(qMakePair(field, value)); + } +} + +bool QHttpNetworkReplyPrivate::isChunked() +{ + return headerField("transfer-encoding").toLower().contains("chunked"); +} + +bool QHttpNetworkReplyPrivate::connectionCloseEnabled() +{ + return (headerField("connection").toLower().contains("close") || + headerField("proxy-connection").toLower().contains("close")); +} + +qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QIODevice *out) +{ + qint64 bytes = 0; + if (isChunked()) { + bytes += transferChunked(socket, out); // chunked transfer encoding (rfc 2616, sec 3.6) + } else if (bodyLength > 0) { // we have a Content-Length + bytes += transferRaw(socket, out, bodyLength - contentRead); + if (contentRead + bytes == bodyLength) + state = AllDoneState; + } else { + bytes += transferRaw(socket, out, socket->bytesAvailable()); + } + if (state == AllDoneState) + socket->readAll(); // Read the rest to clean (CRLF) + contentRead += bytes; + return bytes; +} + +qint64 QHttpNetworkReplyPrivate::transferRaw(QIODevice *in, QIODevice *out, qint64 size) +{ + qint64 bytes = 0; + Q_ASSERT(in); + Q_ASSERT(out); + + int toBeRead = qMin<qint64>(128*1024, qMin<qint64>(size, in->bytesAvailable())); + QByteArray raw(toBeRead, 0); + while (size > 0) { + qint64 read = in->read(raw.data(), raw.size()); + if (read == 0) + return bytes; + // ### error checking here + qint64 written = out->write(raw.data(), read); + if (written == 0) + return bytes; + if (read != written) + qDebug() << "### read" << read << "written" << written; + bytes += read; + size -= read; + out->waitForBytesWritten(-1); // throttle + } + return bytes; + +} + +qint64 QHttpNetworkReplyPrivate::transferChunked(QIODevice *in, QIODevice *out) +{ + qint64 bytes = 0; + while (in->bytesAvailable()) { // while we can read from input + // if we are done with the current chunk, get the size of the new chunk + if (currentChunkRead >= currentChunkSize) { + currentChunkSize = 0; + currentChunkRead = 0; + if (bytes) { + char crlf[2]; + bytes += in->read(crlf, 2); // read the "\r\n" after the chunk + } + bytes += getChunkSize(in, ¤tChunkSize); + if (currentChunkSize == -1) + break; + } + // if the chunk size is 0, end of the stream + if (currentChunkSize == 0) { + state = AllDoneState; + break; + } + // otherwise, read data + qint64 readSize = qMin(in->bytesAvailable(), currentChunkSize - currentChunkRead); + QByteArray buffer(readSize, 0); + qint64 read = in->read(buffer.data(), readSize); + bytes += read; + currentChunkRead += read; + qint64 written = out->write(buffer); + Q_UNUSED(written); // Avoid compile warning when building release + Q_ASSERT(read == written); + // ### error checking here + out->waitForBytesWritten(-1); + } + return bytes; +} + +qint64 QHttpNetworkReplyPrivate::getChunkSize(QIODevice *in, qint64 *chunkSize) +{ + qint64 bytes = 0; + char crlf[2]; + *chunkSize = -1; + int bytesAvailable = in->bytesAvailable(); + while (bytesAvailable > bytes) { + qint64 sniffedBytes = in->peek(crlf, 2); + int fragmentSize = fragment.size(); + // check the next two bytes for a "\r\n", skip blank lines + if ((fragmentSize && sniffedBytes == 2 && crlf[0] == '\r' && crlf[1] == '\n') + ||(fragmentSize > 1 && fragment.endsWith('\r') && crlf[0] == '\n')) + { + bytes += in->read(crlf, 1); // read the \r or \n + if (crlf[0] == '\r') + bytes += in->read(crlf, 1); // read the \n + bool ok = false; + // ignore the chunk-extension + fragment = fragment.mid(0, fragment.indexOf(';')).trimmed(); + *chunkSize = fragment.toLong(&ok, 16); + fragment.clear(); + break; // size done + } else { + // read the fragment to the buffer + char c = 0; + bytes += in->read(&c, 1); + fragment.append(c); + } + } + return bytes; +} + +// SSL support below +#ifndef QT_NO_OPENSSL + +QSslConfiguration QHttpNetworkReply::sslConfiguration() const +{ + Q_D(const QHttpNetworkReply); + if (d->connection) + return d->connection->d_func()->sslConfiguration(*this); + return QSslConfiguration(); +} + +void QHttpNetworkReply::setSslConfiguration(const QSslConfiguration &config) +{ + Q_D(QHttpNetworkReply); + if (d->connection) + d->connection->setSslConfiguration(config); +} + +void QHttpNetworkReply::ignoreSslErrors() +{ + Q_D(QHttpNetworkReply); + if (d->connection) + d->connection->ignoreSslErrors(); +} + + +#endif //QT_NO_OPENSSL + + +QT_END_NAMESPACE + +#endif // QT_NO_HTTP
\ No newline at end of file diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h new file mode 100644 index 0000000..c17c65c --- /dev/null +++ b/src/network/access/qhttpnetworkreply_p.h @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHTTPNETWORKREPLY_H +#define QHTTPNETWORKREPLY_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. +// +#ifndef QT_NO_HTTP + +#ifndef QT_NO_COMPRESS +# include <zlib.h> +static const unsigned char gz_magic[2] = {0x1f, 0x8b}; // gzip magic header +// gzip flag byte +#define HEAD_CRC 0x02 // bit 1 set: header CRC present +#define EXTRA_FIELD 0x04 // bit 2 set: extra field present +#define ORIG_NAME 0x08 // bit 3 set: original file name present +#define COMMENT 0x10 // bit 4 set: file comment present +#define RESERVED 0xE0 // bits 5..7: reserved +#define CHUNK 16384 +#endif + +#include <QtNetwork/qtcpsocket.h> +// it's safe to include these even if SSL support is not enabled +#include <QtNetwork/qsslsocket.h> +#include <QtNetwork/qsslerror.h> + +#include <QtNetwork/qnetworkrequest.h> +#include <QtNetwork/qnetworkreply.h> +#include <qbuffer.h> + +#include <private/qobject_p.h> +#include <private/qhttpnetworkheader_p.h> +#include <private/qhttpnetworkrequest_p.h> +#include <private/qauthenticator_p.h> + +QT_BEGIN_NAMESPACE + +class QHttpNetworkConnection; +class QHttpNetworkRequest; +class QHttpNetworkConnectionPrivate; +class QHttpNetworkReplyPrivate; +class Q_AUTOTEST_EXPORT QHttpNetworkReply : public QObject, public QHttpNetworkHeader +{ + Q_OBJECT +public: + + explicit QHttpNetworkReply(const QUrl &url = QUrl(), QObject *parent = 0); + virtual ~QHttpNetworkReply(); + + QUrl url() const; + void setUrl(const QUrl &url); + + int majorVersion() const; + int minorVersion() const; + + qint64 contentLength() const; + void setContentLength(qint64 length); + + QList<QPair<QByteArray, QByteArray> > header() const; + QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const; + void setHeaderField(const QByteArray &name, const QByteArray &data); + void parseHeader(const QByteArray &header); // mainly for testing + + QHttpNetworkRequest request() const; + void setRequest(const QHttpNetworkRequest &request); + + int statusCode() const; + void setStatusCode(int code); + + QString errorString() const; + void setErrorString(const QString &error); + + QString reasonPhrase() const; + + qint64 bytesAvailable() const; + QByteArray read(qint64 maxSize = -1); + + bool isFinished() const; + +#ifndef QT_NO_OPENSSL + QSslConfiguration sslConfiguration() const; + void setSslConfiguration(const QSslConfiguration &config); + void ignoreSslErrors(); + +Q_SIGNALS: + void sslErrors(const QList<QSslError> &errors); +#endif + +Q_SIGNALS: + void readyRead(); + void finished(); + void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail = QString()); + void headerChanged(); + void dataReadProgress(int done, int total); + void dataSendProgress(int done, int total); + +private: + Q_DECLARE_PRIVATE(QHttpNetworkReply) + friend class QHttpNetworkConnection; + friend class QHttpNetworkConnectionPrivate; +}; + + +class QHttpNetworkReplyPrivate : public QObjectPrivate, public QHttpNetworkHeaderPrivate +{ +public: + QHttpNetworkReplyPrivate(const QUrl &newUrl = QUrl()); + ~QHttpNetworkReplyPrivate(); + qint64 readStatus(QAbstractSocket *socket); + void parseStatus(const QByteArray &status); + qint64 readHeader(QAbstractSocket *socket); + void parseHeader(const QByteArray &header); + qint64 readBody(QAbstractSocket *socket, QIODevice *out); + bool findChallenge(bool forProxy, QByteArray &challenge) const; + QAuthenticatorPrivate::Method authenticationMethod(bool isProxy) const; + void clear(); + + qint64 transferRaw(QIODevice *in, QIODevice *out, qint64 size); + qint64 transferChunked(QIODevice *in, QIODevice *out); + qint64 getChunkSize(QIODevice *in, qint64 *chunkSize); + + qint64 bytesAvailable() const; + bool isChunked(); + bool connectionCloseEnabled(); + bool isGzipped(); +#ifndef QT_NO_COMPRESS + bool gzipCheckHeader(QByteArray &content, int &pos); + int gunzipBodyPartially(QByteArray &compressed, QByteArray &inflated); +#endif + void removeAutoDecompressHeader(); + + enum ReplyState { + NothingDoneState, + ReadingStatusState, + ReadingHeaderState, + ReadingDataState, + AllDoneState + } state; + + QHttpNetworkRequest request; + int statusCode; + int majorVersion; + int minorVersion; + QString errorString; + QString reasonPhrase; + qint64 bodyLength; + qint64 contentRead; + qint64 totalProgress; + QByteArray fragment; + qint64 currentChunkSize; + qint64 currentChunkRead; + QPointer<QHttpNetworkConnection> connection; + bool initInflate; + bool streamEnd; +#ifndef QT_NO_COMPRESS + z_stream inflateStrm; +#endif + bool autoDecompress; + + QByteArray responseData; // uncompressed body + QByteArray compressedData; // compressed body (temporary) + QBuffer requestDataBuffer; + bool requestIsBuffering; + bool requestIsPrepared; +}; + + + + +QT_END_NAMESPACE + +//Q_DECLARE_METATYPE(QHttpNetworkReply) + +#endif // QT_NO_HTTP + + +#endif // QHTTPNETWORKREPLY_H diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp new file mode 100644 index 0000000..420cb69 --- /dev/null +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -0,0 +1,261 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhttpnetworkrequest_p.h" + +QT_BEGIN_NAMESPACE + +QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, + QHttpNetworkRequest::Priority pri, const QUrl &newUrl) + : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), data(0), + autoDecompress(false) +{ +} + +QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequestPrivate &other) + : QHttpNetworkHeaderPrivate(other) +{ + operation = other.operation; + priority = other.priority; + data = other.data; + autoDecompress = other.autoDecompress; +} + +QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate() +{ +} + +bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &other) const +{ + return QHttpNetworkHeaderPrivate::operator==(other) + && (operation == other.operation) + && (data == other.data); +} + +QByteArray QHttpNetworkRequestPrivate::methodName() const +{ + QByteArray ba; + switch (operation) { + case QHttpNetworkRequest::Options: + ba += "OPTIONS"; + break; + case QHttpNetworkRequest::Get: + ba += "GET"; + break; + case QHttpNetworkRequest::Head: + ba += "HEAD"; + break; + case QHttpNetworkRequest::Post: + ba += "POST"; + break; + case QHttpNetworkRequest::Put: + ba += "PUT"; + break; + case QHttpNetworkRequest::Delete: + ba += "DELETE"; + break; + case QHttpNetworkRequest::Trace: + ba += "TRACE"; + break; + case QHttpNetworkRequest::Connect: + ba += "CONNECT"; + break; + default: + break; + } + return ba; +} + +QByteArray QHttpNetworkRequestPrivate::uri(bool throughProxy) const +{ + QUrl::FormattingOptions format(QUrl::RemoveFragment); + + // for POST, query data is send as content + if (operation == QHttpNetworkRequest::Post && !data) + format |= QUrl::RemoveQuery; + // for requests through proxy, the Request-URI contains full url + if (throughProxy) + format |= QUrl::RemoveUserInfo; + else + format |= QUrl::RemoveScheme | QUrl::RemoveAuthority; + QByteArray uri = url.toEncoded(format); + if (uri.isEmpty() || (throughProxy && url.path().isEmpty())) + uri += '/'; + return uri; +} + +QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request, bool throughProxy) +{ + QByteArray ba = request.d->methodName(); + QByteArray uri = request.d->uri(throughProxy); + ba += " " + uri; + + QString majorVersion = QString::number(request.majorVersion()); + QString minorVersion = QString::number(request.minorVersion()); + ba += " HTTP/" + majorVersion.toLatin1() + "." + minorVersion.toLatin1() + "\r\n"; + + QList<QPair<QByteArray, QByteArray> > fields = request.header(); + QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin(); + for (; it != fields.constEnd(); ++it) + ba += it->first + ": " + it->second + "\r\n"; + if (request.d->operation == QHttpNetworkRequest::Post) { + // add content type, if not set in the request + if (request.headerField("content-type").isEmpty()) + ba += "Content-Type: application/x-www-form-urlencoded\r\n"; + if (!request.d->data && request.d->url.hasQuery()) { + QByteArray query = request.d->url.encodedQuery(); + ba += "Content-Length: "+ QByteArray::number(query.size()) + "\r\n"; + ba += "\r\n"; + ba += query; + } else { + ba += "\r\n"; + } + } else { + ba += "\r\n"; + } + return ba; +} + + +// QHttpNetworkRequest + +QHttpNetworkRequest::QHttpNetworkRequest(const QUrl &url, Operation operation, Priority priority) + : d(new QHttpNetworkRequestPrivate(operation, priority, url)) +{ +} + +QHttpNetworkRequest::QHttpNetworkRequest(const QHttpNetworkRequest &other) + : QHttpNetworkHeader(other), d(other.d) +{ +} + +QHttpNetworkRequest::~QHttpNetworkRequest() +{ +} + +QUrl QHttpNetworkRequest::url() const +{ + return d->url; +} +void QHttpNetworkRequest::setUrl(const QUrl &url) +{ + d->url = url; +} + +qint64 QHttpNetworkRequest::contentLength() const +{ + return d->contentLength(); +} + +void QHttpNetworkRequest::setContentLength(qint64 length) +{ + d->setContentLength(length); +} + +QList<QPair<QByteArray, QByteArray> > QHttpNetworkRequest::header() const +{ + return d->fields; +} + +QByteArray QHttpNetworkRequest::headerField(const QByteArray &name, const QByteArray &defaultValue) const +{ + return d->headerField(name, defaultValue); +} + +void QHttpNetworkRequest::setHeaderField(const QByteArray &name, const QByteArray &data) +{ + d->setHeaderField(name, data); +} + +QHttpNetworkRequest &QHttpNetworkRequest::operator=(const QHttpNetworkRequest &other) +{ + d = other.d; + return *this; +} + +bool QHttpNetworkRequest::operator==(const QHttpNetworkRequest &other) const +{ + return d->operator==(*other.d); +} + +QHttpNetworkRequest::Operation QHttpNetworkRequest::operation() const +{ + return d->operation; +} + +void QHttpNetworkRequest::setOperation(Operation operation) +{ + d->operation = operation; +} + +QHttpNetworkRequest::Priority QHttpNetworkRequest::priority() const +{ + return d->priority; +} + +void QHttpNetworkRequest::setPriority(Priority priority) +{ + d->priority = priority; +} + +QIODevice *QHttpNetworkRequest::data() const +{ + return d->data; +} + +void QHttpNetworkRequest::setData(QIODevice *data) +{ + d->data = data; +} + +int QHttpNetworkRequest::majorVersion() const +{ + return 1; +} + +int QHttpNetworkRequest::minorVersion() const +{ + return 1; +} + + +QT_END_NAMESPACE + diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h new file mode 100644 index 0000000..d18e116 --- /dev/null +++ b/src/network/access/qhttpnetworkrequest_p.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHTTPNETWORKREQUEST_H +#define QHTTPNETWORKREQUEST_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. +// +#ifndef QT_NO_HTTP + +#include <private/qhttpnetworkheader_p.h> + +QT_BEGIN_NAMESPACE + +class QHttpNetworkRequestPrivate; +class Q_AUTOTEST_EXPORT QHttpNetworkRequest: public QHttpNetworkHeader +{ +public: + enum Operation { + Options, + Get, + Head, + Post, + Put, + Delete, + Trace, + Connect + }; + + enum Priority { + HighPriority, + NormalPriority, + LowPriority + }; + + QHttpNetworkRequest(const QUrl &url = QUrl(), Operation operation = Get, Priority priority = NormalPriority); + QHttpNetworkRequest(const QHttpNetworkRequest &other); + virtual ~QHttpNetworkRequest(); + QHttpNetworkRequest &operator=(const QHttpNetworkRequest &other); + bool operator==(const QHttpNetworkRequest &other) const; + + QUrl url() const; + void setUrl(const QUrl &url); + + int majorVersion() const; + int minorVersion() const; + + qint64 contentLength() const; + void setContentLength(qint64 length); + + QList<QPair<QByteArray, QByteArray> > header() const; + QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const; + void setHeaderField(const QByteArray &name, const QByteArray &data); + + Operation operation() const; + void setOperation(Operation operation); + + Priority priority() const; + void setPriority(Priority priority); + + QIODevice *data() const; + void setData(QIODevice *data); + +private: + QSharedDataPointer<QHttpNetworkRequestPrivate> d; + friend class QHttpNetworkRequestPrivate; + friend class QHttpNetworkConnectionPrivate; +}; + + +class QHttpNetworkRequestPrivate : public QHttpNetworkHeaderPrivate +{ +public: + QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, + QHttpNetworkRequest::Priority pri, const QUrl &newUrl = QUrl()); + QHttpNetworkRequestPrivate(const QHttpNetworkRequestPrivate &other); + ~QHttpNetworkRequestPrivate(); + bool operator==(const QHttpNetworkRequestPrivate &other) const; + QByteArray methodName() const; + QByteArray uri(bool throughProxy) const; + + static QByteArray header(const QHttpNetworkRequest &request, bool throughProxy); + + QHttpNetworkRequest::Operation operation; + QHttpNetworkRequest::Priority priority; + mutable QIODevice *data; + bool autoDecompress; +}; + + +QT_END_NAMESPACE + +//Q_DECLARE_METATYPE(QHttpNetworkRequest) + +#endif // QT_NO_HTTP + + +#endif // QHTTPNETWORKREQUEST_H diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 4b41aa7..a52b5a0 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -527,8 +527,10 @@ void QNetworkAccessHttpBackend::postRequest() foreach (const QByteArray &header, headers) httpRequest.setHeaderField(header, request().rawHeader(header)); - if (loadedFromCache) + if (loadedFromCache) { + QNetworkAccessBackend::finished(); return; // no need to send the request! :) + } httpReply = http->sendRequest(httpRequest); httpReply->setParent(this); @@ -767,8 +769,12 @@ void QNetworkAccessHttpBackend::replyHeaderChanged() for (; it != end; ++it) { QByteArray value = rawHeader(it->first); - if (!value.isEmpty()) - value += ", "; + if (!value.isEmpty()) { + if (it->first.toLower() == "set-cookie") + value += "\n"; + else + value += ", "; + } value += it->second; setRawHeader(it->first, value); } @@ -886,8 +892,6 @@ bool QNetworkAccessHttpBackend::sendCacheContents(const QNetworkCacheMetaData &m if (status < 100) status = 200; // fake it - checkForRedirect(status); - setAttribute(QNetworkRequest::HttpStatusCodeAttribute, status); setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute)); setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true); @@ -898,6 +902,8 @@ bool QNetworkAccessHttpBackend::sendCacheContents(const QNetworkCacheMetaData &m for ( ; it != end; ++it) setRawHeader(it->first, it->second); + checkForRedirect(status); + writeDownstreamData(contents); #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) qDebug() << "Successfully sent cache:" << url() << contents->size() << "bytes"; @@ -951,6 +957,7 @@ QNetworkCacheMetaData QNetworkAccessHttpBackend::fetchCacheMetaData(const QNetwo QList<QByteArray> newHeaders = rawHeaderList(); foreach (QByteArray header, newHeaders) { + QByteArray originalHeader = header; header = header.toLower(); bool hop_by_hop = (header == "connection" @@ -974,19 +981,32 @@ QNetworkCacheMetaData QNetworkAccessHttpBackend::fetchCacheMetaData(const QNetwo continue; } + it = cacheHeaders.findRawHeader(header); + if (it != cacheHeaders.rawHeaders.constEnd()) { + // Match the behavior of Firefox and assume Cache-Control: "no-transform" + if (header == "content-encoding" + || header == "content-range" + || header == "content-type") + continue; + + // For MS servers that send "Content-Length: 0" on 304 responses + // ignore this too + if (header == "content-length") + continue; + } + #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) QByteArray n = rawHeader(header); QByteArray o; - it = cacheHeaders.findRawHeader(header); if (it != cacheHeaders.rawHeaders.constEnd()) o = (*it).second; - if (n != o && header != "Date") { + if (n != o && header != "date") { qDebug() << "replacing" << header; qDebug() << "new" << n; qDebug() << "old" << o; } #endif - cacheHeaders.setRawHeader(header, rawHeader(header)); + cacheHeaders.setRawHeader(originalHeader, rawHeader(header)); } metaData.setRawHeaders(cacheHeaders.rawHeaders); diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 1235960..01a743b 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -49,6 +49,7 @@ #include "QtCore/qlist.h" #include "QtCore/qlocale.h" #include "QtCore/qstring.h" +#include "QtCore/qstringlist.h" #include "QtCore/qurl.h" #include "private/qobject_p.h" @@ -163,7 +164,7 @@ bool QNetworkCookie::operator==(const QNetworkCookie &other) const return true; return d->name == other.d->name && d->value == other.d->value && - d->expirationDate == other.d->expirationDate && + d->expirationDate.toUTC() == other.d->expirationDate.toUTC() && d->domain == other.d->domain && d->path == other.d->path && d->secure == other.d->secure && @@ -513,6 +514,392 @@ QByteArray QNetworkCookie::toRawForm(RawForm form) const return result; } +static const char zones[] = + "pst\0" // -8 + "pdt\0" + "mst\0" // -7 + "mdt\0" + "cst\0" // -6 + "cdt\0" + "est\0" // -5 + "edt\0" + "ast\0" // -4 + "nst\0" // -3 + "gmt\0" // 0 + "utc\0" + "bst\0" + "met\0" // 1 + "eet\0" // 2 + "jst\0" // 9 + "\0"; +static int zoneOffsets[] = {-8, -8, -7, -7, -6, -6, -5, -5, -4, -3, 0, 0, 0, 1, 2, 9 }; + +static const char months[] = + "jan\0" + "feb\0" + "mar\0" + "apr\0" + "may\0" + "jun\0" + "jul\0" + "aug\0" + "sep\0" + "oct\0" + "nov\0" + "dec\0" + "\0"; + +static inline bool isNumber(char s) +{ return s >= '0' && s <= '9'; } + +static inline bool isTerminator(char c) +{ return c == '\n' || c == '\r'; } + +static inline bool isValueSeparator(char c) +{ return isTerminator(c) || c == ';'; } + +static inline bool isWhitespace(char c) +{ return c == ' ' || c == '\t'; } + +static bool checkStaticArray(int &val, const QByteArray &dateString, int at, const char *array, int size) +{ + if (dateString[at] < 'a' || dateString[at] > 'z') + return false; + if (val == -1 && dateString.length() >= at + 3) { + int j = 0; + int i = 0; + while (i <= size) { + const char *str = array + i; + if (str[0] == dateString[at] + && str[1] == dateString[at + 1] + && str[2] == dateString[at + 2]) { + val = j; + return true; + } + i += strlen(str) + 1; + ++j; + } + } + return false; +} + +//#define PARSEDATESTRINGDEBUG + +#define ADAY 1 +#define AMONTH 2 +#define AYEAR 4 + +/* + Parse all the date formats that Firefox can. + + The official format is: + expires=ddd(d)?, dd-MMM-yyyy hh:mm:ss GMT + + But browsers have been supporting a very wide range of date + strings. To work on many sites we need to support more then + just the official date format. + + For reference see Firefox's PR_ParseTimeStringToExplodedTime in + prtime.c. The Firefox date parser is coded in a very complex way + and is slightly over ~700 lines long. While this implementation + will be slightly slower for the non standard dates it is smaller, + more readable, and maintainable. + + Or in their own words: + "} // else what the hell is this." +*/ +static QDateTime parseDateString(const QByteArray &dateString) +{ + QTime time; + // placeholders for values when we are not sure it is a year, month or day + int unknown[3] = {-1, -1, -1}; + int month = -1; + int day = -1; + int year = -1; + int zoneOffset = -1; + + // hour:minute:second.ms pm + QRegExp timeRx(QLatin1String("(\\d{1,2}):(\\d{1,2})(:(\\d{1,2})|)(\\.(\\d{1,3})|)((\\s{0,}(am|pm))|)")); + + int at = 0; + while (at < dateString.length()) { +#ifdef PARSEDATESTRINGDEBUG + qDebug() << dateString.mid(at); +#endif + bool isNum = isNumber(dateString[at]); + + // Month + if (!isNum + && checkStaticArray(month, dateString, at, months, sizeof(months)- 1)) { + ++month; +#ifdef PARSEDATESTRINGDEBUG + qDebug() << "Month:" << month; +#endif + at += 3; + continue; + } + // Zone + if (!isNum + && zoneOffset == -1 + && checkStaticArray(zoneOffset, dateString, at, zones, sizeof(zones)- 1)) { + int sign = (at >= 0 && dateString[at - 1] == '-') ? -1 : 1; + zoneOffset = sign * zoneOffsets[zoneOffset] * 60 * 60; +#ifdef PARSEDATESTRINGDEBUG + qDebug() << "Zone:" << month; +#endif + at += 3; + continue; + } + // Zone offset + if (!isNum + && (zoneOffset == -1 || zoneOffset == 0) // Can only go after gmt + && (dateString[at] == '+' || dateString[at] == '-') + && (at == 0 + || isWhitespace(dateString[at - 1]) + || dateString[at - 1] == ',' + || (at >= 3 + && (dateString[at - 3] == 'g') + && (dateString[at - 2] == 'm') + && (dateString[at - 1] == 't')))) { + + int end = 1; + while (end < 5 && dateString.length() > at+end + && dateString[at + end] >= '0' && dateString[at + end] <= '9') + ++end; + int minutes = 0; + int hours = 0; + switch (end - 1) { + case 4: + minutes = atoi(dateString.mid(at + 3, 2).constData()); + // fall through + case 2: + hours = atoi(dateString.mid(at + 1, 2).constData()); + break; + case 1: + hours = atoi(dateString.mid(at + 1, 1).constData()); + break; + default: + at += end; + continue; + } + if (end != 1) { + int sign = dateString[at] == '-' ? -1 : 1; + zoneOffset = sign * ((minutes * 60) + (hours * 60 * 60)); +#ifdef PARSEDATESTRINGDEBUG + qDebug() << "Zone offset:" << zoneOffset << hours << minutes; +#endif + at += end; + continue; + } + } + + // Time + if (isNum && time.isNull() + && dateString.length() >= at + 3 + && (dateString[at + 2] == ':' || dateString[at + 1] == ':')) { + // While the date can be found all over the string the format + // for the time is set and a nice regexp can be used. + int pos = timeRx.indexIn(QLatin1String(dateString), at); + if (pos != -1) { + QStringList list = timeRx.capturedTexts(); + int h = atoi(list.at(1).toLatin1().constData()); + int m = atoi(list.at(2).toLatin1().constData()); + int s = atoi(list.at(4).toLatin1().constData()); + int ms = atoi(list.at(6).toLatin1().constData()); + if (h < 12 && !list.at(9).isEmpty()) + if (list.at(9) == QLatin1String("pm")) + h += 12; + time = QTime(h, m, s, ms); +#ifdef PARSEDATESTRINGDEBUG + qDebug() << "Time:" << list << timeRx.matchedLength(); +#endif + at += timeRx.matchedLength(); + continue; + } + } + + // 4 digit Year + if (isNum + && year == -1 + && dateString.length() >= at + 3) { + if (isNumber(dateString[at + 1]) + && isNumber(dateString[at + 2]) + && isNumber(dateString[at + 3])) { + year = atoi(dateString.mid(at, 4).constData()); + at += 4; +#ifdef PARSEDATESTRINGDEBUG + qDebug() << "Year:" << year; +#endif + continue; + } + } + + // a one or two digit number + // Could be month, day or year + if (isNum) { + int length = 1; + if (dateString.length() > at + 1 + && isNumber(dateString[at + 1])) + ++length; + int x = atoi(dateString.mid(at, length).constData()); + if (year == -1 && (x > 31 || x == 0)) { + year = x; + } else { + if (unknown[0] == -1) unknown[0] = x; + else if (unknown[1] == -1) unknown[1] = x; + else if (unknown[2] == -1) unknown[2] = x; + } + at += length; +#ifdef PARSEDATESTRINGDEBUG + qDebug() << "Saving" << x; +#endif + continue; + } + + // Unknown character, typically a weekday such as 'Mon' + ++at; + } + + // Once we are done parsing the string take the digits in unknown + // and determine which is the unknown year/month/day + + int couldBe[3] = { 0, 0, 0 }; + int unknownCount = 3; + for (int i = 0; i < unknownCount; ++i) { + if (unknown[i] == -1) { + couldBe[i] = ADAY | AYEAR | AMONTH; + unknownCount = i; + continue; + } + + if (unknown[i] >= 1) + couldBe[i] = ADAY; + + if (month == -1 && unknown[i] >= 1 && unknown[i] <= 12) + couldBe[i] |= AMONTH; + + if (year == -1) + couldBe[i] |= AYEAR; + } + + // For any possible day make sure one of the values that could be a month + // can contain that day. + // For any possible month make sure one of the values that can be a + // day that month can have. + // Example: 31 11 06 + // 31 can't be a day because 11 and 6 don't have 31 days + for (int i = 0; i < unknownCount; ++i) { + int currentValue = unknown[i]; + bool findMatchingMonth = couldBe[i] & ADAY && currentValue >= 29; + bool findMatchingDay = couldBe[i] & AMONTH; + if (!findMatchingMonth || !findMatchingDay) + continue; + for (int j = 0; j < 3; ++j) { + if (j == i) + continue; + for (int k = 0; k < 2; ++k) { + if (k == 0 && !(findMatchingMonth && (couldBe[j] & AMONTH))) + continue; + else if (k == 1 && !(findMatchingDay && (couldBe[j] & ADAY))) + continue; + int m = currentValue; + int d = unknown[j]; + if (k == 0) + qSwap(m, d); + if (m == -1) m = month; + bool found = true; + switch(m) { + case 2: + // When we get 29 and the year ends up having only 28 + // See date.isValid below + // Example: 29 23 Feb + if (d <= 29) + found = false; + break; + case 4: case 6: case 9: case 11: + if (d <= 30) + found = false; + break; + default: + if (d > 0 && d <= 31) + found = false; + } + if (k == 0) findMatchingMonth = found; + else if (k == 1) findMatchingDay = found; + } + } + if (findMatchingMonth) + couldBe[i] &= ~ADAY; + if (findMatchingDay) + couldBe[i] &= ~AMONTH; + } + + // First set the year/month/day that have been deduced + // and reduce the set as we go along to deduce more + for (int i = 0; i < unknownCount; ++i) { + int unset = 0; + for (int j = 0; j < 3; ++j) { + if (couldBe[j] == ADAY && day == -1) { + day = unknown[j]; + unset |= ADAY; + } else if (couldBe[j] == AMONTH && month == -1) { + month = unknown[j]; + unset |= AMONTH; + } else if (couldBe[j] == AYEAR && year == -1) { + year = unknown[j]; + unset |= AYEAR; + } else { + // common case + break; + } + couldBe[j] &= ~unset; + } + } + + // Now fallback to a standardized order to fill in the rest with + for (int i = 0; i < unknownCount; ++i) { + if (couldBe[i] & AMONTH && month == -1) month = unknown[i]; + else if (couldBe[i] & ADAY && day == -1) day = unknown[i]; + else if (couldBe[i] & AYEAR && year == -1) year = unknown[i]; + } +#ifdef PARSEDATESTRINGDEBUG + qDebug() << "Final set" << year << month << day; +#endif + + if (year == -1 || month == -1 || day == -1) { +#ifdef PARSEDATESTRINGDEBUG + qDebug() << "Parser failure" << year << month << day; +#endif + return QDateTime(); + } + + // Y2k behavior + int y2k = 0; + if (year < 70) + y2k = 2000; + else if (year < 100) + y2k = 1900; + + QDate date(year + y2k, month, day); + + // When we were given a bad cookie that when parsed + // set the day to 29 and the year to one that doesn't + // have the 29th of Feb rather then adding the extra + // complicated checking earlier just swap here. + // Example: 29 23 Feb + if (!date.isValid()) + date = QDate(day + y2k, month, year); + + QDateTime dateTime(date, time, Qt::UTC); + + if (zoneOffset != -1) { + dateTime = dateTime.addSecs(zoneOffset); + } + if (!dateTime.isValid()) + return QDateTime(); + return dateTime; +} + /*! Parses the cookie string \a cookieString as received from a server response in the "Set-Cookie:" header. If there's a parsing error, @@ -543,17 +930,23 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin while (position < length) { QNetworkCookie cookie; + // When there are multiple SetCookie headers they are join with a new line + // \n will always be the start of a new cookie + int endOfSetCookie = cookieString.indexOf('\n', position); + if (endOfSetCookie == -1) + endOfSetCookie = length; + // The first part is always the "NAME=VALUE" part QPair<QByteArray,QByteArray> field = nextField(cookieString, position); if (field.first.isEmpty() || field.second.isNull()) // parsing error - return QList<QNetworkCookie>(); + break; cookie.setName(field.first); cookie.setValue(field.second); position = nextNonWhitespace(cookieString, position); bool endOfCookie = false; - while (!endOfCookie && position < length) + while (!endOfCookie && position < endOfSetCookie) switch (cookieString.at(position++)) { case ',': // end of the cookie @@ -566,64 +959,20 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin field.first = field.first.toLower(); // everything but the NAME=VALUE is case-insensitive if (field.first == "expires") { - static const char dateFormats[] = - "d-MMM-yyyy hh:mm:ss\0" - "d MMM yyyy hh:mm:ss\0" - "d-MMM-yy hh:mm:ss\0" - "\0"; - - // expires is a special case because it contains a naked comma - // and naked spaces. The format is: - // expires=ddd(d)?, dd-MMM-yyyy hh:mm:ss GMT - // but we also accept standard HTTP dates - - // make sure we're at the comma - if (position >= length || cookieString.at(position) != ',') - // invalid cookie string - return QList<QNetworkCookie>(); - - ++position; + position -= field.second.length(); int end; for (end = position; end < length; ++end) - if (cookieString.at(end) == ',' || cookieString.at(end) == ';') + if (isValueSeparator(cookieString.at(end))) break; - QByteArray datestring = cookieString.mid(position, end - position).trimmed(); + QByteArray dateString = cookieString.mid(position, end - position).trimmed(); position = end; - if (datestring.endsWith(" GMT") || datestring.endsWith(" UTC")) - datestring.chop(4); - else if (datestring.endsWith(" +0000")) - datestring.chop(6); - - size_t i = 0; - int j = 0; - QLocale cLocale = QLocale::c(); - QDateTime dt; - do { - QLatin1String df(dateFormats + i); - i += strlen(dateFormats + i) + 1; - -#ifndef QT_NO_DATESTRING - dt = cLocale.toDateTime(QString::fromLatin1(datestring), df); - - // some cookies are set with a two-digit year - // (although this is not allowed); this is interpreted as a year - // in the 20th century by QDateTime. - // Work around this case here (assuming 00-69 is 21st century, - // 70-99 is 20th century) - QDate date = dt.date(); - if (j == 2 && date.year() >= 1900 && date.year() < 1970) - dt = dt.addYears(100); - if (date.year() >= 0 && date.year() < 100) - dt = dt.addYears(1900); -#endif - j++; - } while (!dt.isValid() && i <= sizeof dateFormats - 1); - if (!dt.isValid()) - // invalid cookie string - return QList<QNetworkCookie>(); - - dt.setTimeSpec(Qt::UTC); + QDateTime dt = parseDateString(dateString.toLower()); + if (!dt.isValid()) { + cookie = QNetworkCookie(); + endOfCookie = true; + continue; + } cookie.setExpirationDate(dt); } else if (field.first == "domain") { QByteArray rawDomain = field.second; @@ -664,9 +1013,12 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin } position = nextNonWhitespace(cookieString, position); + if (position > endOfSetCookie) + endOfCookie = true; } - result += cookie; + if (!cookie.name().isEmpty()) + result += cookie; } return result; diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index fa0fccb..93360c8 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -253,7 +253,8 @@ void QNetworkDiskCachePrivate::storeItem(QCacheItem *cacheItem) // ### use atomic rename rather then remove & rename if (cacheItem->file->rename(fileName)) currentCacheSize += cacheItem->file->size(); - cacheItem->file->setAutoRemove(true); + else + cacheItem->file->setAutoRemove(true); } if (cacheItem->metaData.url() == lastItem.metaData.url()) lastItem.reset(); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index eaa572f..79c3d1a 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -131,27 +131,37 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() if (!copyDevice && !q->isOpen()) return; - qint64 bytesToRead = nextDownstreamBlockSize(); - if (bytesToRead == 0) - // we'll be called again, eventually - return; + forever { + qint64 bytesToRead = nextDownstreamBlockSize(); + if (bytesToRead == 0) + // we'll be called again, eventually + break; - bytesToRead = qBound<qint64>(1, bytesToRead, copyDevice->bytesAvailable()); - char *ptr = readBuffer.reserve(bytesToRead); - qint64 bytesActuallyRead = copyDevice->read(ptr, bytesToRead); - if (bytesActuallyRead == -1) { - readBuffer.chop(bytesToRead); - backendNotify(NotifyCopyFinished); - return; - } + bytesToRead = qBound<qint64>(1, bytesToRead, copyDevice->bytesAvailable()); + char *ptr = readBuffer.reserve(bytesToRead); + qint64 bytesActuallyRead = copyDevice->read(ptr, bytesToRead); + if (bytesActuallyRead == -1) { + readBuffer.chop(bytesToRead); + backendNotify(NotifyCopyFinished); + return; + } - if (bytesActuallyRead != bytesToRead) - readBuffer.chop(bytesToRead - bytesActuallyRead); + if (bytesActuallyRead != bytesToRead) + readBuffer.chop(bytesToRead - bytesActuallyRead); - if (!copyDevice->isSequential() && copyDevice->atEnd()) - backendNotify(NotifyCopyFinished); + if (!copyDevice->isSequential() && copyDevice->atEnd()) { + backendNotify(NotifyCopyFinished); + break; + } + + bytesDownloaded += bytesActuallyRead; + } + + if (bytesDownloaded == lastBytesDownloaded) { + // we didn't read anything + return; + } - bytesDownloaded += bytesActuallyRead; lastBytesDownloaded = bytesDownloaded; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); emit q->downloadProgress(bytesDownloaded, diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 4f477bd..c9161f8 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE -#include <../3rdparty/des/des.cpp> +#include "../../3rdparty/des/des.cpp" static QByteArray qNtlmPhase1(); static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phase2data); diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index fc43369..b225c17 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -435,7 +435,7 @@ void QNetmaskAddress::setPrefixLength(QAbstractSocket::NetworkLayerProtocol prot The class also supports common predefined addresses: \l Null, \l LocalHost, \l LocalHostIPv6, \l Broadcast, and \l Any. - \sa QTcpSocket, QTcpServer, QUdpSocket + \sa QHostInfo, QTcpSocket, QTcpServer, QUdpSocket */ /*! \enum QHostAddress::SpecialAddress diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h index b6d00ce..02a6f97 100644 --- a/src/network/kernel/qhostaddress.h +++ b/src/network/kernel/qhostaddress.h @@ -42,6 +42,7 @@ #ifndef QHOSTADDRESS_H #define QHOSTADDRESS_H +#include <QtCore/qpair.h> #include <QtCore/qstring.h> #include <QtNetwork/qabstractsocket.h> diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp index 9540c18..de97629 100644 --- a/src/network/kernel/qnetworkinterface_win.cpp +++ b/src/network/kernel/qnetworkinterface_win.cpp @@ -173,14 +173,14 @@ static QList<QNetworkInterfacePrivate *> interfaceListingWinXP() interfaces << iface; iface->index = 0; - if (ptr->Length >= offsetof(IP_ADAPTER_ADDRESSES, Ipv6IfIndex)) + if (ptr->Length >= offsetof(IP_ADAPTER_ADDRESSES, Ipv6IfIndex) && ptr->Ipv6IfIndex != 0) iface->index = ptr->Ipv6IfIndex; else if (ptr->IfIndex != 0) iface->index = ptr->IfIndex; iface->flags = QNetworkInterface::CanBroadcast; - if (ptr->OperStatus == IfOperStatusUp) - iface->flags |= QNetworkInterface::IsUp | QNetworkInterface::IsRunning; + if (ptr->OperStatus == IfOperStatusUp) + iface->flags |= QNetworkInterface::IsUp | QNetworkInterface::IsRunning; if ((ptr->Flags & IP_ADAPTER_NO_MULTICAST) == 0) iface->flags |= QNetworkInterface::CanMulticast; diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 31c2a33..16d18cf 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -102,6 +102,8 @@ typedef struct { #define WINHTTP_NO_PROXY_NAME NULL #define WINHTTP_NO_PROXY_BYPASS NULL +QT_BEGIN_NAMESPACE + typedef BOOL (WINAPI * PtrWinHttpGetProxyForUrl)(HINTERNET, LPCWSTR, WINHTTP_AUTOPROXY_OPTIONS*, WINHTTP_PROXY_INFO*); typedef HINTERNET (WINAPI * PtrWinHttpOpen)(LPCWSTR, DWORD, LPCWSTR, LPCWSTR,DWORD); typedef BOOL (WINAPI * PtrWinHttpGetDefaultProxyConfiguration)(WINHTTP_PROXY_INFO*); @@ -113,6 +115,7 @@ static PtrWinHttpGetDefaultProxyConfiguration ptrWinHttpGetDefaultProxyConfigura static PtrWinHttpGetIEProxyConfigForCurrentUser ptrWinHttpGetIEProxyConfigForCurrentUser = 0; static PtrWinHttpCloseHandle ptrWinHttpCloseHandle = 0; + static QStringList splitSpaceSemicolon(const QString &source) { QStringList list; @@ -407,4 +410,6 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro #endif +QT_END_NAMESPACE + #endif diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 910e30a..f9750f2 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1263,7 +1263,7 @@ void QAbstractSocket::connectToHostImplementation(const QString &hostName, quint (int) openMode); #endif - if (d->state == ConnectedState || d->state == ConnectingState) { + if (d->state == ConnectedState || d->state == ConnectingState || d->state == ClosingState) { qWarning("QAbstractSocket::connectToHost() called when already connecting/connected to \"%s\"", qPrintable(hostName)); return; } @@ -2279,7 +2279,7 @@ void QAbstractSocket::disconnectFromHostImplementation() emit delayedCloseFinished(); // compat signal #endif // only emit disconnected if we were connected before - if (previousState == ConnectedState || ClosingState) + if (previousState == ConnectedState || previousState == ClosingState) emit disconnected(); d->localPort = 0; diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h index dd48d0a..781d3da 100644 --- a/src/network/socket/qlocalsocket_p.h +++ b/src/network/socket/qlocalsocket_p.h @@ -192,6 +192,7 @@ public: void _q_error(QAbstractSocket::SocketError newError); void _q_connectToSocket(); void _q_abortConnectionAttempt(); + void cancelDelayedConnect(); QSocketNotifier *delayConnect; QTimer *connectTimer; int connectingSocket; diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index a375e9b..38643f1 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -322,11 +322,8 @@ void QLocalSocketPrivate::_q_connectToSocket() } // connected! - if (delayConnect) { - delayConnect->setEnabled(false); - delete delayConnect; - delayConnect = 0; - } + cancelDelayedConnect(); + serverName = connectingName; fullServerName = connectingPathName; if (unixSocket.setSocketDescriptor(connectingSocket, @@ -373,6 +370,18 @@ void QLocalSocketPrivate::_q_abortConnectionAttempt() q->close(); } +void QLocalSocketPrivate::cancelDelayedConnect() +{ + if (delayConnect) { + delayConnect->setEnabled(false); + delete delayConnect; + delayConnect = 0; + connectTimer->stop(); + delete connectTimer; + connectTimer = 0; + } +} + quintptr QLocalSocket::socketDescriptor() const { Q_D(const QLocalSocket); @@ -419,14 +428,7 @@ void QLocalSocket::close() { Q_D(QLocalSocket); d->unixSocket.close(); - if (d->delayConnect) { - d->delayConnect->setEnabled(false); - delete d->delayConnect; - d->delayConnect = 0; - d->connectTimer->stop(); - delete d->connectTimer; - d->connectTimer = 0; - } + d->cancelDelayedConnect(); if (d->connectingSocket != -1) ::close(d->connectingSocket); d->connectingSocket = -1; diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 534f7ec..cc372a6 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -506,26 +506,11 @@ int QNativeSocketEnginePrivate::nativeAccept() qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const { - /* - Apparently, there is not consistency among different operating - systems on how to use FIONREAD. - - FreeBSD, Linux and Solaris all expect the 3rd argument to - ioctl() to be an int, which is normally 32-bit even on 64-bit - machines. - - IRIX, on the other hand, expects a size_t, which is 64-bit on - 64-bit machines. - - So, the solution is to use size_t initialized to zero to make - sure all bits are set to zero, preventing underflow with the - FreeBSD/Linux/Solaris ioctls. - */ - size_t nbytes = 0; + int nbytes = 0; // gives shorter than true amounts on Unix domain sockets. qint64 available = 0; if (::ioctl(socketDescriptor, FIONREAD, (char *) &nbytes) >= 0) - available = (qint64) *((int *) &nbytes); + available = (qint64) nbytes; #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeBytesAvailable() == %lli", available); @@ -884,15 +869,15 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co if (timeout > 0) { // recalculate the timeout - timeout -= timer.elapsed(); - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - - if (timeout < 0) { + int t = timeout - timer.elapsed(); + if (t < 0) { // oops, timeout turned negative? retval = -1; break; } + + tv.tv_sec = t / 1000; + tv.tv_usec = (t % 1000) * 1000; } } while (true); @@ -927,15 +912,15 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c if (timeout > 0) { // recalculate the timeout - timeout -= timer.elapsed(); - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - - if (timeout < 0) { + int t = timeout - timer.elapsed(); + if (t < 0) { // oops, timeout turned negative? ret = -1; break; } + + tv.tv_sec = t / 1000; + tv.tv_usec = (t % 1000) * 1000; } } while (true); if (ret <= 0) diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 48d7caf..78aaddb 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -25,18 +25,16 @@ HEADERS += qgl.h \ qglcolormap.h \ qglpixelbuffer.h \ qglframebufferobject.h \ - qglpixmapfilter_p.h SOURCES += qgl.cpp \ qglcolormap.cpp \ qglpixelbuffer.cpp \ qglframebufferobject.cpp \ qglextensions.cpp \ - qglpixmapfilter.cpp !contains(QT_CONFIG, opengles2) { - HEADERS += qpaintengine_opengl_p.h - SOURCES += qpaintengine_opengl.cpp + HEADERS += qpaintengine_opengl_p.h qglpixmapfilter_p.h + SOURCES += qpaintengine_opengl.cpp qglpixmapfilter.cpp } contains(QT_CONFIG, opengles2) { @@ -130,6 +128,10 @@ wince*: { contains(QT_CONFIG,opengles1cl) { QMAKE_LIBS += "libGLES_CL.lib" } + contains(QT_CONFIG,opengles2) { + QMAKE_LIBS += "libGLESv2.lib" + } + } else { QMAKE_LIBS += $$QMAKE_LIBS_OPENGL } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2d90342..b4a0e5c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2615,6 +2615,10 @@ const QGLContext* QGLContext::currentContext() QGLWidget. This will side-step the issue altogether, and is what we recommend for users that need this kind of functionality. + On Mac OS X, when Qt is built with Cocoa support, a QGLWidget + can't have any sibling widgets placed ontop of itself. This is due + to limitations in the Cocoa API and is not supported by Apple. + \section1 Overlays The QGLWidget creates a GL overlay context in addition to the @@ -3230,6 +3234,10 @@ bool QGLWidget::event(QEvent *e) update(); } return true; +# if defined(QT_MAC_USE_COCOA) + } else if (e->type() == QEvent::MacGLClearDrawable) { + d->glcx->d_ptr->clearDrawable(); +# endif } #endif diff --git a/src/opengl/qgl_cl_p.h b/src/opengl/qgl_cl_p.h index e514ff5..c05a7d7 100644 --- a/src/opengl/qgl_cl_p.h +++ b/src/opengl/qgl_cl_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE inline void glTexParameterf (GLenum target, GLenum pname, GLfloat param) { - glTexParameterx(target, pname, param); + glTexParameterx(target, pname, FLOAT2X(param)); } inline void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm index 314c659..1319396 100644 --- a/src/opengl/qgl_mac.mm +++ b/src/opengl/qgl_mac.mm @@ -87,29 +87,6 @@ QT_FORWARD_DECLARE_CLASS(QWidget) QT_FORWARD_DECLARE_CLASS(QWidgetPrivate) QT_FORWARD_DECLARE_CLASS(QGLWidgetPrivate) -@interface QT_MANGLE_NAMESPACE(QCocoaOpenGLView) : QT_MANGLE_NAMESPACE(QCocoaView) -{ -} -- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate; -@end - -@implementation QT_MANGLE_NAMESPACE(QCocoaOpenGLView) -- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate -{ - self = [super initWithQWidget:widget widgetPrivate:widgetprivate]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(_surfaceNeedsUpdate:) - name:NSViewGlobalFrameDidChangeNotification - object:self]; - return self; -} - -- (void) _surfaceNeedsUpdate:(NSNotification*)notification -{ - Q_UNUSED(notification); - static_cast<QGLWidgetPrivate *>(qwidgetprivate)->glcx->updatePaintDevice(); -} -@end QT_BEGIN_NAMESPACE void *qt_current_nsopengl_context() @@ -435,6 +412,11 @@ void *QGLContextPrivate::tryFormat(const QGLFormat &format) #endif } +void QGLContextPrivate::clearDrawable() +{ + [static_cast<NSOpenGLContext *>(cx) clearDrawable]; +} + /*! \bold{Mac OS X only:} This virtual function tries to find a visual that matches the format, reducing the demands if the original request @@ -647,7 +629,7 @@ void QGLContext::updatePaintDevice() // ideally we would use QWidget::isVisible(), but we get "invalid drawable" errors if (![(NSWindow *)qt_mac_window_for(w) isVisible]) return; - if ([static_cast<NSOpenGLContext *>(d->cx) view] != view) + if ([static_cast<NSOpenGLContext *>(d->cx) view] != view && ![view isHidden]) [static_cast<NSOpenGLContext *>(d->cx) setView:view]; } else if (d->paintDevice->devType() == QInternal::Pixmap) { const QPixmap *pm = static_cast<const QPixmap *>(d->paintDevice); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index b8bbeaf..16aaa96 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -234,6 +234,7 @@ public: #if defined(Q_WS_MAC) bool update; void *tryFormat(const QGLFormat &format); + void clearDrawable(); #endif QGLFormat glFormat; QGLFormat reqFormat; diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index fb22272..c362b7e 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -48,6 +48,10 @@ #include <qlibrary.h> #include <qimage.h> +#ifdef QT_OPENGL_ES_1_CL +#include "qgl_cl_p.h" +#endif + QT_BEGIN_NAMESPACE extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index 964efa2..5390fd1 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -47,6 +47,10 @@ #include <qimage.h> #include <private/qgl_p.h> +#ifdef QT_OPENGL_ES_1_CL +#include "qgl_cl_p.h" +#endif + QT_BEGIN_NAMESPACE #ifdef EGL_BIND_TO_TEXTURE_RGBA @@ -188,8 +192,8 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, d->req_size.width(), d->req_size.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); else glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, d->req_size.width(), d->req_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); return texture; #else return 0; diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm index 14941ab..9a679b1 100644 --- a/src/opengl/qglpixelbuffer_mac.mm +++ b/src/opengl/qglpixelbuffer_mac.mm @@ -308,10 +308,6 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - [static_cast<NSOpenGLContext *>(d->share_ctx) - setTextureImageToPixelBuffer:static_cast<NSOpenGLPixelBuffer *>(d->pbuf) - colorBuffer:GL_FRONT]; - glBindTexture(GL_TEXTURE_2D, texture); // updates texture target glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -322,8 +318,6 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - aglTexImagePBuffer(d->share_ctx, d->pbuf, GL_FRONT); - glBindTexture(GL_TEXTURE_2D, texture); // updates texture target glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); return texture; diff --git a/src/opengl/qglpixelbuffer_win.cpp b/src/opengl/qglpixelbuffer_win.cpp index e81a576..e3228cc 100644 --- a/src/opengl/qglpixelbuffer_win.cpp +++ b/src/opengl/qglpixelbuffer_win.cpp @@ -43,7 +43,7 @@ #include <qgl.h> #include <private/qgl_p.h> -#include <qglpixelbuffer_p.h> +#include <private/qglpixelbuffer_p.h> #include <qimage.h> #include <qdebug.h> diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 96abe18..88fd379 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -1983,7 +1983,7 @@ public: void QOpenGLTrapezoidToArrayTessellator::addTrap(const Trapezoid &trap) { // On OpenGL ES we convert the trap to 2 triangles -#ifndef QT_OPENGL_ES_1 +#ifndef QT_OPENGL_ES if (size > allocated - 8) { #else if (size > allocated - 12) { @@ -1994,31 +1994,31 @@ void QOpenGLTrapezoidToArrayTessellator::addTrap(const Trapezoid &trap) QGLTrapezoid t = toGLTrapezoid(trap); -#ifndef QT_OPENGL_ES_1 - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.topRightX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; - vertices[size++] = t.bottomLeftX; - vertices[size++] = t.bottom; +#ifndef QT_OPENGL_ES + vertices[size++] = f2vt(t.topLeftX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.topRightX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.bottomRightX); + vertices[size++] = f2vt(t.bottom); + vertices[size++] = f2vt(t.bottomLeftX); + vertices[size++] = f2vt(t.bottom); #else // First triangle - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.topRightX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; + vertices[size++] = f2vt(t.topLeftX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.topRightX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.bottomRightX); + vertices[size++] = f2vt(t.bottom); // Second triangle - vertices[size++] = t.bottomLeftX; - vertices[size++] = t.bottom; - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; + vertices[size++] = f2vt(t.bottomLeftX); + vertices[size++] = f2vt(t.bottom); + vertices[size++] = f2vt(t.topLeftX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.bottomRightX); + vertices[size++] = f2vt(t.bottom); #endif } @@ -4139,12 +4139,13 @@ void QOpenGLPaintEnginePrivate::strokeLines(const QPainterPath &path) enableClipping(); } +extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp + void QOpenGLPaintEnginePrivate::strokePath(const QPainterPath &path, bool use_cache) { QBrush old_brush = cbrush; cbrush = cpen.brush(); - extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp qreal txscale = 1; if (cpen.isCosmetic() || (qt_scaleForTransform(matrix, &txscale) && txscale != 1)) { QTransform temp = matrix; @@ -5327,6 +5328,9 @@ void QOpenGLPaintEnginePrivate::composite(GLuint primitive, const q_vertexType * Q_Q(QOpenGLPaintEngine); QGL_FUNC_CONTEXT; + if (current_style == Qt::NoBrush) + return; + DEBUG_ONCE qDebug() << "QOpenGLPaintEnginePrivate: Using compositing program: fragment_brush =" << fragment_brush << ", fragment_composition_mode =" << fragment_composition_mode; diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 83bd80b..837ccf2 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -76,12 +76,18 @@ #define GLX_SAMPLES_ARB 100001 #endif +#ifdef QT_OPENGL_ES_1_CL +#include "qgl_cl_p.h" +#endif + QT_BEGIN_NAMESPACE // // QGLGraphicsSystem // - +#ifdef Q_WS_WIN +Q_GUI_EXPORT bool qt_win_owndc_required; +#endif QGLGraphicsSystem::QGLGraphicsSystem() : QGraphicsSystem() { @@ -160,7 +166,6 @@ QGLGraphicsSystem::QGLGraphicsSystem() #elif defined(Q_WS_WIN) QGLWindowSurface::surfaceFormat.setDoubleBuffer(false); - Q_GUI_EXPORT bool qt_win_owndc_required; qt_win_owndc_required = true; #endif } diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index 96eb536..89a289c 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -12,6 +12,8 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers #DEFINES += QT_NO_DIRECTFB_PREALLOCATED #DEFINES += QT_NO_DIRECTFB_MOUSE #DEFINES += QT_NO_DIRECTFB_KEYBOARD +#DEFINES += QT_DIRECTFB_TIMING +#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers INSTALLS += target diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index d1802e4..2a2ef5c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -44,8 +44,13 @@ #include "qdirectfbscreen.h" #include "qdirectfbpaintdevice.h" +QDirectFBPaintDevice::~QDirectFBPaintDevice() +{ + delete lockedImage; +} -IDirectFBSurface *QDirectFBPaintDevice::directFbSurface() const + +IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const { return dfbSurface; } @@ -59,9 +64,6 @@ void QDirectFBPaintDevice::lockDirectFB() { void *mem; int w, h; - int bpl; - DFBSurfacePixelFormat format; - DFBResult result = dfbSurface->Lock(dfbSurface, DSLF_WRITE, &mem, &bpl); if (result != DFB_OK || !mem) { DirectFBError("QDirectFBPixmapData::buffer()", result); @@ -69,16 +71,14 @@ void QDirectFBPaintDevice::lockDirectFB() { } dfbSurface->GetSize(dfbSurface, &w, &h); - dfbSurface->GetPixelFormat(dfbSurface, &format); - lockedImage = new QImage(static_cast<uchar*>(mem), w, h, bpl, - QDirectFBScreen::getImageFormat(format)); + QDirectFBScreen::getImageFormat(dfbSurface)); } void QDirectFBPaintDevice::unlockDirectFB() { - if (!lockedImage) + if (!lockedImage || !QDirectFBScreen::instance()) return; dfbSurface->Unlock(dfbSurface); @@ -98,19 +98,20 @@ void* QDirectFBPaintDevice::memory() const QImage::Format QDirectFBPaintDevice::format() const { - DFBSurfacePixelFormat dfbFormat; - dfbSurface->GetPixelFormat(dfbSurface, &dfbFormat); - return QDirectFBScreen::getImageFormat(dfbFormat); + return QDirectFBScreen::getImageFormat(dfbSurface); } int QDirectFBPaintDevice::bytesPerLine() const { - // Can only get the stride when we lock the surface - QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this); - that->lockDirectFB(); - Q_ASSERT(that->lockedImage); - return that->lockedImage->bytesPerLine(); + if (bpl == -1) { + // Can only get the stride when we lock the surface + Q_ASSERT(!lockedImage); + QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this); + that->lockDirectFB(); + Q_ASSERT(bpl != -1); + } + return bpl; } @@ -121,7 +122,6 @@ QSize QDirectFBPaintDevice::size() const return QSize(w, h); } - int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const { if (!dfbSurface) @@ -130,40 +130,21 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const int w, h; dfbSurface->GetSize(dfbSurface, &w, &h); - int dpmX, dpmY; // Dots-per-meter ;-) - - // Do some common calculations: - switch (metric) { - case QPaintDevice::PdmWidthMM: - case QPaintDevice::PdmPhysicalDpiX: - case QPaintDevice::PdmDpiX: - dpmX = (screen->deviceWidth() * 1000) / screen->physicalWidth(); - break; - case QPaintDevice::PdmHeightMM: - case QPaintDevice::PdmPhysicalDpiY: - case QPaintDevice::PdmDpiY: - dpmY = (screen->deviceHeight() * 1000) / screen->physicalHeight(); - break; - default: - break; - } - - // Now use those calculations switch (metric) { case QPaintDevice::PdmWidth: return w; case QPaintDevice::PdmHeight: return h; case QPaintDevice::PdmWidthMM: - return (w * 1000) / dpmX; + return (w * 1000) / dotsPerMeterX(); case QPaintDevice::PdmHeightMM: - return (h * 1000) / dpmY; + return (h * 1000) / dotsPerMeterY(); case QPaintDevice::PdmPhysicalDpiX: case QPaintDevice::PdmDpiX: - return (dpmX * 254) / 10000; // 0.0254 meters-per-inch + return (dotsPerMeterX() * 254) / 10000; // 0.0254 meters-per-inch case QPaintDevice::PdmPhysicalDpiY: case QPaintDevice::PdmDpiY: - return (dpmY * 254) / 10000; // 0.0254 meters-per-inch + return (dotsPerMeterY() * 254) / 10000; // 0.0254 meters-per-inch case QPaintDevice::PdmDepth: DFBSurfacePixelFormat format; dfbSurface->GetPixelFormat(dfbSurface, &format); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index c28d37c..a11064b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -54,28 +54,46 @@ QT_MODULE(Gui) class QDirectFBPaintDevice : public QCustomRasterPaintDevice { public: - QDirectFBPaintDevice(QDirectFBScreen *scr = QDirectFBScreen::instance()) - : QCustomRasterPaintDevice(0), - dfbSurface(0), - lockedImage(0), - screen(scr) {} + ~QDirectFBPaintDevice(); - IDirectFBSurface *directFbSurface() const; + IDirectFBSurface *directFBSurface() const; void lockDirectFB(); void unlockDirectFB(); + inline bool forceRasterPrimitives() const { return forceRaster; } + // Reimplemented from QCustomRasterPaintDevice: void* memory() const; QImage::Format format() const; int bytesPerLine() const; QSize size() const; int metric(QPaintDevice::PaintDeviceMetric metric) const; - protected: + // Shouldn't create QDirectFBPaintDevice by itself but only sub-class it: + QDirectFBPaintDevice(QDirectFBScreen *scr = QDirectFBScreen::instance()) + : QCustomRasterPaintDevice(0), + dfbSurface(0), + lockedImage(0), + screen(scr), + forceRaster(false) {} + + inline int dotsPerMeterX() const + { + return (screen->deviceWidth() * 1000) / screen->physicalWidth(); + } + inline int dotsPerMeterY() const + { + return (screen->deviceHeight() * 1000) / screen->physicalHeight(); + } + IDirectFBSurface *dfbSurface; QImage *lockedImage; QDirectFBScreen *screen; + int bpl; + bool forceRaster; +private: + Q_DISABLE_COPY(QDirectFBPaintDevice) }; QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 4fc4035..d9346fd 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -61,17 +61,6 @@ static inline uint ALPHA_MUL(uint x, uint a) return t; } -static inline QRect mapRect(const QTransform &transform, const QRect &rect) -{ - return (transform.isIdentity() ? rect : transform.mapRect(rect)); -} - -static inline QRect mapRect(const QTransform &transform, const QRectF &rect) -{ - return (transform.isIdentity() ? rect : transform.mapRect(rect)). - toRect(); -} - class SurfaceCache { public: @@ -112,7 +101,7 @@ CachedImage::CachedImage(const QImage &image) description = QDirectFBScreen::getSurfaceDescription(image); QDirectFBScreen* screen = QDirectFBScreen::instance(); - tmpSurface = screen->createDFBSurface(&description); + tmpSurface = screen->createDFBSurface(&description, QDirectFBScreen::TrackSurface); if (!tmpSurface) { qWarning("CachedImage CreateSurface failed!"); return; @@ -124,7 +113,7 @@ CachedImage::CachedImage(const QImage &image) description.flags = DFBSurfaceDescriptionFlags(description.flags & ~DSDESC_PREALLOCATED); - s = screen->createDFBSurface(&description); + s = screen->createDFBSurface(&description, QDirectFBScreen::TrackSurface); if (!s) qWarning("QDirectFBPaintEngine failed caching image"); @@ -159,7 +148,7 @@ IDirectFBSurface* SurfaceCache::getSurface(const uint *buf, int size) DFBSurfaceDescription description; description = QDirectFBScreen::getSurfaceDescription(buf, size); - surface = QDirectFBScreen::instance()->createDFBSurface(&description); + surface = QDirectFBScreen::instance()->createDFBSurface(&description, QDirectFBScreen::TrackSurface); if (!surface) qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface"); @@ -195,6 +184,7 @@ public: QBrush brush; bool antialiased; + bool forceRasterPrimitives; bool simplePen; bool simpleBrush; @@ -206,12 +196,12 @@ public: void setPen(const QPen &pen); void setBrush(const QBrush &brush); void setCompositionMode(QPainter::CompositionMode mode); - void setOpacity(const qreal value); + void setOpacity(quint8 value); void setRenderHints(QPainter::RenderHints hints); - inline void setDFBColor(const QColor &color) const; + inline void setDFBColor(const QColor &color); - inline bool lock(); + inline void lock(); inline void unlock(); inline bool dfbCanHandleClip(const QRect &rect) const; @@ -232,43 +222,41 @@ public: void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap); void drawImage(const QRectF &dest, const QImage &image, const QRectF &src); - void updateClip(); - void updateFlags(); + inline void updateClip(); inline void setClipDirty(); - void systemStateChanged(); //Needed to be notified when system clip changes + void systemStateChanged(); void begin(QPaintDevice *device); void end(); + void prepareForBlit(bool alpha); SurfaceCache *surfaceCache; - + QTransform transform; + int lastLockedHeight; private: -// QRegion rectsToClippedRegion(const QRect *rects, int n) const; -// QRegion rectsToClippedRegion(const QRectF *rects, int n) const; - IDirectFB *fb; DFBSurfaceDescription fbDescription; int fbWidth; int fbHeight; quint8 opacity; - QTransform transform; - quint32 drawFlags; - quint32 blitFlags; - quint32 duffFlags; - bool dirtyFlags; + quint32 drawFlagsFromCompositionMode, blitFlagsFromCompositionMode; + DFBSurfacePorterDuffRule porterDuffRule; + bool dirtyClip; bool dfbHandledClip; + QDirectFBPaintDevice *dfbDevice; QDirectFBPaintEngine *q; }; QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) - : surface(0), antialiased(false), simplePen(false), - simpleBrush(false), matrixRotShear(false), matrixScale(false), fbWidth(-1), fbHeight(-1), - opacity(255), drawFlags(0), blitFlags(0), duffFlags(0), dirtyFlags(false), dirtyClip(true), - dfbHandledClip(false), q(p) + : surface(0), antialiased(false), forceRasterPrimitives(false), simplePen(false), + simpleBrush(false), matrixRotShear(false), matrixScale(false), lastLockedHeight(-1), + fbWidth(-1), fbHeight(-1), opacity(255), drawFlagsFromCompositionMode(0), + blitFlagsFromCompositionMode(0), porterDuffRule(DSPD_SRC_OVER), dirtyClip(true), + dfbHandledClip(false), dfbDevice(0), q(p) { fb = QDirectFBScreen::instance()->dfb(); surfaceCache = new SurfaceCache; @@ -279,7 +267,6 @@ QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate() { - unlock(); delete surfaceCache; } @@ -305,27 +292,20 @@ void QDirectFBPaintEnginePrivate::setClipDirty() dirtyClip = true; } - -bool QDirectFBPaintEnginePrivate::lock() +void QDirectFBPaintEnginePrivate::lock() { // We will potentially get a new pointer to the buffer after a // lock so we need to call the base implementation of prepare so // it updates its rasterBuffer to point to the new buffer address. - if (device->devType() == QInternal::CustomRaster) { - prepare(static_cast<QCustomRasterPaintDevice*>(device)); - return true; - } - return false; + lastLockedHeight = dfbDevice->height(); + + Q_ASSERT(dfbDevice); + prepare(dfbDevice); } void QDirectFBPaintEnginePrivate::unlock() { - QPaintDevice *device = q->paintDevice(); - if (!device) //XXX This should probably be an assert - return; - - Q_ASSERT(device->devType() == QInternal::CustomRaster); - QDirectFBPaintDevice* dfbDevice = static_cast<QDirectFBPaintDevice*>(device); + Q_ASSERT(dfbDevice); dfbDevice->unlockDirectFB(); } @@ -338,35 +318,31 @@ void QDirectFBPaintEnginePrivate::setTransform(const QTransform &m) void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device) { - QDirectFBPaintDevice* dfbDevice = 0; - + lastLockedHeight = -1; if (device->devType() == QInternal::CustomRaster) dfbDevice = static_cast<QDirectFBPaintDevice*>(device); else if (device->devType() == QInternal::Pixmap) { QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData(); - if (data->classId() == QPixmapData::DirectFBClass) { - QDirectFBPixmapData* dfbPixmapData = static_cast<QDirectFBPixmapData*>(data); - dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData); - } + Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); + QDirectFBPixmapData* dfbPixmapData = static_cast<QDirectFBPixmapData*>(data); + dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData); } if (dfbDevice) - surface = dfbDevice->directFbSurface(); + surface = dfbDevice->directFBSurface(); if (!surface) { qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x", device->devType()); } + forceRasterPrimitives = dfbDevice->forceRasterPrimitives(); surface->GetSize(surface, &fbWidth, &fbHeight); setTransform(QTransform()); antialiased = false; - drawFlags = DSDRAW_BLEND; - blitFlags = DSBLIT_BLEND_ALPHACHANNEL; - duffFlags = DSPD_SRC_OVER; opacity = 255; - dirtyFlags = true; + setCompositionMode(q->state()->compositionMode()); dirtyClip = true; setPen(q->state()->pen); setDFBColor(pen.color()); @@ -374,6 +350,7 @@ void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device) void QDirectFBPaintEnginePrivate::end() { + dfbDevice = 0; surface->ReleaseSource(surface); surface->SetClip(surface, NULL); surface = 0; @@ -383,13 +360,14 @@ void QDirectFBPaintEnginePrivate::setPen(const QPen &p) { pen = p; simplePen = (pen.style() == Qt::NoPen) || - (pen.style() == Qt::SolidLine && !antialiased + (pen.style() == Qt::SolidLine + && !antialiased + && (pen.brush().style() == Qt::SolidPattern) && (pen.widthF() <= 1 && !matrixScale)); } void QDirectFBPaintEnginePrivate::setBrush(const QBrush &b) { - // TODO: accelerate texture pattern brush = b; simpleBrush = (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); @@ -397,91 +375,72 @@ void QDirectFBPaintEnginePrivate::setBrush(const QBrush &b) void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode) { - drawFlags &= ~(DSDRAW_XOR); - blitFlags &= ~(DSBLIT_XOR); - - // TODO: check these mappings!!!! - quint32 duff = DSPD_NONE; - quint32 blit = blitFlags; + blitFlagsFromCompositionMode = DSBLIT_NOFX; + drawFlagsFromCompositionMode = DSDRAW_NOFX; + bool blend = true; switch (mode) { case QPainter::CompositionMode_SourceOver: - duff = DSPD_SRC_OVER; - blit |= DSBLIT_BLEND_ALPHACHANNEL; + porterDuffRule = DSPD_SRC_OVER; break; case QPainter::CompositionMode_DestinationOver: - duff = DSPD_DST_OVER; - blit |= DSBLIT_BLEND_ALPHACHANNEL; + porterDuffRule = DSPD_DST_OVER; break; case QPainter::CompositionMode_Clear: - duff = DSPD_CLEAR; - blit &= ~DSBLIT_BLEND_ALPHACHANNEL; + porterDuffRule = DSPD_CLEAR; + blend = false; break; case QPainter::CompositionMode_Source: - duff = DSPD_SRC; - blit &= ~DSBLIT_BLEND_ALPHACHANNEL; + porterDuffRule = DSPD_SRC; + blend = false; break; case QPainter::CompositionMode_Destination: - blit &= ~DSBLIT_BLEND_ALPHACHANNEL; + porterDuffRule = DSPD_NONE; // ### need to double check this + blend = false; return; case QPainter::CompositionMode_SourceIn: - duff = DSPD_SRC_IN; - blit |= DSBLIT_BLEND_ALPHACHANNEL; + porterDuffRule = DSPD_SRC_IN; break; case QPainter::CompositionMode_DestinationIn: - duff = DSPD_DST_IN; - blit |= DSBLIT_BLEND_ALPHACHANNEL; + porterDuffRule = DSPD_DST_IN; break; case QPainter::CompositionMode_SourceOut: - duff = DSPD_SRC_OUT; - blit |= DSBLIT_BLEND_ALPHACHANNEL; + porterDuffRule = DSPD_SRC_OUT; break; case QPainter::CompositionMode_DestinationOut: - duff = DSPD_DST_OUT; - blit |= DSBLIT_BLEND_ALPHACHANNEL; - break; - case QPainter::CompositionMode_SourceAtop: - duff = DSPD_SRC_OVER; - blit |= DSBLIT_BLEND_ALPHACHANNEL; - break; - case QPainter::CompositionMode_DestinationAtop: - duff = DSPD_DST_OVER; + porterDuffRule = DSPD_DST_OUT; break; case QPainter::CompositionMode_Xor: - duff = DSPD_NONE; - blit |= DSBLIT_BLEND_ALPHACHANNEL; - drawFlags |= DSDRAW_XOR; - blit |= DSBLIT_XOR; - dirtyFlags = true; + porterDuffRule = DSPD_XOR; + blitFlagsFromCompositionMode |= DSBLIT_XOR; + drawFlagsFromCompositionMode |= DSDRAW_XOR; break; +// case QPainter::CompositionMode_Plus: // ??? +// porterDuffRule = DSPD_ADD; +// break; default: qWarning("QDirectFBPaintEnginePrivate::setCompositionMode(): " "mode %d not implemented", mode); - break; + return; } - - if (duff != duffFlags || blit != blitFlags) { - duffFlags = duff; - blitFlags = blit; - dirtyFlags = true; + // intentially not comparing with current porterDuffRule. surface might have changed. + if (blend) { + blitFlagsFromCompositionMode |= DSBLIT_BLEND_ALPHACHANNEL; + drawFlagsFromCompositionMode |= DSDRAW_BLEND; + } + if (opacity != 255) { + setOpacity(opacity); } } -void QDirectFBPaintEnginePrivate::setOpacity(const qreal value) +void QDirectFBPaintEnginePrivate::setOpacity(quint8 op) { - const bool wasOpaque = (opacity == 255); - opacity = quint8(value * 255); - const bool opaque = (opacity == 255); - - if (opaque == wasOpaque) - return; - - if (opaque) - blitFlags &= ~(DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR); - else - blitFlags |= (DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR); - - dirtyFlags = true; + opacity = op; + if (opacity == 255) { + blitFlagsFromCompositionMode &= ~DSBLIT_BLEND_COLORALPHA; + } else { + blitFlagsFromCompositionMode |= DSBLIT_BLEND_COLORALPHA; + } } void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) @@ -493,133 +452,83 @@ void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) } } -void QDirectFBPaintEnginePrivate::updateFlags() +void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) { - if (!dirtyFlags) - return; - surface->SetDrawingFlags(surface, DFBSurfaceDrawingFlags(drawFlags)); - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blitFlags)); - surface->SetPorterDuff(surface, DFBSurfacePorterDuffRule(duffFlags)); - dirtyFlags = false; + quint32 blittingFlags = blitFlagsFromCompositionMode; + if (alpha) { + surface->SetPorterDuff(surface, + (blittingFlags & DSBLIT_BLEND_COLORALPHA) + ? DSPD_NONE + : porterDuffRule); + } else { + blittingFlags &= ~DSBLIT_BLEND_ALPHACHANNEL; + surface->SetPorterDuff(surface, DSPD_NONE); + } + surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); + surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blittingFlags)); } -void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) const +void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) { + Q_ASSERT(surface); const quint8 alpha = (opacity == 255 ? color.alpha() : ALPHA_MUL(color.alpha(), opacity)); surface->SetColor(surface, color.red(), color.green(), color.blue(), alpha); + quint32 drawingFlags = drawFlagsFromCompositionMode; + if (alpha == 255) { + drawingFlags &= ~DSDRAW_BLEND; + } + surface->SetPorterDuff(surface, DSPD_NONE); + // PorterDuff messes up alpha values for primitives + surface->SetDrawingFlags(surface, DFBSurfaceDrawingFlags(drawingFlags)); } void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) const { - QVarLengthArray<DFBRegion> regions(n); - for (int i = 0; i < n; ++i) { const QLine l = transform.map(lines[i]); - - // TODO: clip! - - regions[i].x1 = l.x1(); - regions[i].y1 = l.y1(); - regions[i].x2 = l.x2(); - regions[i].y2 = l.y2(); + surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); } - surface->DrawLines(surface, regions.data(), n); } void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) const { - QVarLengthArray<DFBRegion> regions(n); - for (int i = 0; i < n; ++i) { const QLine l = transform.map(lines[i]).toLine(); - - // TODO: clip! - - regions[i].x1 = l.x1(); - regions[i].y1 = l.y1(); - regions[i].x2 = l.x2(); - regions[i].y2 = l.y2(); - } - surface->DrawLines(surface, regions.data(), n); -} - -/* ### Commented out until it can be implemented properly using raster's QClipData -QRegion QDirectFBPaintEnginePrivate::rectsToClippedRegion(const QRect *rects, - int n) const -{ - QRegion region; - - for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); - region += clip & r; - } - - return region; -} - -QRegion QDirectFBPaintEnginePrivate::rectsToClippedRegion(const QRectF *rects, - int n) const -{ - QRegion region; - - for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); - region += clip & r; + surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); } - - return region; } -*/ void QDirectFBPaintEnginePrivate::fillRegion(const QRegion ®ion) const { const QVector<QRect> rects = region.rects(); const int n = rects.size(); - QVarLengthArray<DFBRectangle> dfbRects(n); - - for (int i = 0; i < n; ++i) { - const QRect r = rects.at(i); - dfbRects[i].x = r.x(); - dfbRects[i].y = r.y(); - dfbRects[i].w = r.width(); - dfbRects[i].h = r.height(); - - } - surface->FillRectangles(surface, dfbRects.data(), n); + fillRects(rects.constData(), n); } void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) const { - QVarLengthArray<DFBRectangle> dfbRects(n); for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); - dfbRects[i].x = r.x(); - dfbRects[i].y = r.y(); - dfbRects[i].w = r.width(); - dfbRects[i].h = r.height(); + const QRect r = transform.mapRect(rects[i]); + surface->FillRectangle(surface, r.x(), r.y(), + r.width(), r.height()); } - surface->FillRectangles(surface, dfbRects.data(), n); } void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) const { - QVarLengthArray<DFBRectangle> dfbRects(n); for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); - dfbRects[i].x = r.x(); - dfbRects[i].y = r.y(); - dfbRects[i].w = r.width(); - dfbRects[i].h = r.height(); + const QRect r = transform.mapRect(rects[i]).toRect(); + surface->FillRectangle(surface, r.x(), r.y(), + r.width(), r.height()); } - surface->FillRectangles(surface, dfbRects.data(), n); } void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) const { for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = transform.mapRect(rects[i]); surface->DrawRectangle(surface, r.x(), r.y(), r.width() + 1, r.height() + 1); } @@ -628,7 +537,7 @@ void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) const void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n) const { for (int i = 0; i < n; ++i) { - const QRect r = ::mapRect(transform, rects[i]); + const QRect r = transform.mapRect(rects[i]).toRect(); surface->DrawRectangle(surface, r.x(), r.y(), r.width() + 1, r.height() + 1); } @@ -638,21 +547,13 @@ void QDirectFBPaintEnginePrivate::drawPixmap(const QRectF &dest, const QPixmap &pixmap, const QRectF &src) { - surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); - - const bool changeFlags = !pixmap.hasAlphaChannel() - && (blitFlags & DSBLIT_BLEND_ALPHACHANNEL); - if (changeFlags) { - quint32 flags = blitFlags & ~DSBLIT_BLEND_ALPHACHANNEL; - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(flags)); - } - + prepareForBlit(pixmap.hasAlphaChannel()); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); - IDirectFBSurface *s = dfbData->directFbSurface(); + IDirectFBSurface *s = dfbData->directFBSurface(); const QRect sr = src.toRect(); - const QRect dr = ::mapRect(transform, dest); + const QRect dr = transform.mapRect(dest).toRect(); const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; DFBResult result; @@ -664,27 +565,17 @@ void QDirectFBPaintEnginePrivate::drawPixmap(const QRectF &dest, } if (result != DFB_OK) DirectFBError("QDirectFBPaintEngine::drawPixmap()", result); - if (changeFlags) - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blitFlags)); } void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap) { - surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); - - const bool changeFlags = !pixmap.hasAlphaChannel() - && (blitFlags & DSBLIT_BLEND_ALPHACHANNEL); - if (changeFlags) { - quint32 flags = blitFlags & ~DSBLIT_BLEND_ALPHACHANNEL; - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(flags)); - } - + prepareForBlit(pixmap.hasAlphaChannel()); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); - IDirectFBSurface *s = dfbData->directFbSurface(); - const QRect dr = ::mapRect(transform, dest); + IDirectFBSurface *s = dfbData->directFBSurface(); + const QRect dr = transform.mapRect(dest).toRect(); DFBResult result = DFB_OK; if (!matrixScale && dr == QRect(0, 0, fbWidth, fbHeight)) { @@ -706,7 +597,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, result = surface->BatchBlit(surface, s, rects.constData(), points.constData(), points.size()); } else { - const QRect sr = ::mapRect(transform, QRect(0, 0, pixmap.width(), pixmap.height())); + const QRect sr = transform.mapRect(QRect(0, 0, pixmap.width(), pixmap.height())); const int dx = sr.width(); const int dy = sr.height(); const DFBRectangle sRect = { 0, 0, dx, dy }; @@ -725,25 +616,13 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, if (result != DFB_OK) DirectFBError("QDirectFBPaintEngine::drawTiledPixmap()", result); - - if (changeFlags) - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blitFlags)); } void QDirectFBPaintEnginePrivate::drawImage(const QRectF &dest, - const QImage &srcImage, + const QImage &image, const QRectF &src) { - QImage image = srcImage; - if (QDirectFBScreen::getSurfacePixelFormat(image) == DSPF_UNKNOWN) { - QImage::Format format; - if (image.hasAlphaChannel()) - format = QImage::Format_ARGB32_Premultiplied; - else - format = QImage::Format_RGB32; - image = image.convertToFormat(format); - } - + Q_ASSERT(QDirectFBScreen::getSurfacePixelFormat(image.format()) != DSPF_UNKNOWN); CachedImage *img = imageCache[image.cacheKey()]; IDirectFBSurface *imgSurface = 0; bool doRelease = false; @@ -767,7 +646,8 @@ void QDirectFBPaintEnginePrivate::drawImage(const QRectF &dest, DFBSurfaceDescription description; description = QDirectFBScreen::getSurfaceDescription(image); - imgSurface = QDirectFBScreen::instance()->createDFBSurface(&description); + imgSurface = QDirectFBScreen::instance()->createDFBSurface(&description, + QDirectFBScreen::DontTrackSurface); if (!imgSurface) { qWarning("QDirectFBPaintEnginePrivate::drawImage"); return; @@ -781,17 +661,10 @@ void QDirectFBPaintEnginePrivate::drawImage(const QRectF &dest, } const QRect sr = src.toRect(); - const QRect dr = ::mapRect(transform, dest); + const QRect dr = transform.mapRect(dest).toRect(); const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; - surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); - - const bool changeFlags = !image.hasAlphaChannel() - && (blitFlags & DSBLIT_BLEND_ALPHACHANNEL); - if (changeFlags) { - quint32 flags = blitFlags & ~DSBLIT_BLEND_ALPHACHANNEL; - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(flags)); - } + prepareForBlit(image.hasAlphaChannel()); if (dr.size() == sr.size()) { surface->Blit(surface, imgSurface, &sRect, dr.x(), dr.y()); } else { @@ -799,10 +672,10 @@ void QDirectFBPaintEnginePrivate::drawImage(const QRectF &dest, dr.width(), dr.height() }; surface->StretchBlit(surface, imgSurface, &sRect, &dRect); } - if (changeFlags) - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blitFlags)); - if (doRelease) - QDirectFBScreen::instance()->releaseDFBSurface(imgSurface); + if (doRelease) { + surface->ReleaseSource(surface); + imgSurface->Release(imgSurface); + } } void QDirectFBPaintEnginePrivate::updateClip() @@ -893,8 +766,7 @@ void QDirectFBPaintEngine::brushChanged() void QDirectFBPaintEngine::opacityChanged() { Q_D(QDirectFBPaintEngine); - d->setOpacity(state()->opacity); - + d->setOpacity(quint8(state()->opacity * 255)); QRasterPaintEngine::opacityChanged(); } @@ -902,7 +774,6 @@ void QDirectFBPaintEngine::compositionModeChanged() { Q_D(QDirectFBPaintEngine); d->setCompositionMode(state()->compositionMode()); - QRasterPaintEngine::compositionModeChanged(); } @@ -928,11 +799,10 @@ void QDirectFBPaintEngine::setState(QPainterState *s) { Q_D(QDirectFBPaintEngine); QRasterPaintEngine::setState(s); - if (d->surface) - d->updateClip(); + d->setClipDirty(); d->setPen(state()->pen); d->setBrush(state()->brush); - d->setOpacity(state()->opacity); + d->setOpacity(quint8(state()->opacity * 255)); d->setCompositionMode(state()->compositionMode()); d->setTransform(state()->transform()); } @@ -941,6 +811,9 @@ void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) { Q_D(QDirectFBPaintEngine); d->setClipDirty(); + const QPoint bottom = d->transform.map(QPoint(0, path.controlPointRect().y2)); + if (bottom.y() >= d->lastLockedHeight) + d->lock(); QRasterPaintEngine::clip(path, op); } @@ -948,15 +821,21 @@ void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) { Q_D(QDirectFBPaintEngine); d->setClipDirty(); + if (!d->clip()->hasRectClip && d->clip()->enabled) { + const QPoint bottom = d->transform.map(QPoint(0, rect.bottom())); + if (bottom.y() >= d->lastLockedHeight) + d->lock(); + } + QRasterPaintEngine::clip(rect, op); } - void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->dfbCanHandleClip() || d->matrixRotShear || !d->simpleBrush || !d->simplePen) { + if (!d->dfbCanHandleClip() || d->matrixRotShear || !d->simpleBrush + || !d->simplePen || d->forceRasterPrimitives) { d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); return; @@ -965,12 +844,10 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) d->unlock(); if (d->brush != Qt::NoBrush) { - d->updateFlags(); d->setDFBColor(d->brush.color()); d->fillRects(rects, rectCount); } if (d->pen != Qt::NoPen) { - d->updateFlags(); d->setDFBColor(d->pen.color()); d->drawRects(rects, rectCount); } @@ -980,7 +857,8 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->dfbCanHandleClip() || d->matrixRotShear || !d->simpleBrush || !d->simplePen) { + if (!d->dfbCanHandleClip() || d->matrixRotShear || !d->simpleBrush + || !d->simplePen || d->forceRasterPrimitives) { d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); return; @@ -989,12 +867,10 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) d->unlock(); if (d->brush != Qt::NoBrush) { - d->updateFlags(); d->setDFBColor(d->brush.color()); d->fillRects(rects, rectCount); } if (d->pen != Qt::NoPen) { - d->updateFlags(); d->setDFBColor(d->pen.color()); d->drawRects(rects, rectCount); } @@ -1004,7 +880,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->simplePen || !d->dfbCanHandleClip()) { + if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) { d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; @@ -1012,7 +888,6 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) if (d->pen != Qt::NoPen) { d->unlock(); - d->updateFlags(); d->setDFBColor(d->pen.color()); d->drawLines(lines, lineCount); } @@ -1022,7 +897,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->simplePen || !d->dfbCanHandleClip()) { + if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) { d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; @@ -1030,7 +905,6 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) if (d->pen != Qt::NoPen) { d->unlock(); - d->updateFlags(); d->setDFBColor(d->pen.color()); d->drawLines(lines, lineCount); } @@ -1045,7 +919,8 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, #ifndef QT_NO_DIRECTFB_PREALLOCATED d->updateClip(); - if (!d->dfbCanHandleClip(r) || d->matrixRotShear) + if (!d->dfbCanHandleClip(r) || d->matrixRotShear + || QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN) #endif { d->lock(); @@ -1055,7 +930,6 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, #ifndef QT_NO_DIRECTFB_PREALLOCATED d->unlock(); - d->updateFlags(); d->drawImage(r, image, sr); #endif } @@ -1074,15 +948,12 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) { d->lock(); QRasterPaintEngine::drawPixmap(r, pixmap, sr); - } - else if (!d->dfbCanHandleClip(r) || d->matrixRotShear) { + } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear) { const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(); d->lock(); QRasterPaintEngine::drawImage(r, *img, sr); - } - else { + } else { d->unlock(); - d->updateFlags(); d->drawPixmap(r, pixmap, sr); } } @@ -1101,18 +972,15 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) { d->lock(); QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp); - } - else if (!d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull()) { - QImage* img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(); + } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull()) { + const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(); + d->lock(); QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); data->fromImage(*img, Qt::AutoColor); const QPixmap pix(data); - d->lock(); QRasterPaintEngine::drawTiledPixmap(r, pix, sp); - } - else { + } else { d->unlock(); - d->updateFlags(); d->drawTiledPixmap(r, pixmap); } } @@ -1184,67 +1052,89 @@ void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush) QRasterPaintEngine::fill(path, brush); } -void QDirectFBPaintEngine::fillRect(const QRectF &r, const QBrush &brush) + +void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) { Q_D(QDirectFBPaintEngine); - if (brush.style() != Qt::SolidPattern) { - d->lock(); - QRasterPaintEngine::fillRect(r, brush); + d->updateClip(); + if (d->dfbCanHandleClip(rect) && !d->matrixRotShear) { + switch (brush.style()) { + case Qt::SolidPattern: { + if (d->forceRasterPrimitives) + break; + d->unlock(); + d->setDFBColor(brush.color()); + const QRect r = d->transform.mapRect(rect).toRect(); + d->surface->FillRectangle(d->surface, r.x(), r.y(), + r.width(), r.height()); + return; } + case Qt::TexturePattern: + if (state()->brushOrigin == QPointF() && brush.transform().isIdentity()) { + //could handle certain types of brush.transform() E.g. scale + d->unlock(); + d->drawTiledPixmap(rect, brush.texture()); + return; + } + break; + default: + break; + } } - else - fillRect(r, brush.color()); + d->lock(); + QRasterPaintEngine::fillRect(rect, brush); } void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) { Q_D(QDirectFBPaintEngine); d->updateClip(); - if (!d->dfbCanHandleClip() || d->matrixRotShear) { + if (!d->dfbCanHandleClip() || d->matrixRotShear || d->forceRasterPrimitives) { d->lock(); QRasterPaintEngine::fillRect(rect, color); } else { d->unlock(); - d->updateFlags(); d->setDFBColor(color); - d->fillRects(&rect, 1); + const QRect r = d->transform.mapRect(rect).toRect(); + d->surface->FillRectangle(d->surface, r.x(), r.y(), + r.width(), r.height()); } } - - - - - - void QDirectFBPaintEngine::drawColorSpans(const QSpan *spans, int count, uint color) { Q_D(QDirectFBPaintEngine); - color = INV_PREMUL(color); - - QVarLengthArray<DFBRegion> lines(count); - int j = 0; - for (int i = 0; i < count; ++i) { - if (spans[i].coverage == 255) { - lines[j].x1 = spans[i].x; - lines[j].y1 = spans[i].y; - lines[j].x2 = spans[i].x + spans[i].len - 1; - lines[j].y2 = spans[i].y; - ++j; - } else { - DFBSpan span = { spans[i].x, spans[i].len }; - uint c = BYTE_MUL(color, spans[i].coverage); + if (d->forceRasterPrimitives) { + d->lock(); + QRasterPaintEngine::drawColorSpans(spans, count, color); + } else { + color = INV_PREMUL(color); + + QVarLengthArray<DFBRegion> lines(count); + int j = 0; + for (int i = 0; i < count; ++i) { + if (spans[i].coverage == 255) { + lines[j].x1 = spans[i].x; + lines[j].y1 = spans[i].y; + lines[j].x2 = spans[i].x + spans[i].len - 1; + lines[j].y2 = spans[i].y; + ++j; + } else { + DFBSpan span = { spans[i].x, spans[i].len }; + uint c = BYTE_MUL(color, spans[i].coverage); + // ### how does this play with setDFBColor + d->surface->SetColor(d->surface, + qRed(c), qGreen(c), qBlue(c), qAlpha(c)); + d->surface->FillSpans(d->surface, spans[i].y, &span, 1); + } + } + if (j > 0) { d->surface->SetColor(d->surface, - qRed(c), qGreen(c), qBlue(c), qAlpha(c)); - d->surface->FillSpans(d->surface, spans[i].y, &span, 1); + qRed(color), qGreen(color), qBlue(color), + qAlpha(color)); + d->surface->DrawLines(d->surface, lines.data(), j); } } - if (j > 0) { - d->surface->SetColor(d->surface, - qRed(color), qGreen(color), qBlue(color), - qAlpha(color)); - d->surface->DrawLines(d->surface, lines.data(), j); - } } void QDirectFBPaintEngine::drawBufferSpan(const uint *buffer, int bufsize, @@ -1253,6 +1143,7 @@ void QDirectFBPaintEngine::drawBufferSpan(const uint *buffer, int bufsize, { Q_D(QDirectFBPaintEngine); IDirectFBSurface *src = d->surfaceCache->getSurface(buffer, bufsize); + // ### how does this play with setDFBColor src->SetColor(src, 0, 0, 0, const_alpha); const DFBRectangle rect = { 0, 0, length, 1 }; d->surface->Blit(d->surface, src, &rect, x, y); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 6352652..0a1696a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -51,7 +51,7 @@ static int global_ser_no = 0; QDirectFBPixmapData::QDirectFBPixmapData(PixelType pixelType) : QPixmapData(pixelType, DirectFBClass), - engine(0) + engine(0), format(QImage::Format_Invalid), alpha(false) { setSerialNumber(0); } @@ -67,81 +67,119 @@ QDirectFBPixmapData::~QDirectFBPixmapData() void QDirectFBPixmapData::resize(int width, int height) { if (width <= 0 || height <= 0) { - setSerialNumber(0); + invalidate(); return; } - DFBSurfaceDescription description; - description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | - DSDESC_HEIGHT); - description.width = width; - description.height = height; - - dfbSurface = screen->createDFBSurface(&description); - if (!dfbSurface) - qCritical("QDirectFBPixmapData::resize(): Unable to allocate surface"); + format = screen->pixelFormat(); + dfbSurface = QDirectFBScreen::instance()->createDFBSurface(QSize(width, height), + format, + QDirectFBScreen::TrackSurface); + alpha = false; + forceRaster = (format == QImage::Format_RGB32); + if (!dfbSurface) { + invalidate(); + qWarning("QDirectFBPixmapData::resize(): Unable to allocate surface"); + return; + } setSerialNumber(++global_ser_no); } -void QDirectFBPixmapData::fromImage(const QImage &img, - Qt::ImageConversionFlags) -{ - QImage image; - if (QDirectFBScreen::getSurfacePixelFormat(img) == DSPF_UNKNOWN) - image = img.convertToFormat(QImage::Format_ARGB32_Premultiplied); - else - image = img; - DFBSurfaceDescription description; - description = QDirectFBScreen::getSurfaceDescription(image); +// mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels) +static bool checkForAlphaPixels(const QImage &img) +{ + const uchar *bits = img.bits(); + const int bytes_per_line = img.bytesPerLine(); + const uchar *end_bits = bits + bytes_per_line; + const int width = img.width(); + const int height = img.height(); + switch (img.format()) { + case QImage::Format_Indexed8: + return img.hasAlphaChannel(); + case QImage::Format_ARGB32: + case QImage::Format_ARGB32_Premultiplied: + for (int y=0; y<height; ++y) { + for (int x=0; x<width; ++x) { + if ((((uint *)bits)[x] & 0xff000000) != 0xff000000) { + return true; + } + } + bits += bytes_per_line; + } + break; + + case QImage::Format_ARGB8555_Premultiplied: + case QImage::Format_ARGB8565_Premultiplied: + for (int y=0; y<height; ++y) { + while (bits < end_bits) { + if (bits[0] != 0) { + return true; + } + bits += 3; + } + bits = end_bits; + end_bits += bytes_per_line; + } + break; + + case QImage::Format_ARGB6666_Premultiplied: + for (int y=0; y<height; ++y) { + while (bits < end_bits) { + if ((bits[0] & 0xfc) != 0) { + return true; + } + bits += 3; + } + bits = end_bits; + end_bits += bytes_per_line; + } + break; + + case QImage::Format_ARGB4444_Premultiplied: + for (int y=0; y<height; ++y) { + while (bits < end_bits) { + if ((bits[0] & 0xf0) != 0) { + return true; + } + bits += 2; + } + bits = end_bits; + end_bits += bytes_per_line; + } + break; -#ifndef QT_NO_DIRECTFB_PREALLOCATED - IDirectFBSurface *imgSurface; - imgSurface = screen->createDFBSurface(&description); - if (!imgSurface) { - qWarning("QDirectFBPixmapData::fromImage()"); - setSerialNumber(0); - return; + default: + break; } -#ifndef QT_NO_DIRECTFB_PALETTE - QDirectFBScreen::setSurfaceColorTable(imgSurface, image); -#endif -#endif // QT_NO_DIRECTFB_PREALLOCATED - description.flags = DFBSurfaceDescriptionFlags(description.flags - & ~DSDESC_PREALLOCATED); - dfbSurface = screen->createDFBSurface(&description); + return false; +} + +void QDirectFBPixmapData::fromImage(const QImage &img, + Qt::ImageConversionFlags flags) +{ + Q_ASSERT(img.depth() != 1); // these should be handled by QRasterPixmapData + if (img.hasAlphaChannel() +#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION + && (flags & Qt::NoOpaqueDetection || ::checkForAlphaPixels(img)) +#endif + ) { + alpha = true; + format = screen->alphaPixmapFormat(); + } else { + alpha = false; + format = screen->pixelFormat(); + } + dfbSurface = screen->copyToDFBSurface(img, format, + QDirectFBScreen::TrackSurface); + forceRaster = (format == QImage::Format_RGB32); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage()"); - setSerialNumber(0); + invalidate(); return; } - -#ifndef QT_NO_DIRECTFB_PALETTE - QDirectFBScreen::setSurfaceColorTable(dfbSurface, image); -#endif - -#ifdef QT_NO_DIRECTFB_PREALLOCATED - char *mem; - surface->Lock(surface, DSLF_WRITE, (void**)&mem, &bpl); - const int w = image.width() * image.depth() / 8; - for (int i = 0; i < image.height(); ++i) { - memcpy(mem, image.scanLine(i), w); - mem += bpl; - } - surface->Unlock(surface); -#else - DFBResult result; - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0); - if (result != DFB_OK) - DirectFBError("QDirectFBPixmapData::fromImage()", result); - dfbSurface->Flip(dfbSurface, 0, DSFLIP_NONE); - dfbSurface->ReleaseSource(dfbSurface); - screen->releaseDFBSurface(imgSurface); -#endif // QT_NO_DIRECTFB_PREALLOCATED - setSerialNumber(++global_ser_no); } @@ -152,43 +190,55 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) return; } - IDirectFBSurface *src = static_cast<const QDirectFBPixmapData*>(data)->directFbSurface(); + IDirectFBSurface *src = static_cast<const QDirectFBPixmapData*>(data)->directFBSurface(); + const bool hasAlpha = data->hasAlphaChannel(); + format = (hasAlpha + ? QDirectFBScreen::instance()->alphaPixmapFormat() + : QDirectFBScreen::instance()->pixelFormat()); - DFBSurfaceDescription description; - description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | - DSDESC_HEIGHT | - DSDESC_PIXELFORMAT); - description.width = rect.width(); - description.height = rect.height(); - src->GetPixelFormat(src, &description.pixelformat); - - dfbSurface = screen->createDFBSurface(&description); + dfbSurface = screen->createDFBSurface(rect.size(), format, + QDirectFBScreen::TrackSurface); if (!dfbSurface) { qWarning("QDirectFBPixmapData::copy()"); - setSerialNumber(0); + invalidate(); return; } + forceRaster = (format == QImage::Format_RGB32); - DFBResult result; -#ifndef QT_NO_DIRECTFB_PALETTE - IDirectFBPalette *palette; - result = src->GetPalette(src, &palette); - if (result == DFB_OK) { - dfbSurface->SetPalette(dfbSurface, palette); - palette->Release(palette); + if (hasAlpha) { + dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); + dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL); + } else { + dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); } -#endif - - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); const DFBRectangle blitRect = { rect.x(), rect.y(), rect.width(), rect.height() }; - result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0); - if (result != DFB_OK) + DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0); + dfbSurface->ReleaseSource(dfbSurface); + if (result != DFB_OK) { DirectFBError("QDirectFBPixmapData::copy()", result); + invalidate(); + return; + } setSerialNumber(++global_ser_no); } +static inline bool isOpaqueFormat(QImage::Format format) +{ + switch (format) { + case QImage::Format_RGB32: + case QImage::Format_RGB16: + case QImage::Format_RGB666: + case QImage::Format_RGB555: + case QImage::Format_RGB888: + case QImage::Format_RGB444: + return true; + default: + break; + } + return false; +} void QDirectFBPixmapData::fill(const QColor &color) { @@ -197,72 +247,39 @@ void QDirectFBPixmapData::fill(const QColor &color) Q_ASSERT(dfbSurface); - if (color.alpha() < 255 && !hasAlphaChannel()) { - // convert to surface supporting alpha channel - DFBSurfacePixelFormat format; - dfbSurface->GetPixelFormat(dfbSurface, &format); - switch (format) { - case DSPF_YUY2: - case DSPF_UYVY: - format = DSPF_AYUV; - break; -#if (Q_DIRECTFB_VERSION >= 0x010100) - case DSPF_RGB444: - format = DSPF_ARGB4444; - break; - case DSPF_RGB555: -#endif - case DSPF_RGB18: - format = DSPF_ARGB6666; - break; - default: - format = DSPF_ARGB; - break; - } + alpha = (color.alpha() < 255); - DFBSurfaceDescription description; - description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | - DSDESC_HEIGHT | - DSDESC_PIXELFORMAT); - dfbSurface->GetSize(dfbSurface, &description.width, &description.height); - description.pixelformat = format; - screen->releaseDFBSurface(dfbSurface); // release old surface - - dfbSurface = screen->createDFBSurface(&description); + if (alpha && ::isOpaqueFormat(format)) { + QSize size; + dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight()); + screen->releaseDFBSurface(dfbSurface); + format = screen->alphaPixmapFormat(); + dfbSurface = screen->createDFBSurface(size, screen->alphaPixmapFormat(), QDirectFBScreen::TrackSurface); + forceRaster = false; + setSerialNumber(++global_ser_no); if (!dfbSurface) { - qWarning("QDirectFBPixmapData::fill()"); - setSerialNumber(0); + qWarning("QDirecttFBPixmapData::fill()"); + invalidate(); return; } } - dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), - color.alpha()); -} - -bool QDirectFBPixmapData::hasAlphaChannel() const -{ - if (!serialNumber()) - return false; - - DFBSurfacePixelFormat format; - dfbSurface->GetPixelFormat(dfbSurface, &format); - switch (format) { - case DSPF_ARGB1555: - case DSPF_ARGB: - case DSPF_LUT8: - case DSPF_AiRGB: - case DSPF_A1: - case DSPF_ARGB2554: - case DSPF_ARGB4444: - case DSPF_AYUV: - case DSPF_A4: - case DSPF_ARGB1666: - case DSPF_ARGB6666: - case DSPF_LUT2: - return true; - default: - return false; + if (forceRaster) { + // in DSPF_RGB32 all dfb drawing causes the Alpha byte to be + // set to 0. This causes issues for the raster engine. + char *mem; + int bpl; + const int h = QPixmapData::height(); + dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); + const int c = color.rgba(); + for (int i = 0; i < h; ++i) { + memset(mem, c, bpl); + mem += bpl; + } + dfbSurface->Unlock(dfbSurface); + } else { + dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), + color.alpha()); } } @@ -274,14 +291,12 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, { QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this); const QImage *image = that->buffer(); - if (image) { // avoid deep copy - const QImage transformed = image->transformed(transform, mode); - that->unlockDirectFB(); - QDirectFBPixmapData *data = new QDirectFBPixmapData(pixelType()); - data->fromImage(transformed, Qt::AutoColor); - return QPixmap(data); - } - return QPixmapData::transformed(transform, mode); + Q_ASSERT(image); + const QImage transformed = image->transformed(transform, mode); + that->unlockDirectFB(); + QDirectFBPixmapData *data = new QDirectFBPixmapData(QPixmapData::PixmapType); + data->fromImage(transformed, Qt::AutoColor); + return QPixmap(data); } int w, h; @@ -291,15 +306,23 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, if (size.isEmpty()) return QPixmap(); - QDirectFBPixmapData *data = new QDirectFBPixmapData(pixelType()); - data->resize(size.width(), size.height()); - - IDirectFBSurface *dest = data->dfbSurface; - dest->SetBlittingFlags(dest, DSBLIT_NOFX); + QDirectFBPixmapData *data = new QDirectFBPixmapData(QPixmapData::PixmapType); + DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; + data->alpha = alpha; + if (alpha) { + flags = DSBLIT_BLEND_ALPHACHANNEL; + } + data->dfbSurface = screen->createDFBSurface(size, + format, + QDirectFBScreen::TrackSurface); + if (flags & DSBLIT_BLEND_ALPHACHANNEL) { + data->dfbSurface->Clear(data->dfbSurface, 0, 0, 0, 0); + } + data->dfbSurface->SetBlittingFlags(data->dfbSurface, flags); - const DFBRectangle srcRect = { 0, 0, w, h }; const DFBRectangle destRect = { 0, 0, size.width(), size.height() }; - dest->StretchBlit(dest, dfbSurface, &srcRect, &destRect); + data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect); + data->dfbSurface->ReleaseSource(data->dfbSurface); return QPixmap(data); } @@ -309,39 +332,25 @@ QImage QDirectFBPixmapData::toImage() const if (!dfbSurface) return QImage(); -#ifdef QT_NO_DIRECTFB_PREALLOCATED - QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this); - const QImage *img = that->buffer(); - const QImage copied = img->copy(); - that->unlockDirectFB(); - return copied; -#else - - int w, h; - dfbSurface->GetSize(dfbSurface, &w, &h); - - // Always convert to ARGB32: - QImage image(w, h, QImage::Format_ARGB32); - - DFBSurfaceDescription description; - description = QDirectFBScreen::getSurfaceDescription(image); - - IDirectFBSurface *imgSurface = screen->createDFBSurface(&description); - if (!imgSurface) { - qWarning("QDirectFBPixmapData::toImage()"); - return QImage(); - } - - imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX); - DFBResult result = imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::toImage() blit failed", result); - return QImage(); +#ifndef QT_NO_DIRECTFB_PREALLOCATED + QImage ret(size(), QDirectFBScreen::getImageFormat(dfbSurface)); + if (IDirectFBSurface *imgSurface = screen->createDFBSurface(ret, QDirectFBScreen::DontTrackSurface)) { + if (hasAlphaChannel()) { + imgSurface->SetBlittingFlags(imgSurface, DSBLIT_BLEND_ALPHACHANNEL); + imgSurface->Clear(imgSurface, 0, 0, 0, 0); + } else { + imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX); + } + imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0); + imgSurface->ReleaseSource(imgSurface); + imgSurface->Release(imgSurface); + return ret; } - screen->releaseDFBSurface(imgSurface); +#endif - return image; -#endif // QT_NO_DIRECTFB_PREALLOCATED + QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this); + const QImage *img = that->buffer(); + return img->copy(); } QPaintEngine* QDirectFBPixmapData::paintEngine() const @@ -361,3 +370,10 @@ QImage* QDirectFBPixmapData::buffer() lockDirectFB(); return lockedImage; } + +void QDirectFBPixmapData::invalidate() +{ + setSerialNumber(0); + alpha = false; + format = QImage::Format_Invalid; +} diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index 32676f8..6cfafcd 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -64,7 +64,7 @@ public: void fromImage(const QImage &image, Qt::ImageConversionFlags flags); void copy(const QPixmapData *data, const QRect &rect); void fill(const QColor &color); - bool hasAlphaChannel() const; + inline bool hasAlphaChannel() const { return alpha; } QPixmap transformed(const QTransform &matrix, Qt::TransformationMode mode) const; QImage toImage() const; @@ -73,9 +73,12 @@ public: // Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice int metric(QPaintDevice::PaintDeviceMetric m) const {return QDirectFBPaintDevice::metric(m);} - + inline QImage::Format pixelFormat() const { return format; } private: + void invalidate(); QDirectFBPaintEngine *engine; + QImage::Format format; + bool alpha; }; QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 3249e65..041d522 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -81,13 +81,15 @@ public: QDirectFBKeyboardHandler *keyboard; #endif bool videoonly; + QImage::Format alphaPixmapFormat; }; QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen* screen) - : QWSGraphicsSystem(screen), dfb(0), dfbSurface(0), flipFlags(DSFLIP_BLIT) + : QWSGraphicsSystem(screen), dfb(0), dfbSurface(0), flipFlags(DSFLIP_NONE) #ifndef QT_NO_DIRECTFB_LAYER , dfbLayer(0) #endif + , dfbScreen(0) #ifndef QT_NO_DIRECTFB_MOUSE , mouse(0) #endif @@ -95,6 +97,7 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen* screen) , keyboard(0) #endif , videoonly(false) + , alphaPixmapFormat(QImage::Format_Invalid) { #ifndef QT_NO_QWS_SIGNALHANDLER QWSSignalHandler::instance()->addObject(this); @@ -129,7 +132,88 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate() dfb->Release(dfb); } -IDirectFBSurface* QDirectFBScreen::createDFBSurface(const DFBSurfaceDescription* desc, bool track) + + +// creates a preallocated surface with the same format as the image if +// possible. + +IDirectFBSurface* QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCreationOptions options) +{ + if (img.isNull()) // assert? + return 0; + if (QDirectFBScreen::getSurfacePixelFormat(img.format()) == DSPF_UNKNOWN) { + QImage image = img.convertToFormat(img.hasAlphaChannel() + ? d_ptr->alphaPixmapFormat + : pixelFormat()); + IDirectFBSurface *tmp = createDFBSurface(image, false); + if (!tmp) { + qWarning("Couldn't create surface createDFBSurface(QImage, bool)"); + return 0; + } + IDirectFBSurface *surface = copyDFBSurface(tmp, image.format(), options); + tmp->Release(tmp); + return surface; + } + + DFBSurfaceDescription desc = QDirectFBScreen::getSurfaceDescription(img); + IDirectFBSurface *surface = createDFBSurface(&desc, options); +#ifdef QT_NO_DIRECTFB_PREALLOCATED + if (surface) { + char *mem; + int bpl; + surface->Lock(surface, DSLF_WRITE, (void**)&mem, &bpl); + const int h = img.height(); + for (int i = 0; i < h; ++i) { + memcpy(mem, img.scanLine(i), bpl); + mem += bpl; + } + surface->Unlock(surface); + } +#endif +#ifndef QT_NO_DIRECTFB_PALETTE + if (img.numColors() != 0 && surface) + QDirectFBScreen::setSurfaceColorTable(surface, img); +#endif + return surface; +} + +IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src, + QImage::Format format, + SurfaceCreationOptions options) +{ + Q_ASSERT(src); + QSize size; + src->GetSize(src, &size.rwidth(), &size.rheight()); + IDirectFBSurface *surface = createDFBSurface(size, format, options); + DFBSurfacePixelFormat dspf; + src->GetPixelFormat(src, &dspf); + DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlpha(dspf) + ? DSBLIT_BLEND_ALPHACHANNEL + : DSBLIT_NOFX; + if (flags & DSBLIT_BLEND_ALPHACHANNEL) + surface->Clear(surface, 0, 0, 0, 0); + + surface->SetBlittingFlags(surface, flags); + surface->Blit(surface, src, 0, 0, 0); + surface->ReleaseSource(surface); + return surface; +} + +IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, + QImage::Format format, + SurfaceCreationOptions options) +{ + DFBSurfaceDescription desc; + desc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH|DSDESC_HEIGHT); + if (!QDirectFBScreen::initSurfaceDescriptionPixelFormat(&desc, format)) + return 0; + desc.width = size.width(); + desc.height = size.height(); + return createDFBSurface(&desc, options); +} + + +IDirectFBSurface* QDirectFBScreen::createDFBSurface(const DFBSurfaceDescription *desc, SurfaceCreationOptions options) { DFBResult result; IDirectFBSurface* newSurface = 0; @@ -142,22 +226,43 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const DFBSurfaceDescription* if (d_ptr->videoonly && !(desc->flags & DSDESC_PREALLOCATED)) { // Add the video only capability. This means the surface will be created in video ram DFBSurfaceDescription voDesc = *desc; - voDesc.caps = DFBSurfaceCapabilities(voDesc.caps | DSCAPS_VIDEOONLY); - voDesc.flags = DFBSurfaceDescriptionFlags(voDesc.flags | DSDESC_CAPS); + if (!(voDesc.flags & DSDESC_CAPS)) { + voDesc.caps = DSCAPS_VIDEOONLY; + voDesc.flags = DFBSurfaceDescriptionFlags(voDesc.flags | DSDESC_CAPS); + } else { + voDesc.caps = DFBSurfaceCapabilities(voDesc.caps | DSCAPS_VIDEOONLY); + } result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &voDesc, &newSurface); + if (result != DFB_OK +#ifdef QT_NO_DEBUG + && (desc->flags & DSDESC_CAPS) && (desc->caps & DSCAPS_PRIMARY) +#endif + ) { + qWarning("QDirectFBScreen::createDFBSurface() Failed to create surface in video memory!\n" + " Flags %0x Caps %0x width %d height %d pixelformat %0x %d preallocated %p %d\n%s", + desc->flags, desc->caps, desc->width, desc->height, + desc->pixelformat, DFB_PIXELFORMAT_INDEX(desc->pixelformat), + desc->preallocated[0].data, desc->preallocated[0].pitch, + DirectFBErrorString(result)); + } } if (!newSurface) result = d_ptr->dfb->CreateSurface(d_ptr->dfb, desc, &newSurface); if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::createDFBSurface", result); + qWarning("QDirectFBScreen::createDFBSurface() Failed!\n" + " Flags %0x Caps %0x width %d height %d pixelformat %0x %d preallocated %p %d\n%s", + desc->flags, desc->caps, desc->width, desc->height, + desc->pixelformat, DFB_PIXELFORMAT_INDEX(desc->pixelformat), + desc->preallocated[0].data, desc->preallocated[0].pitch, + DirectFBErrorString(result)); return 0; } Q_ASSERT(newSurface); - if (track) { + if (options & TrackSurface) { d_ptr->allocatedSurfaces.insert(newSurface); //qDebug("Created a new DirectFB surface at %p. New count = %d", @@ -167,8 +272,67 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const DFBSurfaceDescription* return newSurface; } -void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface* surface) +IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, + QImage::Format pixmapFormat, + SurfaceCreationOptions options) +{ + QImage image = img; + if (QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN +#ifdef QT_NO_DIRECTFB_PREALLOCATED + || image.format() != pixmapFormat +#endif +#ifdef QT_NO_DIRECTFB_PALETTE + || image.numColors() != 0 +#endif + ) { + image = image.convertToFormat(pixmapFormat); + } + + IDirectFBSurface *dfbSurface = createDFBSurface(image.size(), pixmapFormat, options); + if (!dfbSurface) { + qWarning("QDirectFBPixmapData::fromImage() Couldn't create surface"); + return 0; + } + +#ifndef QT_NO_DIRECTFB_PREALLOCATED + IDirectFBSurface *imgSurface = createDFBSurface(image, DontTrackSurface); + if (!imgSurface) { + qWarning("QDirectFBPixmapData::fromImage()"); + QDirectFBScreen::releaseDFBSurface(dfbSurface); + return 0; + } + + Q_ASSERT(imgSurface); + DFBSurfaceBlittingFlags flags = img.hasAlphaChannel() + ? DSBLIT_BLEND_ALPHACHANNEL + : DSBLIT_NOFX; + if (flags & DSBLIT_BLEND_ALPHACHANNEL) + dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); + + dfbSurface->SetBlittingFlags(dfbSurface, flags); + DFBResult result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0); + if (result != DFB_OK) + DirectFBError("QDirectFBPixmapData::fromImage()", result); + dfbSurface->ReleaseSource(dfbSurface); + imgSurface->Release(imgSurface); +#else // QT_NO_DIRECTFB_PREALLOCATED + Q_ASSERT(image.format() == pixmapFormat); + char *mem; + int bpl; + dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); + const int w = image.width() * image.depth() / 8; + for (int i = 0; i < image.height(); ++i) { + memcpy(mem, image.scanLine(i), w); + mem += bpl; + } + dfbSurface->Unlock(dfbSurface); +#endif + return dfbSurface; +} + +void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface) { + Q_ASSERT(QDirectFBScreen::instance()); Q_ASSERT(surface); surface->Release(surface); if (!d_ptr->allocatedSurfaces.remove(surface)) @@ -199,9 +363,9 @@ IDirectFBDisplayLayer* QDirectFBScreen::dfbDisplayLayer() } #endif -DFBSurfacePixelFormat QDirectFBScreen::getSurfacePixelFormat(const QImage &image) +DFBSurfacePixelFormat QDirectFBScreen::getSurfacePixelFormat(QImage::Format format) { - switch (image.format()) { + switch (format) { #ifndef QT_NO_DIRECTFB_PALETTE case QImage::Format_Indexed8: return DSPF_LUT8; @@ -232,8 +396,11 @@ DFBSurfacePixelFormat QDirectFBScreen::getSurfacePixelFormat(const QImage &image }; } -QImage::Format QDirectFBScreen::getImageFormat(DFBSurfacePixelFormat format) +QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface) { + DFBSurfacePixelFormat format; + surface->GetPixelFormat(surface, &format); + switch (format) { case DSPF_LUT8: return QImage::Format_Indexed8; @@ -256,8 +423,14 @@ QImage::Format QDirectFBScreen::getImageFormat(DFBSurfacePixelFormat format) return QImage::Format_RGB666; case DSPF_RGB32: return QImage::Format_RGB32; - case DSPF_ARGB: - return QImage::Format_ARGB32_Premultiplied; + case DSPF_ARGB: { + DFBSurfaceCapabilities caps; + const DFBResult result = surface->GetCapabilities(surface, &caps); + Q_ASSERT(result == DFB_OK); + Q_UNUSED(result); + return (caps & DSCAPS_PREMULTIPLIED + ? QImage::Format_ARGB32_Premultiplied + : QImage::Format_ARGB32); } default: break; } @@ -267,38 +440,32 @@ QImage::Format QDirectFBScreen::getImageFormat(DFBSurfacePixelFormat format) DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const QImage &image) { DFBSurfaceDescription description; - DFBSurfacePixelFormat format = getSurfacePixelFormat(image); + + const DFBSurfacePixelFormat format = getSurfacePixelFormat(image.format()); if (format == DSPF_UNKNOWN || image.isNull()) { description.flags = DFBSurfaceDescriptionFlags(0); return description; } - description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS - | DSDESC_WIDTH + description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT - | DSDESC_PIXELFORMAT - | DSDESC_PREALLOCATED); - - description.caps = DSCAPS_NONE; +#ifndef QT_NO_DIRECTFB_PREALLOCATED + | DSDESC_PREALLOCATED +#endif + | DSDESC_PIXELFORMAT); + QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description, image.format()); description.width = image.width(); description.height = image.height(); - description.pixelformat = format; +#ifndef QT_NO_DIRECTFB_PREALLOCATED description.preallocated[0].data = (void*)(image.bits()); description.preallocated[0].pitch = image.bytesPerLine(); description.preallocated[1].data = 0; description.preallocated[1].pitch = 0; +#endif - switch (image.format()) { - case QImage::Format_ARGB32_Premultiplied: - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_ARGB6666_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_ARGB4444_Premultiplied: + if (QDirectFBScreen::isPremultiplied(image.format())) description.caps = DSCAPS_PREMULTIPLIED; - default: - break; - } return description; } @@ -336,7 +503,7 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface, if (numColors == 0) return; - QVarLengthArray<DFBColor> colors(numColors); + QVarLengthArray<DFBColor, 256> colors(numColors); for (int i = 0; i < numColors; ++i) { QRgb c = image.color(i); colors[i].a = qAlpha(c); @@ -361,50 +528,6 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface, palette->Release(palette); } -void QDirectFBScreen::setImageColorTable(QImage *image, IDirectFBSurface *surface) -{ - if (!image || !surface || image->depth() > 8) - return; - - IDirectFBPalette *palette = 0; - unsigned int numColors = 0; - DFBResult result; - do { - result = surface->GetPalette(surface, &palette); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::setImageColorTable GetPalette", result); - break; - } - - result = palette->GetSize(palette, &numColors); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::setImageColorTable GetPalette", result); - break; - } - - if (numColors == 0) - break; - - QVarLengthArray<DFBColor> dfbColors(numColors); - result = palette->GetEntries(palette, dfbColors.data(), numColors, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::setImageColorTable GetPalette", result); - break; - } - - QVector<QRgb> qtColors(numColors); - for (unsigned int i=0; i<numColors; ++i) { - const DFBColor &col = dfbColors[i]; - qtColors[i] = qRgba(col.r, col.g, col.b, col.a); - } - image->setColorTable(qtColors); - - } while (0); - - if (palette) - palette->Release(palette); -} - #endif // QT_NO_DIRECTFB_PALETTE #if !defined(QT_NO_DIRECTFB_LAYER) && !defined(QT_NO_QWS_CURSOR) @@ -504,52 +627,43 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) } else if (!image.isNull() && implicitHide) { show(); } + cursor = image.convertToFormat(QDirectFBScreen::instance()->alphaPixmapFormat()); + + if (!image.isNull()) { + Q_ASSERT(cursor.numColors() == 0); + size = cursor.size(); + hotspot = QPoint(hotx, hoty); + + DFBSurfaceDescription description; + description = QDirectFBScreen::getSurfaceDescription(cursor); + + IDirectFBSurface *surface; + surface = QDirectFBScreen::instance()->createDFBSurface(&description, + QDirectFBScreen::TrackSurface); + if (!surface) { + qWarning("QDirectFBScreenCursor::set: Unable to create surface"); + return; + } + DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: " + "Unable to set cooperative level", result); + } + result = layer->SetCursorShape(layer, surface, hotx, hoty); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: Unable to set cursor shape", + result); + } -#ifdef QT_NO_DIRECTFB_PALETTE - if (image.numColors() > 0) - cursor = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); - else -#endif - if (image.format() == QImage::Format_Indexed8) { - cursor = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); - } else { - cursor = image; - } - size = cursor.size(); - hotspot = QPoint(hotx, hoty); - - DFBSurfaceDescription description; - description = QDirectFBScreen::getSurfaceDescription(cursor); - - IDirectFBSurface *surface; - surface = QDirectFBScreen::instance()->createDFBSurface(&description); - if (!surface) { - qWarning("QDirectFBScreenCursor::set: Unable to create surface"); - return; - } -#ifndef QT_NO_DIRECTFB_PALETTE - QDirectFBScreen::setSurfaceColorTable(surface, cursor); -#endif - - DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: " - "Unable to set cooperative level", result); - } - result = layer->SetCursorShape(layer, surface, hotx, hoty); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: Unable to set cursor shape", - result); - } + result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::set: " + "Unable to reset cooperative level", result); + } - result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: " - "Unable to reset cooperative level", result); + if (surface) + QDirectFBScreen::instance()->releaseDFBSurface(surface); } - - if (surface) - QDirectFBScreen::instance()->releaseDFBSurface(surface); } #endif // QT_NO_DIRECTFB_LAYER @@ -608,7 +722,7 @@ int QDirectFBScreen::depth(DFBSurfacePixelFormat format) void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args) { - QRegExp flipRegexp(QLatin1String("^flip=([\\w,]+)$")); + QRegExp flipRegexp(QLatin1String("^flip=([\\w,]*)$")); int index = args.indexOf(flipRegexp); if (index >= 0) { const QStringList flips = flipRegexp.cap(1).split(QLatin1Char(','), @@ -627,6 +741,8 @@ void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args) qWarning("QDirectFBScreen: Unknown flip argument: %s", qPrintable(flip)); } + } else { + flipFlags = DFBSurfaceFlipFlags(DSFLIP_BLIT); } } @@ -656,6 +772,18 @@ static void printDirectFBInfo(IDirectFB *fb) dev.blitting_flags, dev.drawing_flags, dev.video_memory); } +static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value) +{ + Q_ASSERT(value); + QRegExp rx(QString("%1=?(\\d+)").arg(variable)); + rx.setCaseSensitivity(Qt::CaseInsensitive); + if (arguments.indexOf(rx) != -1) { + *value = rx.cap(1).toInt(); + return true; + } + return false; +} + bool QDirectFBScreen::connect(const QString &displaySpec) { DFBResult result = DFB_OK; @@ -677,7 +805,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) } const QStringList displayArgs = displaySpec.split(QLatin1Char(':'), - QString::SkipEmptyParts); + QString::SkipEmptyParts); d_ptr->setFlipFlags(displayArgs); @@ -701,23 +829,57 @@ bool QDirectFBScreen::connect(const QString &displaySpec) DFBSurfaceDescription description; description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS); + if (::setIntOption(displayArgs, QLatin1String("width"), &description.width)) + description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH); + if (::setIntOption(displayArgs, QLatin1String("height"), &description.height)) + description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_HEIGHT); description.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY | DSCAPS_DOUBLE | DSCAPS_STATIC_ALLOC); - if (!(d_ptr->flipFlags & DSFLIP_BLIT)) { + if (displayArgs.contains(QLatin1String("forcepremultiplied"), + Qt::CaseInsensitive)) { description.caps = DFBSurfaceCapabilities(description.caps - | DSCAPS_DOUBLE - | DSCAPS_TRIPLE); + | DSCAPS_PREMULTIPLIED); } - // We don't track the primary surface as it's released in disconnect - d_ptr->dfbSurface = createDFBSurface(&description, false); + d_ptr->dfbSurface = createDFBSurface(&description, DontTrackSurface); if (!d_ptr->dfbSurface) { DirectFBError("QDirectFBScreen: error creating primary surface", result); return false; } + + // Work out what format we're going to use for surfaces with an alpha channel + d_ptr->alphaPixmapFormat = QDirectFBScreen::getImageFormat(d_ptr->dfbSurface); + setPixelFormat(d_ptr->alphaPixmapFormat); + switch (d_ptr->alphaPixmapFormat) { + case QImage::Format_RGB666: + d_ptr->alphaPixmapFormat = QImage::Format_ARGB6666_Premultiplied; + break; + case QImage::Format_RGB444: + d_ptr->alphaPixmapFormat = QImage::Format_ARGB4444_Premultiplied; + break; + case QImage::NImageFormats: + case QImage::Format_Invalid: + case QImage::Format_Mono: + case QImage::Format_MonoLSB: + case QImage::Format_Indexed8: + case QImage::Format_RGB32: + case QImage::Format_RGB888: + case QImage::Format_RGB16: + case QImage::Format_RGB555: + d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied; + break; + case QImage::Format_ARGB32: + case QImage::Format_ARGB32_Premultiplied: + case QImage::Format_ARGB4444_Premultiplied: + case QImage::Format_ARGB8555_Premultiplied: + case QImage::Format_ARGB8565_Premultiplied: + case QImage::Format_ARGB6666_Premultiplied: + // works already + break; + } d_ptr->dfbSurface->GetSize(d_ptr->dfbSurface, &w, &h); data = 0; @@ -733,21 +895,11 @@ bool QDirectFBScreen::connect(const QString &displaySpec) else DirectFBError("QDirectFBScreen: error getting surface format", result); - setPixelFormat(getImageFormat(format)); + setPixelFormat(getImageFormat(d_ptr->dfbSurface)); physWidth = physHeight = -1; - QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); - int dimIdxW = displayArgs.indexOf(mmWidthRx); - if (dimIdxW >= 0) { - mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); - physWidth = mmWidthRx.cap(1).toInt(); - } - QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); - int dimIdxH = displayArgs.indexOf(mmHeightRx); - if (dimIdxH >= 0) { - mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); - physHeight = mmHeightRx.cap(1).toInt(); - } + ::setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth); + ::setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight); const int dpi = 72; if (physWidth < 0) physWidth = qRound(dw * 25.4 / dpi); @@ -855,19 +1007,21 @@ void QDirectFBScreen::blank(bool on) QWSWindowSurface* QDirectFBScreen::createSurface(QWidget *widget) const { #ifdef QT_NO_DIRECTFB_WM - if (QApplication::type() == QApplication::GuiServer) - return new QDirectFBSurface(const_cast<QDirectFBScreen*>(this), widget); - else + if (QApplication::type() == QApplication::GuiServer) { + return new QDirectFBSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this), widget); + } else { return QScreen::createSurface(widget); + } #else - return new QDirectFBSurface(const_cast<QDirectFBScreen*>(this), widget); + return new QDirectFBSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this), widget); #endif } QWSWindowSurface* QDirectFBScreen::createSurface(const QString &key) const { - if (key == QLatin1String("directfb")) - return new QDirectFBSurface(const_cast<QDirectFBScreen*>(this)); + if (key == QLatin1String("directfb")) { + return new QDirectFBSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this)); + } return QScreen::createSurface(key); } @@ -900,7 +1054,7 @@ void QDirectFBScreen::compose(const QRegion ®ion) if (surface->key() == QLatin1String("directfb")) { QDirectFBSurface *s = static_cast<QDirectFBSurface*>(surface); - blit(s->directFbSurface(), offset, r); + blit(s->directFBSurface(), offset, r); } else { blit(surface->image(), offset, r); } @@ -949,11 +1103,12 @@ void QDirectFBScreen::compose(const QRegion ®ion) if (surface->key() == QLatin1String("directfb")) { QDirectFBSurface *s = static_cast<QDirectFBSurface*>(surface); - blit(s->directFbSurface(), offset, r); + blit(s->directFBSurface(), offset, r); } else { blit(surface->image(), offset, r); } } + d_ptr->dfbSurface->ReleaseSource(d_ptr->dfbSurface); } // Normally, when using DirectFB to compose the windows (I.e. when @@ -995,21 +1150,14 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing) void QDirectFBScreen::blit(const QImage &img, const QPoint &topLeft, const QRegion ®) { - IDirectFBSurface *src = 0; - DFBSurfaceDescription description = getSurfaceDescription(img); - - src = createDFBSurface(&description); + IDirectFBSurface *src = createDFBSurface(img, QDirectFBScreen::DontTrackSurface); if (!src) { qWarning("QDirectFBScreen::blit(): Error creating surface"); return; } -#ifndef QT_NO_DIRECTFB_PALETTE - setSurfaceColorTable(d_ptr->dfbSurface, img); -#endif - blit(src, topLeft, reg); - - releaseDFBSurface(src); + d_ptr->dfbSurface->ReleaseSource(d_ptr->dfbSurface); + src->Release(src); } void QDirectFBScreen::blit(IDirectFBSurface *src, const QPoint &topLeft, @@ -1045,20 +1193,51 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) if (region.isEmpty()) return; - const QVector<QRect> rects = region.rects(); - QVarLengthArray<DFBRectangle> dfbRects(rects.size()); - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i); - dfbRects[i].x = r.x(); - dfbRects[i].y = r.y(); - dfbRects[i].w = r.width(); - dfbRects[i].h = r.height(); + if (QDirectFBScreen::getImageFormat(d_ptr->dfbSurface) == QImage::Format_RGB32) { + uchar *mem; + int bpl; + d_ptr->dfbSurface->Lock(d_ptr->dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); + QImage img(mem, w, h, bpl, QImage::Format_RGB32); + QPainter p(&img); + p.setBrush(color); + p.setPen(Qt::NoPen); + const QVector<QRect> rects = region.rects(); + p.drawRects(rects.constData(), rects.size()); + p.end(); + d_ptr->dfbSurface->Unlock(d_ptr->dfbSurface); + } else { + d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface, + color.red(), color.green(), color.blue(), + color.alpha()); + const QVector<QRect> rects = region.rects(); + for (int i=0; i<rects.size(); ++i) { + const QRect &r = rects.at(i); + d_ptr->dfbSurface->FillRectangle(d_ptr->dfbSurface, + r.x(), r.y(), r.width(), r.height()); + } } +} - d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface, - color.red(), color.green(), color.blue(), - color.alpha()); - d_ptr->dfbSurface->FillRectangles(d_ptr->dfbSurface, dfbRects.data(), - dfbRects.size()); +QImage::Format QDirectFBScreen::alphaPixmapFormat() const +{ + return d_ptr->alphaPixmapFormat; } +bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, + QImage::Format format) +{ + const DFBSurfacePixelFormat pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); + if (pixelformat == DSPF_UNKNOWN) + return false; + description->flags = DFBSurfaceDescriptionFlags(description->flags | DSDESC_PIXELFORMAT); + description->pixelformat = pixelformat; + if (QDirectFBScreen::isPremultiplied(format)) { + if (!(description->flags & DSDESC_CAPS)) { + description->caps = DSCAPS_PREMULTIPLIED; + description->flags = DFBSurfaceDescriptionFlags(description->flags | DSDESC_CAPS); + } else { + description->caps = DFBSurfaceCapabilities(description->caps | DSCAPS_PREMULTIPLIED); + } + } + return true; +} diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index e9a2f63..f394ac1 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -88,23 +88,43 @@ public: #endif // Track surface creation/release so we can release all on exit - IDirectFBSurface* createDFBSurface(const DFBSurfaceDescription* desc, bool track = true); + enum SurfaceCreationOption { + DontTrackSurface = 0, + TrackSurface = 1 + }; + Q_DECLARE_FLAGS(SurfaceCreationOptions, SurfaceCreationOption); + IDirectFBSurface *createDFBSurface(const DFBSurfaceDescription *desc, + SurfaceCreationOptions options); + IDirectFBSurface *createDFBSurface(const QImage &image, + SurfaceCreationOptions options); + IDirectFBSurface *createDFBSurface(const QSize &size, + QImage::Format format, + SurfaceCreationOptions options); + IDirectFBSurface *copyDFBSurface(IDirectFBSurface *src, + QImage::Format format, + SurfaceCreationOptions options); + IDirectFBSurface *copyToDFBSurface(const QImage &image, + QImage::Format format, + SurfaceCreationOptions options); void releaseDFBSurface(IDirectFBSurface* surface); + bool preferVideoOnly() const; static int depth(DFBSurfacePixelFormat format); - static DFBSurfacePixelFormat getSurfacePixelFormat(const QImage &image); + static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format); static DFBSurfaceDescription getSurfaceDescription(const QImage &image); static DFBSurfaceDescription getSurfaceDescription(const uint *buffer, int length); - static QImage::Format getImageFormat(DFBSurfacePixelFormat format); + static QImage::Format getImageFormat(IDirectFBSurface *surface); + static bool initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, QImage::Format format); static inline bool isPremultiplied(QImage::Format format); + static inline bool hasAlpha(DFBSurfacePixelFormat format); + QImage::Format alphaPixmapFormat() const; #ifndef QT_NO_DIRECTFB_PALETTE static void setSurfaceColorTable(IDirectFBSurface *surface, const QImage &image); - static void setImageColorTable(QImage *image, IDirectFBSurface *surface); #endif private: @@ -115,6 +135,8 @@ private: QDirectFBScreenPrivate *d_ptr; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions); + inline bool QDirectFBScreen::isPremultiplied(QImage::Format format) { switch (format) { @@ -130,6 +152,26 @@ inline bool QDirectFBScreen::isPremultiplied(QImage::Format format) return false; } +inline bool QDirectFBScreen::hasAlpha(DFBSurfacePixelFormat format) +{ + switch (format) { + case DSPF_ARGB1555: + case DSPF_ARGB: + case DSPF_LUT8: + case DSPF_AiRGB: + case DSPF_A1: + case DSPF_ARGB2554: + case DSPF_ARGB4444: + case DSPF_AYUV: + case DSPF_A4: + case DSPF_ARGB1666: + case DSPF_ARGB6666: + case DSPF_LUT2: + return true; + default: + return false; + } +} QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp index ab1d0f1..8ed308c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp @@ -50,28 +50,38 @@ //#define QT_DIRECTFB_DEBUG_SURFACES 1 -QDirectFBSurface::QDirectFBSurface(QDirectFBScreen* scr) +QDirectFBSurface::QDirectFBSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen* scr) : QDirectFBPaintDevice(scr) #ifndef QT_NO_DIRECTFB_WM , dfbWindow(0) #endif , engine(0) + , flipFlags(flip) { setSurfaceFlags(Opaque | Buffered); +#ifdef QT_DIRECTFB_TIMING + frames = 0; + timer.start(); +#endif } -QDirectFBSurface::QDirectFBSurface(QDirectFBScreen* scr, QWidget *widget) +QDirectFBSurface::QDirectFBSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget) : QWSWindowSurface(widget), QDirectFBPaintDevice(scr) #ifndef QT_NO_DIRECTFB_WM , dfbWindow(0) #endif , engine(0) + , flipFlags(flip) { onscreen = widget->testAttribute(Qt::WA_PaintOnScreen); if (onscreen) setSurfaceFlags(Opaque | RegionReserved); else setSurfaceFlags(Opaque | Buffered); +#ifdef QT_DIRECTFB_TIMING + frames = 0; + timer.start(); +#endif } QDirectFBSurface::~QDirectFBSurface() @@ -86,14 +96,26 @@ bool QDirectFBSurface::isValid() const #ifndef QT_NO_DIRECTFB_WM void QDirectFBSurface::createWindow() { +#ifdef QT_NO_DIRECTFB_LAYER +#warning QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM +#else IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); if (!layer) qFatal("QDirectFBWindowSurface: Unable to get primary display layer!"); - DFBWindowDescription description; - description.caps = DFBWindowCapabilities(DWCAPS_NODECORATION | - DWCAPS_ALPHACHANNEL); - description.flags = DWDESC_CAPS; + DFBWindowDescription description; + description.caps = DFBWindowCapabilities(DWCAPS_NODECORATION); + description.flags = DFBWindowDescriptionFlags(DWDESC_CAPS + |DWDESC_SURFACE_CAPS + |DWDESC_PIXELFORMAT); + + description.surface_caps = DSCAPS_NONE; + if (screen->preferVideoOnly()) + description.surface_caps = DFBSurfaceCapabilities(description.surface_caps|DSCAPS_VIDEOONLY); + const QImage::Format format = screen->pixelFormat(); + description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); + if (QDirectFBScreen::isPremultiplied(format)) + description.surface_caps = DFBSurfaceCapabilities(DSCAPS_PREMULTIPLIED|description.caps); DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow); if (result != DFB_OK) @@ -103,6 +125,8 @@ void QDirectFBSurface::createWindow() dfbSurface->Release(dfbSurface); dfbWindow->GetSurface(dfbWindow, &dfbSurface); + forceRaster = (format == QImage::Format_RGB32); +#endif } #endif // QT_NO_DIRECTFB_WM @@ -115,26 +139,32 @@ void QDirectFBSurface::setGeometry(const QRect &rect, const QRegion &mask) dfbWindow = 0; } #endif - if (dfbSurface) { + if (dfbSurface && dfbSurface != screen->dfbSurface()) { dfbSurface->Release(dfbSurface); dfbSurface = 0; } } else if (rect != geometry()) { - const bool isResize = rect.size() != geometry().size(); DFBResult result = DFB_OK; // If we're in a resize, the surface shouldn't be locked - Q_ASSERT( (lockedImage == 0) || (isResize == false)); + Q_ASSERT((lockedImage == 0) || (rect.size() == geometry().size())); - IDirectFBSurface *s = screen->dfbSurface(); - if (onscreen && s) { - if (dfbSurface) + if (onscreen) { + IDirectFBSurface *primarySurface = screen->dfbSurface(); + Q_ASSERT(primarySurface); + if (dfbSurface && dfbSurface != primarySurface) dfbSurface->Release(dfbSurface); - DFBRectangle r = { rect.x(), rect.y(), - rect.width(), rect.height() }; - result = s->GetSubSurface(s, &r, &dfbSurface); + if (rect == screen->region().boundingRect()) { + dfbSurface = primarySurface; + } else { + const DFBRectangle r = { rect.x(), rect.y(), + rect.width(), rect.height() }; + result = primarySurface->GetSubSurface(primarySurface, &r, &dfbSurface); + } + forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32); } else { + const bool isResize = rect.size() != geometry().size(); #ifdef QT_NO_DIRECTFB_WM if (isResize) { if (dfbSurface) @@ -152,9 +182,10 @@ void QDirectFBSurface::setGeometry(const QRect &rect, const QRegion &mask) DSDESC_PIXELFORMAT); description.width = rect.width(); description.height = rect.height(); - description.pixelformat = DSPF_ARGB; - - dfbSurface = QDirectFBScreen::instance()->createDFBSurface(&description, false); + QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description, + screen->pixelFormat()); + dfbSurface = screen->createDFBSurface(&description, false); + forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32); } else { Q_ASSERT(dfbSurface); } @@ -219,7 +250,7 @@ void QDirectFBSurface::setPermanentState(const QByteArray &state) bool QDirectFBSurface::scroll(const QRegion ®ion, int dx, int dy) { - if (!dfbSurface) + if (!dfbSurface || !(flipFlags & DSFLIP_BLIT)) return false; const QVector<QRect> rects = region.rects(); @@ -241,7 +272,7 @@ bool QDirectFBSurface::scroll(const QRegion ®ion, int dx, int dy) dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); dfbSurface->BatchBlit(dfbSurface, dfbSurface, dfbRects.data(), dfbPoints.data(), n); - + dfbSurface->ReleaseSource(dfbSurface); return true; } @@ -306,10 +337,15 @@ inline bool isWidgetOpaque(const QWidget *w) return false; } - void QDirectFBSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { + Q_UNUSED(widget); +#ifdef QT_NO_DIRECTFB_WM + Q_UNUSED(region); + Q_UNUSED(offset); +#endif + QWidget *win = window(); // hw: make sure opacity information is updated before compositing @@ -330,18 +366,41 @@ void QDirectFBSurface::flush(QWidget *widget, const QRegion ®ion, if (winOpacity != opacity) dfbWindow->SetOpacity(dfbWindow, winOpacity); } + if (!(flipFlags & DSFLIP_BLIT)) { + dfbSurface->Flip(dfbSurface, 0, flipFlags); + } else { + if (region.numRects() > 1) { + const QVector<QRect> rects = region.rects(); + DFBSurfaceFlipFlags tmpFlags = flipFlags; + if (flipFlags & DSFLIP_WAIT) + tmpFlags = DFBSurfaceFlipFlags(flipFlags & ~DSFLIP_WAIT); + for (int i=0; i<rects.size(); ++i) { + const QRect &r = rects.at(i); + const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(), + r.x() + r.width() + offset.x(), + r.y() + r.height() + offset.y() }; + dfbSurface->Flip(dfbSurface, &dfbReg, + i + 1 < rects.size() + ? tmpFlags + : flipFlags); + } + } else { + const QRect r = region.boundingRect(); + const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(), + r.x() + r.width() + offset.x(), + r.y() + r.height() + offset.y() }; + dfbSurface->Flip(dfbSurface, &dfbReg, flipFlags); + } + } #endif - - // XXX: have to call the base function first as the decoration is - // currently painted there - QWSWindowSurface::flush(widget, region, offset); - -#ifndef QT_NO_DIRECTFB_WM - const QRect br = region.boundingRect().translated(painterOffset()); - const DFBRegion r = { br.x(), br.y(), - br.x() + br.width(), br.y() + br.height() }; - - dfbSurface->Flip(dfbSurface, &r, DSFLIP_NONE); +#ifdef QT_DIRECTFB_TIMING + enum { Secs = 3 }; + ++frames; + if (timer.elapsed() >= Secs * 1000) { + qDebug("%d fps", int(double(frames) / double(Secs))); + frames = 0; + timer.restart(); + } #endif } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h index a9cdb7d..ab4145d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h @@ -50,6 +50,10 @@ #include <private/qwindowsurface_qws_p.h> #include <directfb.h> +#ifdef QT_DIRECTFB_TIMING +#include <qdatetime.h> +#endif + QT_BEGIN_HEADER QT_MODULE(Gui) @@ -57,8 +61,8 @@ QT_MODULE(Gui) class QDirectFBSurface: public QWSWindowSurface, public QDirectFBPaintDevice { public: - QDirectFBSurface(QDirectFBScreen* scr); - QDirectFBSurface(QDirectFBScreen* scr, QWidget *widget); + QDirectFBSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen* scr); + QDirectFBSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen* scr, QWidget *widget); ~QDirectFBSurface(); bool isValid() const; @@ -95,6 +99,11 @@ private: bool onscreen; QList<QImage*> bufferImages; + DFBSurfaceFlipFlags flipFlags; +#ifdef QT_DIRECTFB_TIMING + int frames; + QTime timer; +#endif }; QT_END_HEADER diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index b830066..ec02efb 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -8,6 +8,9 @@ is built as two libraries: The actual QScreen plugin used by Qt (in the pvreglscreen directory) and a WSEGL plugin for the PowerVR drivers (in the QWSWSEGL directory). +Qt/Embedded needs to be configured with the QT_QWS_CLIENTBLIT and +QT_NO_QWS_CURSOR defines. + The PowerVR drivers provide the WSEGL plugin API to allow window systems such as QWS to integrate correctly. In order to use the integration, the WSEGL plugin (libpvrQWSWSEGL.so, usually installed into the Qt library directory) must be in diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index 3a94851..b0ffbf1 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -381,7 +381,7 @@ void PvrEglSurfaceHolder::removeSurface() // create the temporary surface again. if (surface == EGL_NO_SURFACE && dpy != EGL_NO_DISPLAY) { surface = eglCreateWindowSurface - (dpy, config, (EGLNativeWindowType)tempSurface, NULL); + (dpy, config, (EGLNativeWindowType)(-1), NULL); if (surface == EGL_NO_SURFACE) qWarning("Could not re-create the temporary EGL surface"); } diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 31e5c66..6d0bc1f 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -809,7 +809,7 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, if (params.contains(QLatin1String("GetHeaderInformation"))) { if (!ensureValidImage(outImage, &cinfo, true)) - return false; + longjmp(jerr.setjmp_buffer, 1); } else if (params.contains(QLatin1String("Scale"))) { #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) sscanf_s(params.toLatin1().data(), "Scale(%i, %i, %1023s)", @@ -848,7 +848,7 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, // Unsupported format } if (outImage->isNull()) - return false; + longjmp(jerr.setjmp_buffer, 1); if (!outImage->isNull()) { QImage tmpImage(cinfo.output_width, 1, QImage::Format_RGB32); @@ -894,7 +894,7 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, #endif } else { if (!ensureValidImage(outImage, &cinfo)) - return false; + longjmp(jerr.setjmp_buffer, 1); uchar* data = outImage->bits(); int bpl = outImage->bytesPerLine(); diff --git a/src/qt3support/itemviews/q3listview.cpp b/src/qt3support/itemviews/q3listview.cpp index 1ebee42..1effdaa 100644 --- a/src/qt3support/itemviews/q3listview.cpp +++ b/src/qt3support/itemviews/q3listview.cpp @@ -3126,7 +3126,8 @@ void Q3ListView::clear() if (wasUpdatesEnabled) viewport()->setUpdatesEnabled(false); setContentsPos(0, 0); - viewport()->setUpdatesEnabled(wasUpdatesEnabled); + if (wasUpdatesEnabled) + viewport()->setUpdatesEnabled(true); bool block = signalsBlocked(); blockSignals(true); diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp index c058e37..e508001 100644 --- a/src/qt3support/text/q3richtext.cpp +++ b/src/qt3support/text/q3richtext.cpp @@ -4895,7 +4895,8 @@ void Q3TextParagraph::drawString(QPainter &painter, const QString &str, int star bool extendRight = false; bool extendLeft = false; bool selWrap = (real_selEnd == length()-1 && n && n->hasSelection(it.key())); - if (selWrap || this->str->at(real_selEnd).lineStart) { + if (selWrap + || ((real_selEnd < this->str->length()) && this->str->at(real_selEnd).lineStart)) { extendRight = (fullSelectionWidth != 0); if (!extendRight && !rightToLeft) tmpw += painter.fontMetrics().width(QLatin1Char(' ')); diff --git a/src/script/qscriptengine.cpp b/src/script/qscriptengine.cpp index d4e1923..d8908ed 100644 --- a/src/script/qscriptengine.cpp +++ b/src/script/qscriptengine.cpp @@ -1169,7 +1169,8 @@ bool QScriptEngine::convert(const QScriptValue &value, int type, void *ptr) bool QScriptEngine::convertV2(const QScriptValue &value, int type, void *ptr) { QScriptValueImpl impl = QScriptValuePrivate::valueOf(value); - return QScriptEnginePrivate::convert(impl, type, ptr, /*engine=*/0); + QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(value.engine()); + return QScriptEnginePrivate::convert(impl, type, ptr, eng_p); } /*! diff --git a/src/scripttools/debugging/qscriptbreakpointswidget.cpp b/src/scripttools/debugging/qscriptbreakpointswidget.cpp index aea1fe7..efb3047 100644 --- a/src/scripttools/debugging/qscriptbreakpointswidget.cpp +++ b/src/scripttools/debugging/qscriptbreakpointswidget.cpp @@ -225,7 +225,6 @@ public: bool eventFilter(QObject *editor, QEvent *event) { -#if QT_VERSION >= 0x040500 if (QLineEdit *le = qobject_cast<QLineEdit*>(editor)) { if (event->type() == QEvent::KeyPress) { int key = static_cast<QKeyEvent*>(event)->key(); @@ -237,21 +236,18 @@ public: } } } -#endif return QStyledItemDelegate::eventFilter(editor, event); } void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { -#if QT_VERSION >= 0x040500 if (index.column() == 2) { // check that the syntax is OK QString condition = qobject_cast<QLineEdit*>(editor)->text(); if (QScriptEngine::checkSyntax(condition).state() != QScriptSyntaxCheckResult::Valid) return; } -#endif QStyledItemDelegate::setModelData(editor, model, index); } @@ -261,11 +257,7 @@ private Q_SLOTS: QWidget *editor = qobject_cast<QWidget*>(sender()); QPalette pal = editor->palette(); QColor col; -#if QT_VERSION >= 0x040500 bool ok = (QScriptEngine::checkSyntax(text).state() == QScriptSyntaxCheckResult::Valid); -#else - bool ok = true; -#endif if (ok) { col = Qt::white; } else { diff --git a/src/scripttools/debugging/qscriptcompletiontask.cpp b/src/scripttools/debugging/qscriptcompletiontask.cpp index 3767505..119b96a 100644 --- a/src/scripttools/debugging/qscriptcompletiontask.cpp +++ b/src/scripttools/debugging/qscriptcompletiontask.cpp @@ -162,11 +162,7 @@ void QScriptCompletionTaskPrivate::completeScriptExpression() obj = ctx->thisObject(); } else { QScriptValueList scopeChain; -#if QT_VERSION >= 0x040500 scopeChain = ctx->scopeChain(); -#else - scopeChain.append(ctx->activationObject()); -#endif for (int i = 0; i < scopeChain.size(); ++i) { QScriptValue oo = scopeChain.at(i).property(topLevelIdent); if (oo.isObject()) { @@ -180,11 +176,7 @@ void QScriptCompletionTaskPrivate::completeScriptExpression() if (obj.isValid()) objects.append(obj); } else { -#if QT_VERSION >= 0x040500 objects << ctx->scopeChain(); -#else - objects.append(ctx->activationObject()); -#endif QStringList keywords; keywords.append(QString::fromLatin1("this")); keywords.append(QString::fromLatin1("true")); diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp index 5a356ae..ce43572 100644 --- a/src/scripttools/debugging/qscriptdebugger.cpp +++ b/src/scripttools/debugging/qscriptdebugger.cpp @@ -663,11 +663,7 @@ QString QScriptDebuggerPrivate::toolTip(int frameIndex, int lineNumber, objects.append(ctx->thisObject()); ++pathIndex; } else { -#if QT_VERSION >= 0x040500 objects << ctx->scopeChain(); -#else - objects.append(ctx->activationObject()); -#endif } for (int i = 0; i < objects.size(); ++i) { QScriptValue val = objects.at(i); @@ -991,13 +987,11 @@ public: qint64 scriptId = m_added.at(m_index); m_debugger->scriptsModel->addScript(scriptId, data); -#if QT_VERSION >= 0x040500 // ### could be slow, might want to do this in a separate thread QString xml = qt_scriptToXml(data.contents(), data.baseLineNumber()); QScriptXmlParser::Result extraInfo = QScriptXmlParser::parse(xml); m_debugger->scriptsModel->addExtraScriptInfo( scriptId, extraInfo.functionsInfo, extraInfo.executableLineNumbers); -#endif if (++m_index < m_added.size()) frontend.scheduleGetScriptData(m_added.at(m_index)); diff --git a/src/scripttools/debugging/qscriptdebuggeragent.cpp b/src/scripttools/debugging/qscriptdebuggeragent.cpp index fcba033..0ea9c99 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent.cpp +++ b/src/scripttools/debugging/qscriptdebuggeragent.cpp @@ -88,16 +88,9 @@ QScriptDebuggerAgentPrivate *QScriptDebuggerAgentPrivate::get( */ QScriptDebuggerAgent::QScriptDebuggerAgent( QScriptDebuggerBackendPrivate *backend, QScriptEngine *engine) -#if QT_VERSION >= 0x040500 : QScriptEngineAgent(*new QScriptDebuggerAgentPrivate, engine) -#else - : QScriptEngineAgent(engine), d_ptr(new QScriptDebuggerAgentPrivate) -#endif { Q_D(QScriptDebuggerAgent); -#if QT_VERSION < 0x040500 - d_ptr->q_ptr = this; -#endif d->backend = backend; QScriptContext *ctx = engine->currentContext(); @@ -117,9 +110,6 @@ QScriptDebuggerAgent::~QScriptDebuggerAgent() Q_D(QScriptDebuggerAgent); if (d->backend) d->backend->agentDestroyed(this); -#if QT_VERSION < 0x040500 - delete d_ptr; -#endif } /*! @@ -712,12 +702,7 @@ void QScriptDebuggerAgent::exceptionCatch(qint64 scriptId, */ bool QScriptDebuggerAgent::supportsExtension(Extension extension) const { -#if QT_VERSION >= 0x040500 return (extension == DebuggerInvocationRequest); -#else - Q_UNUSED(extension); - return false; -#endif } /*! @@ -727,7 +712,6 @@ QVariant QScriptDebuggerAgent::extension(Extension extension, const QVariant &argument) { Q_UNUSED(extension); -#if QT_VERSION >= 0x040500 Q_D(QScriptDebuggerAgent); Q_ASSERT(extension == DebuggerInvocationRequest); QVariantList lst = argument.toList(); @@ -739,9 +723,6 @@ QVariant QScriptDebuggerAgent::extension(Extension extension, d->backend->debuggerInvocationRequest( scriptId, lineNumber, columnNumber); } -#else - Q_UNUSED(argument); -#endif return QVariant(); } diff --git a/src/scripttools/debugging/qscriptdebuggeragent_p.h b/src/scripttools/debugging/qscriptdebuggeragent_p.h index 556b17b..28ec46a 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent_p.h +++ b/src/scripttools/debugging/qscriptdebuggeragent_p.h @@ -125,9 +125,6 @@ public: const QVariant &argument = QVariant()); private: -#if QT_VERSION < 0x040500 - QScriptDebuggerAgentPrivate *d_ptr; -#endif Q_DECLARE_PRIVATE(QScriptDebuggerAgent) Q_DISABLE_COPY(QScriptDebuggerAgent) }; diff --git a/src/scripttools/debugging/qscriptdebuggeragent_p_p.h b/src/scripttools/debugging/qscriptdebuggeragent_p_p.h index cf6fd1a..313b1c0 100644 --- a/src/scripttools/debugging/qscriptdebuggeragent_p_p.h +++ b/src/scripttools/debugging/qscriptdebuggeragent_p_p.h @@ -68,9 +68,7 @@ QT_BEGIN_NAMESPACE class QScriptDebuggerAgent; class QScriptDebuggerAgentPrivate -#if QT_VERSION >= 0x040500 : public QScriptEngineAgentPrivate -#endif { Q_DECLARE_PUBLIC(QScriptDebuggerAgent) public: @@ -125,10 +123,6 @@ public: int statementCounter; QScriptDebuggerBackendPrivate *backend; - -#if QT_VERSION < 0x040500 - QScriptDebuggerAgent *q_ptr; -#endif }; QT_END_NAMESPACE diff --git a/src/scripttools/debugging/qscriptdebuggerbackend.cpp b/src/scripttools/debugging/qscriptdebuggerbackend.cpp index 24a3847..3c29130 100644 --- a/src/scripttools/debugging/qscriptdebuggerbackend.cpp +++ b/src/scripttools/debugging/qscriptdebuggerbackend.cpp @@ -615,13 +615,11 @@ void QScriptDebuggerBackend::doPendingEvaluate(bool postEvent) // push a new context and initialize its scope chain etc. { QScriptContext *evalContext = engine()->pushContext(); -#if QT_VERSION >= 0x040500 QScriptValueList scopeChain = ctx->scopeChain(); if (scopeChain.isEmpty()) scopeChain.append(engine()->globalObject()); while (!scopeChain.isEmpty()) evalContext->pushScope(scopeChain.takeLast()); -#endif evalContext->setActivationObject(ctx->activationObject()); evalContext->setThisObject(ctx->thisObject()); } diff --git a/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp b/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp index e36386d..1be8c5f 100644 --- a/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp +++ b/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp @@ -287,13 +287,9 @@ QScriptDebuggerResponse QScriptDebuggerCommandExecutor::execute( QScriptContext *ctx = backend->context(command.contextIndex()); if (ctx) { QScriptDebuggerValueList dest; -#if QT_VERSION >= 0x040500 QScriptValueList src = ctx->scopeChain(); for (int i = 0; i < src.size(); ++i) dest.append(src.at(i)); -#else - dest.append(ctx->activationObject()); -#endif response.setResult(dest); } else { response.setError(QScriptDebuggerResponse::InvalidContextIndex); diff --git a/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp b/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp index 0018b92..f923508 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp +++ b/src/scripttools/debugging/qscriptdebuggerconsoleglobalobject.cpp @@ -448,12 +448,7 @@ QStringList QScriptDebuggerConsoleGlobalObject::getCommandCompletions(const QStr bool QScriptDebuggerConsoleGlobalObject::checkSyntax(const QString &program) { -#if QT_VERSION >= 0x040500 return (QScriptEngine::checkSyntax(program).state() == QScriptSyntaxCheckResult::Valid); -#else - Q_UNUSED(program); - return true; -#endif } void QScriptDebuggerConsoleGlobalObject::setEvaluateAction(int action) diff --git a/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp b/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp index a4919be..60fe48d 100644 --- a/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp +++ b/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp @@ -206,11 +206,7 @@ private Q_SLOTS: QWidget *editor = qobject_cast<QWidget*>(sender()); QPalette pal = editor->palette(); QColor col; -#if QT_VERSION >= 0x040500 bool ok = (QScriptEngine::checkSyntax(text).state() == QScriptSyntaxCheckResult::Valid); -#else - bool ok = true; -#endif if (ok) { col = Qt::white; } else { @@ -277,12 +273,10 @@ bool QScriptDebuggerLocalsItemDelegate::eventFilter(QObject *watched, QEvent *ev return QStyledItemDelegate::eventFilter(watched, event); QKeyEvent *ke = static_cast<QKeyEvent*>(event); if ((ke->key() == Qt::Key_Enter) || (ke->key() == Qt::Key_Return)) { -#if QT_VERSION >= 0x040500 if (QScriptEngine::checkSyntax(le->text()).state() != QScriptSyntaxCheckResult::Valid) { // ignore when script contains syntax error return true; } -#endif } if (ke->key() != Qt::Key_Tab) return QStyledItemDelegate::eventFilter(watched, event); @@ -296,14 +290,12 @@ void QScriptDebuggerLocalsItemDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { -#if QT_VERSION >= 0x040500 if (index.column() == 1) { // check that the syntax is OK QString expression = qobject_cast<QLineEdit*>(editor)->text(); if (QScriptEngine::checkSyntax(expression).state() != QScriptSyntaxCheckResult::Valid) return; } -#endif QStyledItemDelegate::setModelData(editor, model, index); } diff --git a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp index 20350f6..fa30d84 100644 --- a/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp +++ b/src/scripttools/debugging/qscriptdebuggerscriptedconsolecommand.cpp @@ -410,11 +410,7 @@ void QScriptDebuggerScriptedConsoleCommandJob::start() for (int i = 0; i < d->arguments.size(); ++i) args.append(QScriptValue(engine, d->arguments.at(i))); QScriptDebuggerConsoleGlobalObject *global; -#if QT_VERSION >= 0x040500 global = qobject_cast<QScriptDebuggerConsoleGlobalObject*>(engine->globalObject().toQObject()); -#else - global = qobject_cast<QScriptDebuggerConsoleGlobalObject*>(engine->globalObject().scope().toQObject()); -#endif Q_ASSERT(global != 0); global->setScheduler(this); global->setResponseHandler(this); @@ -444,11 +440,7 @@ void QScriptDebuggerScriptedConsoleCommandJob::handleResponse( args.append(qScriptValueFromValue(engine, response)); args.append(QScriptValue(engine, commandId)); QScriptDebuggerConsoleGlobalObject *global; -#if QT_VERSION >= 0x040500 global = qobject_cast<QScriptDebuggerConsoleGlobalObject*>(engine->globalObject().toQObject()); -#else - global = qobject_cast<QScriptDebuggerConsoleGlobalObject*>(engine->globalObject().scope().toQObject()); -#endif Q_ASSERT(global != 0); global->setScheduler(this); global->setResponseHandler(this); @@ -566,12 +558,7 @@ QScriptDebuggerScriptedConsoleCommand *QScriptDebuggerScriptedConsoleCommand::pa QScriptDebuggerConsoleGlobalObject *cppGlobal = new QScriptDebuggerConsoleGlobalObject(); QScriptValue global = engine->newQObject(cppGlobal, QScriptEngine::ScriptOwnership, -#if QT_VERSION >= 0x040500 QScriptEngine::ExcludeSuperClassContents); -#else - QScriptEngine::ExcludeSuperClassMethods - | QScriptEngine::ExcludeSuperClassProperties); -#endif { QScriptValueIterator it(engine->globalObject()); while (it.hasNext()) { @@ -579,12 +566,7 @@ QScriptDebuggerScriptedConsoleCommand *QScriptDebuggerScriptedConsoleCommand::pa global.setProperty(it.scriptName(), it.value(), it.flags()); } } -#if QT_VERSION >= 0x040500 engine->setGlobalObject(global); -#else - engine->globalObject().setScope(global); - global = engine->globalObject(); -#endif cppGlobal->setMessageHandler(messageHandler); QScriptValue ret = engine->evaluate(program, fileName); diff --git a/src/scripttools/debugging/qscriptedit.cpp b/src/scripttools/debugging/qscriptedit.cpp index 2bc0a40..7c2a72c 100644 --- a/src/scripttools/debugging/qscriptedit.cpp +++ b/src/scripttools/debugging/qscriptedit.cpp @@ -342,11 +342,9 @@ void QScriptEdit::extraAreaPaintEvent(QPaintEvent *e) icon.paint(&painter, r, Qt::AlignCenter); } -#if QT_VERSION >= 0x040500 if (!m_executableLineNumbers.contains(lineNumber)) painter.setPen(pal.color(QPalette::Mid)); else -#endif painter.setPen(QColor(Qt::darkCyan)); QString number = QString::number(lineNumber); painter.drawText(rect.x() + markWidth, (int)top, rect.x() + extraAreaWidth - markWidth - 4, @@ -370,10 +368,8 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e) if (e->type() == QEvent::MouseMove && e->buttons() == 0) { // mouse tracking bool hand = (e->pos().x() <= markWidth); -#if QT_VERSION >= 0x040500 int lineNumber = cursor.blockNumber() + m_baseLineNumber; hand = hand && m_executableLineNumbers.contains(lineNumber); -#endif #ifndef QT_NO_CURSOR if (hand != (m_extraArea->cursor().shape() == Qt::PointingHandCursor)) m_extraArea->setCursor(hand ? Qt::PointingHandCursor : Qt::ArrowCursor); @@ -382,12 +378,8 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e) if (e->type() == QEvent::MouseButtonPress) { if (e->button() == Qt::LeftButton) { -#if QT_VERSION >= 0x040500 int lineNumber = cursor.blockNumber() + m_baseLineNumber; bool executable = m_executableLineNumbers.contains(lineNumber); -#else - bool executable = true; -#endif if ((e->pos().x() <= markWidth) && executable) m_extraAreaToggleBlockNumber = cursor.blockNumber(); else @@ -402,10 +394,8 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e) } } else if (e->button() == Qt::RightButton) { int lineNumber = cursor.blockNumber() + m_baseLineNumber; -#if QT_VERSION >= 0x040500 if (!m_executableLineNumbers.contains(lineNumber)) return; -#endif bool has = m_breakpoints.contains(lineNumber); QMenu *popup = new QMenu(); QAction *toggleAct = new QAction(QObject::tr("Toggle Breakpoint"), popup); diff --git a/src/scripttools/debugging/qscriptenginedebugger.h b/src/scripttools/debugging/qscriptenginedebugger.h index d5e127f..a4853f0 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.h +++ b/src/scripttools/debugging/qscriptenginedebugger.h @@ -48,11 +48,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#if QT_VERSION >= 0x040500 QT_MODULE(ScriptTools) -#else -# define Q_SCRIPTTOOLS_EXPORT -#endif class QAction; class QScriptEngine; diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 8e8bc56..11d0041 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -49,6 +49,7 @@ #include <qstringlist.h> #include <qvarlengtharray.h> #include <qvector.h> +#include <QDebug> #ifndef UNICODE #define UNICODE @@ -87,8 +88,19 @@ public: {} ~QDB2ResultPrivate() { - for (int i = 0; i < valueCache.count(); ++i) + emptyValueCache(); + } + void clearValueCache() + { + for (int i = 0; i < valueCache.count(); ++i) { delete valueCache[i]; + valueCache[i] = NULL; + } + } + void emptyValueCache() + { + clearValueCache(); + valueCache.clear(); } const QDB2DriverPrivate* dp; @@ -544,7 +556,7 @@ bool QDB2Result::reset (const QString& query) SQLRETURN r; d->recInf.clear(); - d->valueCache.clear(); + d->emptyValueCache(); if (!qMakeStatement(d, isForwardOnly())) return false; @@ -568,6 +580,7 @@ bool QDB2Result::reset (const QString& query) setSelect(false); } d->valueCache.resize(count); + d->valueCache.fill(NULL); setActive(true); return true; } @@ -579,7 +592,7 @@ bool QDB2Result::prepare(const QString& query) SQLRETURN r; d->recInf.clear(); - d->valueCache.clear(); + d->emptyValueCache(); if (!qMakeStatement(d, isForwardOnly())) return false; @@ -607,7 +620,7 @@ bool QDB2Result::exec() SQLRETURN r; d->recInf.clear(); - d->valueCache.clear(); + d->emptyValueCache(); if (!qMakeStatement(d, isForwardOnly(), false)) return false; @@ -811,6 +824,7 @@ bool QDB2Result::exec() } setActive(true); d->valueCache.resize(count); + d->valueCache.fill(NULL); //get out parameters if (!hasOutValues()) @@ -858,7 +872,7 @@ bool QDB2Result::fetch(int i) return false; if (i == at()) return true; - d->valueCache.fill(0); + d->clearValueCache(); int actualIdx = i + 1; if (actualIdx <= 0) { setAt(QSql::BeforeFirstRow); @@ -887,7 +901,7 @@ bool QDB2Result::fetch(int i) bool QDB2Result::fetchNext() { SQLRETURN r; - d->valueCache.fill(0); + d->clearValueCache(); r = SQLFetchScroll(d->hStmt, SQL_FETCH_NEXT, 0); @@ -907,7 +921,7 @@ bool QDB2Result::fetchFirst() return false; if (isForwardOnly()) return fetchNext(); - d->valueCache.fill(0); + d->clearValueCache(); SQLRETURN r; r = SQLFetchScroll(d->hStmt, SQL_FETCH_FIRST, @@ -923,7 +937,7 @@ bool QDB2Result::fetchFirst() bool QDB2Result::fetchLast() { - d->valueCache.fill(0); + d->clearValueCache(); int i = at(); if (i == QSql::AfterLastRow) { @@ -1044,7 +1058,7 @@ QVariant QDB2Result::data(int field) case QSql::HighPrecision: default: // length + 1 for the comma - v = new QVariant(qGetStringData(d->hStmt, field, info.length() + 1, isNull)); + v = new QVariant(value); ok = true; break; } @@ -1101,7 +1115,7 @@ bool QDB2Result::nextResult() setActive(false); setAt(QSql::BeforeFirstRow); d->recInf.clear(); - d->valueCache.clear(); + d->emptyValueCache(); setSelect(false); SQLRETURN r = SQLMoreResults(d->hStmt); @@ -1120,6 +1134,7 @@ bool QDB2Result::nextResult() d->recInf.append(qMakeFieldInfo(d, i)); d->valueCache.resize(fieldCount); + d->valueCache.fill(NULL); setActive(true); return true; @@ -1167,7 +1182,7 @@ QDB2Driver::~QDB2Driver() delete d; } -bool QDB2Driver::open(const QString& db, const QString& user, const QString& password, const QString&, int, +bool QDB2Driver::open(const QString& db, const QString& user, const QString& password, const QString& host, int port, const QString& connOpts) { if (isOpen()) @@ -1190,6 +1205,8 @@ bool QDB2Driver::open(const QString& db, const QString& user, const QString& pas setOpenError(true); return false; } + + QString protocol; // Set connection attributes const QStringList opts(connOpts.split(QLatin1Char(';'), QString::SkipEmptyParts)); for (int i = 0; i < opts.count(); ++i) { @@ -1220,7 +1237,10 @@ bool QDB2Driver::open(const QString& db, const QString& user, const QString& pas } else if (opt == QLatin1String("SQL_ATTR_LOGIN_TIMEOUT")) { v = val.toUInt(); r = SQLSetConnectAttr(d->hDbc, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER) v, 0); - } else { + } else if (opt.compare(QLatin1String("PROTOCOL"), Qt::CaseInsensitive) == 0) { + protocol = tmp; + } + else { qWarning("QDB2Driver::open: Unknown connection attribute '%s'", tmp.toLocal8Bit().constData()); } @@ -1229,9 +1249,18 @@ bool QDB2Driver::open(const QString& db, const QString& user, const QString& pas "Unable to set connection attribute '%1'").arg(opt), d); } + if (protocol.isEmpty()) + protocol = QLatin1String("PROTOCOL=TCPIP"); + + if (port < 0 ) + port = 50000; + QString connQStr; - connQStr = QLatin1String("DSN=") + db + QLatin1String(";UID=") + user + QLatin1String(";PWD=") - + password; + connQStr = protocol + QLatin1String(";DATABASE=") + db + QLatin1String(";HOSTNAME=") + host + + QLatin1String(";PORT=") + QString::number(port) + QLatin1String(";UID=") + user + + QLatin1String(";PWD=") + password; + + SQLTCHAR connOut[SQL_MAX_OPTION_STRING_LENGTH]; SQLSMALLINT cb; @@ -1250,7 +1279,7 @@ bool QDB2Driver::open(const QString& db, const QString& user, const QString& pas return false; } - d->user = user.toUpper(); + d->user = user; setOpen(true); setOpenError(false); return true; @@ -1295,10 +1324,25 @@ QSqlRecord QDB2Driver::record(const QString& tableName) const SQLHANDLE hStmt; QString catalog, schema, table; - qSplitTableQualifier(tableName.toUpper(), &catalog, &schema, &table); + qSplitTableQualifier(tableName, &catalog, &schema, &table); if (schema.isEmpty()) schema = d->user; + if (isIdentifierEscaped(catalog, QSqlDriver::TableName)) + catalog = stripDelimiters(catalog, QSqlDriver::TableName); + else + catalog = catalog.toUpper(); + + if (isIdentifierEscaped(schema, QSqlDriver::TableName)) + schema = stripDelimiters(schema, QSqlDriver::TableName); + else + schema = schema.toUpper(); + + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + else + table = table.toUpper(); + SQLRETURN r = SQLAllocHandle(SQL_HANDLE_STMT, d->hDbc, &hStmt); @@ -1312,6 +1356,9 @@ QSqlRecord QDB2Driver::record(const QString& tableName) const (SQLPOINTER) SQL_CURSOR_FORWARD_ONLY, SQL_IS_UINTEGER); + + //Aside: szSchemaName and szTableName parameters of SQLColumns + //are case sensitive search patterns, so no escaping is used. r = SQLColumns(hStmt, NULL, 0, @@ -1392,7 +1439,13 @@ QStringList QDB2Driver::tables(QSql::TableType type) const bool isNull; QString fieldVal = qGetStringData(hStmt, 2, -1, isNull); QString userVal = qGetStringData(hStmt, 1, -1, isNull); - if (userVal != d->user) + QString user = d->user; + if ( isIdentifierEscaped(user, QSqlDriver::TableName)) + user = stripDelimiters(user, QSqlDriver::TableName); + else + user = user.toUpper(); + + if (userVal != user) fieldVal = userVal + QLatin1Char('.') + fieldVal; tl.append(fieldVal); r = SQLFetchScroll(hStmt, @@ -1423,7 +1476,23 @@ QSqlIndex QDB2Driver::primaryIndex(const QString& tablename) const return index; } QString catalog, schema, table; - qSplitTableQualifier(tablename.toUpper(), &catalog, &schema, &table); + qSplitTableQualifier(tablename, &catalog, &schema, &table); + + if (isIdentifierEscaped(catalog, QSqlDriver::TableName)) + catalog = stripDelimiters(catalog, QSqlDriver::TableName); + else + catalog = catalog.toUpper(); + + if (isIdentifierEscaped(schema, QSqlDriver::TableName)) + schema = stripDelimiters(schema, QSqlDriver::TableName); + else + schema = schema.toUpper(); + + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + else + table = table.toUpper(); + r = SQLSetStmtAttr(hStmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)SQL_CURSOR_FORWARD_ONLY, @@ -1594,4 +1663,15 @@ QVariant QDB2Driver::handle() const return QVariant(qRegisterMetaType<SQLHANDLE>("SQLHANDLE"), &d->hDbc); } +QString QDB2Driver::escapeIdentifier(const QString &identifier, IdentifierType) const +{ + QString res = identifier; + if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + res.replace(QLatin1Char('"'), QLatin1String("\"\"")); + res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); + res.replace(QLatin1Char('.'), QLatin1String("\".\"")); + } + return res; +} + QT_END_NAMESPACE diff --git a/src/sql/drivers/db2/qsql_db2.h b/src/sql/drivers/db2/qsql_db2.h index fd1b702..6923027 100644 --- a/src/sql/drivers/db2/qsql_db2.h +++ b/src/sql/drivers/db2/qsql_db2.h @@ -110,6 +110,8 @@ public: const QString& host, int port, const QString& connOpts); + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + private: bool setAutoCommit(bool autoCommit); QDB2DriverPrivate* d; diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 64f13b5..0705722 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1552,12 +1552,16 @@ QSqlRecord QIBaseDriver::record(const QString& tablename) const QSqlQuery q(createResult()); q.setForwardOnly(true); - + QString table = tablename; + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + else + table = table.toUpper(); q.exec(QLatin1String("SELECT a.RDB$FIELD_NAME, b.RDB$FIELD_TYPE, b.RDB$FIELD_LENGTH, " "b.RDB$FIELD_SCALE, b.RDB$FIELD_PRECISION, a.RDB$NULL_FLAG " "FROM RDB$RELATION_FIELDS a, RDB$FIELDS b " "WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE " - "AND a.RDB$RELATION_NAME = '") + tablename.toUpper() + QLatin1String("' " + "AND a.RDB$RELATION_NAME = '") + table + QLatin1String("' " "ORDER BY a.RDB$FIELD_POSITION")); while (q.next()) { @@ -1585,12 +1589,18 @@ QSqlIndex QIBaseDriver::primaryIndex(const QString &table) const if (!isOpen()) return index; + QString tablename = table; + if (isIdentifierEscaped(tablename, QSqlDriver::TableName)) + tablename = stripDelimiters(tablename, QSqlDriver::TableName); + else + tablename = tablename.toUpper(); + QSqlQuery q(createResult()); q.setForwardOnly(true); q.exec(QLatin1String("SELECT a.RDB$INDEX_NAME, b.RDB$FIELD_NAME, d.RDB$FIELD_TYPE, d.RDB$FIELD_SCALE " "FROM RDB$RELATION_CONSTRAINTS a, RDB$INDEX_SEGMENTS b, RDB$RELATION_FIELDS c, RDB$FIELDS d " "WHERE a.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY' " - "AND a.RDB$RELATION_NAME = '") + table.toUpper() + + "AND a.RDB$RELATION_NAME = '") + tablename + QLatin1String(" 'AND a.RDB$INDEX_NAME = b.RDB$INDEX_NAME " "AND c.RDB$RELATION_NAME = a.RDB$RELATION_NAME " "AND c.RDB$FIELD_NAME = b.RDB$FIELD_NAME " diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index 9b57f3c..a84e840 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -1314,7 +1314,7 @@ QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const QSqlQuery i(createResult()); QString stmt(QLatin1String("show index from %1;")); QSqlRecord fil = record(tablename); - i.exec(stmt.arg(escapeIdentifier(tablename, QSqlDriver::TableName))); + i.exec(stmt.arg(tablename)); while (i.isActive() && i.next()) { if (i.value(2).toString() == QLatin1String("PRIMARY")) { idx.append(fil.field(i.value(4).toString())); @@ -1329,10 +1329,14 @@ QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const QSqlRecord QMYSQLDriver::record(const QString& tablename) const { + QString table=tablename; + if(isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + QSqlRecord info; if (!isOpen()) return info; - MYSQL_RES* r = mysql_list_fields(d->mysql, tablename.toLocal8Bit().constData(), 0); + MYSQL_RES* r = mysql_list_fields(d->mysql, table.toLocal8Bit().constData(), 0); if (!r) { return info; } @@ -1443,4 +1447,15 @@ QString QMYSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType return res; } +bool QMYSQLDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const +{ + Q_UNUSED(type); + bool isLeftDelimited = (identifier.left(1) == QString(QLatin1Char('`'))); + bool isRightDelimited = (identifier.right(1) == QString(QLatin1Char('`'))); + if( identifier.size() > 2 && isLeftDelimited && isRightDelimited ) + return true; + else + return false; +} + QT_END_NAMESPACE diff --git a/src/sql/drivers/mysql/qsql_mysql.h b/src/sql/drivers/mysql/qsql_mysql.h index 97aa346..31d9dcf 100644 --- a/src/sql/drivers/mysql/qsql_mysql.h +++ b/src/sql/drivers/mysql/qsql_mysql.h @@ -123,6 +123,9 @@ public: QVariant handle() const; QString escapeIdentifier(const QString &identifier, IdentifierType type) const; +protected Q_SLOTS: + bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const; + protected: bool beginTransaction(); bool commitTransaction(); diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index bc9ecda..fa9b5f0 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -489,7 +489,7 @@ QSqlError qMakeError(const QString& errString, QSqlError::ErrorType type, OCIErr return QSqlError(errString, oraErrorString, type, errorCode); } -static QVariant::Type qDecodeOCIType(const QString& ocitype, int ocilen, int ociprec, int ociscale) +QVariant::Type qDecodeOCIType(const QString& ocitype, QSql::NumericalPrecisionPolicy precisionPolicy) { QVariant::Type type = QVariant::Invalid; if (ocitype == QLatin1String("VARCHAR2") || ocitype == QLatin1String("VARCHAR") @@ -497,10 +497,26 @@ static QVariant::Type qDecodeOCIType(const QString& ocitype, int ocilen, int oci || ocitype == QLatin1String("CHAR") || ocitype == QLatin1String("NVARCHAR2") || ocitype == QLatin1String("NCHAR")) type = QVariant::String; - else if (ocitype == QLatin1String("NUMBER")) - type = QVariant::Int; - else if (ocitype == QLatin1String("FLOAT")) - type = QVariant::Double; + else if (ocitype == QLatin1String("NUMBER") + || ocitype == QLatin1String("FLOAT") + || ocitype == QLatin1String("BINARY_FLOAT") + || ocitype == QLatin1String("BINARY_DOUBLE")) { + switch(precisionPolicy) { + case QSql::LowPrecisionInt32: + type = QVariant::Int; + break; + case QSql::LowPrecisionInt64: + type = QVariant::LongLong; + break; + case QSql::LowPrecisionDouble: + type = QVariant::Double; + break; + case QSql::HighPrecision: + default: + type = QVariant::String; + break; + } + } else if (ocitype == QLatin1String("LONG") || ocitype == QLatin1String("NCLOB") || ocitype == QLatin1String("CLOB")) type = QVariant::ByteArray; @@ -512,18 +528,12 @@ static QVariant::Type qDecodeOCIType(const QString& ocitype, int ocilen, int oci type = QVariant::DateTime; else if (ocitype == QLatin1String("UNDEFINED")) type = QVariant::Invalid; - if (type == QVariant::Int) { - if (ocilen == 22 && ociprec == 0 && ociscale == 0) - type = QVariant::Double; - if (ociscale > 0) - type = QVariant::Double; - } if (type == QVariant::Invalid) qWarning("qDecodeOCIType: unknown type: %s", ocitype.toLocal8Bit().constData()); return type; } -static QVariant::Type qDecodeOCIType(int ocitype) +QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precisionPolicy) { QVariant::Type type = QVariant::Invalid; switch (ocitype) { @@ -550,7 +560,21 @@ static QVariant::Type qDecodeOCIType(int ocitype) case SQLT_NUM: case SQLT_VNU: case SQLT_UIN: - type = QVariant::String; + switch(precisionPolicy) { + case QSql::LowPrecisionInt32: + type = QVariant::Int; + break; + case QSql::LowPrecisionInt64: + type = QVariant::LongLong; + break; + case QSql::LowPrecisionDouble: + type = QVariant::Double; + break; + case QSql::HighPrecision: + default: + type = QVariant::String; + break; + } break; case SQLT_VBI: case SQLT_BIN: @@ -686,7 +710,7 @@ static OraFieldInfo qMakeOraField(const QOCIResultPrivate* p, OCIParam* param) if (r != 0) qOraWarning("qMakeOraField:", p->err); - type = qDecodeOCIType(colType); + type = qDecodeOCIType(colType, p->precisionPolicy); if (type == QVariant::Int) { if (colLength == 22 && colPrecision == 0 && colScale == 0) @@ -2074,7 +2098,7 @@ bool QOCIDriver::open(const QString & db, setOpen(true); setOpenError(false); - d->user = user.toUpper(); + d->user = user; return true; } @@ -2176,8 +2200,15 @@ QStringList QOCIDriver::tables(QSql::TableType type) const "and owner != 'WKSYS'" "and owner != 'CTXSYS'" "and owner != 'WMSYS'")); + + QString user = d->user; + if ( isIdentifierEscaped(user, QSqlDriver::TableName)) + user = stripDelimiters(user, QSqlDriver::TableName); + else + user = user.toUpper(); + while (t.next()) { - if (t.value(0).toString() != d->user) + if (t.value(0).toString() != user) tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); else tl.append(t.value(1).toString()); @@ -2213,10 +2244,10 @@ void qSplitTableAndOwner(const QString & tname, QString * tbl, { int i = tname.indexOf(QLatin1Char('.')); // prefixed with owner? if (i != -1) { - *tbl = tname.right(tname.length() - i - 1).toUpper(); - *owner = tname.left(i).toUpper(); + *tbl = tname.right(tname.length() - i - 1); + *owner = tname.left(i); } else { - *tbl = tname.toUpper(); + *tbl = tname; } } @@ -2232,7 +2263,7 @@ QSqlRecord QOCIDriver::record(const QString& tablename) const QString stmt(QLatin1String("select column_name, data_type, data_length, " "data_precision, data_scale, nullable, data_default%1" "from all_tab_columns " - "where upper(table_name)=%2")); + "where table_name=%2")); if (d->serverVersion >= 9) stmt = stmt.arg(QLatin1String(", char_length ")); else @@ -2240,11 +2271,23 @@ QSqlRecord QOCIDriver::record(const QString& tablename) const bool buildRecordInfo = false; QString table, owner, tmpStmt; qSplitTableAndOwner(tablename, &table, &owner); + + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + else + table = table.toUpper(); + tmpStmt = stmt.arg(QLatin1Char('\'') + table + QLatin1Char('\'')); if (owner.isEmpty()) { owner = d->user; } - tmpStmt += QLatin1String(" and upper(owner)='") + owner + QLatin1String("'"); + + if (isIdentifierEscaped(owner, QSqlDriver::TableName)) + owner = stripDelimiters(owner, QSqlDriver::TableName); + else + owner = owner.toUpper(); + + tmpStmt += QLatin1String(" and owner='") + owner + QLatin1String("'"); t.setForwardOnly(true); t.exec(tmpStmt); if (!t.next()) { // try and see if the tablename is a synonym @@ -2257,14 +2300,15 @@ QSqlRecord QOCIDriver::record(const QString& tablename) const } else { buildRecordInfo = true; } + QStringList keywords = QStringList() << QLatin1String("NUMBER") << QLatin1String("FLOAT") << QLatin1String("BINARY_FLOAT") + << QLatin1String("BINARY_DOUBLE"); if (buildRecordInfo) { do { - QVariant::Type ty = qDecodeOCIType(t.value(1).toString(), t.value(2).toInt(), - t.value(3).toInt(), t.value(4).toInt()); + QVariant::Type ty = qDecodeOCIType(t.value(1).toString(),t.numericalPrecisionPolicy()); QSqlField f(t.value(0).toString(), ty); f.setRequired(t.value(5).toString() == QLatin1String("N")); f.setPrecision(t.value(4).toInt()); - if (d->serverVersion >= 9 && (ty == QVariant::String) && !t.isNull(3)) { + if (d->serverVersion >= 9 && (ty == QVariant::String) && !t.isNull(3) && !keywords.contains(t.value(1).toString())) { // Oracle9: data_length == size in bytes, char_length == amount of characters f.setLength(t.value(7).toInt()); } else { @@ -2292,11 +2336,23 @@ QSqlIndex QOCIDriver::primaryIndex(const QString& tablename) const bool buildIndex = false; QString table, owner, tmpStmt; qSplitTableAndOwner(tablename, &table, &owner); - tmpStmt = stmt + QLatin1String(" and upper(a.table_name)='") + table + QLatin1String("'"); + + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + else + table = table.toUpper(); + + tmpStmt = stmt + QLatin1String(" and a.table_name='") + table + QLatin1String("'"); if (owner.isEmpty()) { owner = d->user; } - tmpStmt += QLatin1String(" and upper(a.owner)='") + owner + QLatin1String("'"); + + if (isIdentifierEscaped(owner, QSqlDriver::TableName)) + owner = stripDelimiters(owner, QSqlDriver::TableName); + else + owner = owner.toUpper(); + + tmpStmt += QLatin1String(" and a.owner='") + owner + QLatin1String("'"); t.setForwardOnly(true); t.exec(tmpStmt); @@ -2324,7 +2380,7 @@ QSqlIndex QOCIDriver::primaryIndex(const QString& tablename) const if (!tt.next()) { return QSqlIndex(); } - QSqlField f(t.value(0).toString(), qDecodeOCIType(tt.value(0).toString(), 0, 0, 0)); + QSqlField f(t.value(0).toString(), qDecodeOCIType(tt.value(0).toString(), t.numericalPrecisionPolicy())); idx.append(f); } while (t.next()); return idx; @@ -2390,13 +2446,14 @@ QVariant QOCIDriver::handle() const return qVariantFromValue(d->env); } -QString QOCIDriver::escapeIdentifier(const QString &identifier, IdentifierType /* type */) const +QString QOCIDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const { QString res = identifier; - res.replace(QLatin1Char('"'), QLatin1String("\"\"")); - if (identifier.indexOf(QLatin1Char(' ')) != -1) + if(!identifier.isEmpty() && !isIdentifierEscaped(identifier, type)) { + res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); -// res.replace(QLatin1Char('.'), QLatin1String("\".\"")); + res.replace(QLatin1Char('.'), QLatin1String("\".\"")); + } return res; } diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index f6710db..2a83fe6 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -55,6 +55,7 @@ #include <qvarlengtharray.h> #include <qvector.h> #include <QDebug> +#include <QSqlQuery> QT_BEGIN_NAMESPACE @@ -88,6 +89,7 @@ static const SQLSMALLINT qParamType[4] = { SQL_PARAM_INPUT, SQL_PARAM_INPUT, SQL class QODBCDriverPrivate { public: + enum DefaultCase{Lower, Mixed, Upper, Sensitive}; QODBCDriverPrivate() : hEnv(0), hDbc(0), useSchema(false), disconnectCount(0), isMySqlServer(false), isMSSqlServer(false), hasSQLFetchScroll(true), hasMultiResultSets(false) @@ -119,6 +121,9 @@ public: bool setConnectionOptions(const QString& connOpts); void splitTableQualifier(const QString &qualifier, QString &catalog, QString &schema, QString &table); + DefaultCase defaultCase() const; + QString adjustCase(const QString&) const; + QChar quoteChar() const; }; class QODBCPrivate @@ -350,7 +355,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni } else { fieldVal += QString::fromAscii(buf, rSize); } - if (fieldVal.size() + lengthIndicator >= colSize) { + if (lengthIndicator - fieldVal.size() <= 0) { // workaround for Drivermanagers that don't return SQL_NO_DATA break; } @@ -555,6 +560,29 @@ static int qGetODBCVersion(const QString &connOpts) return SQL_OV_ODBC2; } +QChar QODBCDriverPrivate::quoteChar() const +{ + static bool isQuoteInitialized = false; + static QChar quote = QChar::fromLatin1('"'); + if (!isQuoteInitialized) { + char driverResponse[4]; + SQLUSMALLINT casing; + SQLSMALLINT length; + int r = SQLGetInfo(hDbc, + SQL_IDENTIFIER_QUOTE_CHAR, + &driverResponse, + sizeof(driverResponse), + &length); + if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { + quote = QChar::fromLatin1(driverResponse[0]); + } else { + quote = QChar::fromLatin1('"'); + } + isQuoteInitialized = true; + } + return quote; +} + bool QODBCDriverPrivate::setConnectionOptions(const QString& connOpts) { // Set any connection attributes @@ -705,6 +733,65 @@ void QODBCDriverPrivate::splitTableQualifier(const QString & qualifier, QString } } +QODBCDriverPrivate::DefaultCase QODBCDriverPrivate::defaultCase() const +{ + static bool isInitialized = false; + static DefaultCase ret; + + if (!isInitialized) { + SQLUSMALLINT casing; + int r = SQLGetInfo(hDbc, + SQL_IDENTIFIER_CASE, + &casing, + sizeof(casing), + NULL); + if ( r != SQL_SUCCESS) + ret = Lower;//arbitrary case if driver cannot be queried + else { + switch (casing) { + case (SQL_IC_UPPER): + ret = Upper; + break; + case (SQL_IC_LOWER): + ret = Lower; + break; + case (SQL_IC_SENSITIVE): + ret = Sensitive; + break; + case (SQL_IC_MIXED): + ret = Mixed; + break; + default: + ret = Upper; + } + } + isInitialized = true; + } + return ret; +} + +/* + Adjust the casing of an identifier to match what the + database engine would have done to it. +*/ +QString QODBCDriverPrivate::adjustCase(const QString &identifier) const +{ + QString ret = identifier; + switch(defaultCase()) { + case (Lower): + ret = identifier.toLower(); + break; + case (Upper): + ret = identifier.toUpper(); + break; + case(Mixed): + case(Sensitive): + default: + ret = identifier; + } + return ret; +} + //////////////////////////////////////////////////////////////////////////// QODBCResult::QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p) @@ -1714,6 +1801,10 @@ bool QODBCDriver::open(const QString & db, d->checkHasMultiResults(); setOpen(true); setOpenError(false); + if(d->isMSSqlServer) { + QSqlQuery i(createResult()); + i.exec(QLatin1String("SET QUOTED_IDENTIFIER ON")); + } return true; } @@ -2084,6 +2175,22 @@ QSqlIndex QODBCDriver::primaryIndex(const QString& tablename) const } QString catalog, schema, table; d->splitTableQualifier(tablename, catalog, schema, table); + + if (isIdentifierEscaped(catalog, QSqlDriver::TableName)) + catalog = stripDelimiters(catalog, QSqlDriver::TableName); + else + catalog = d->adjustCase(catalog); + + if (isIdentifierEscaped(schema, QSqlDriver::TableName)) + schema = stripDelimiters(schema, QSqlDriver::TableName); + else + schema = d->adjustCase(schema); + + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + else + table = d->adjustCase(table); + r = SQLSetStmtAttr(hStmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)SQL_CURSOR_FORWARD_ONLY, @@ -2186,6 +2293,22 @@ QSqlRecord QODBCDriver::record(const QString& tablename) const SQLHANDLE hStmt; QString catalog, schema, table; d->splitTableQualifier(tablename, catalog, schema, table); + + if (isIdentifierEscaped(catalog, QSqlDriver::TableName)) + catalog = stripDelimiters(catalog, QSqlDriver::TableName); + else + catalog = d->adjustCase(catalog); + + if (isIdentifierEscaped(schema, QSqlDriver::TableName)) + schema = stripDelimiters(schema, QSqlDriver::TableName); + else + schema = d->adjustCase(schema); + + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + else + table = d->adjustCase(table); + SQLRETURN r = SQLAllocHandle(SQL_HANDLE_STMT, d->hDbc, &hStmt); @@ -2309,4 +2432,15 @@ QString QODBCDriver::escapeIdentifier(const QString &identifier, IdentifierType) return res; } +bool QODBCDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType) const +{ + QString quote = d->quoteChar(); + bool isLeftDelimited = identifier.left(1) == quote; + bool isRightDelimited = identifier.right(1) == quote; + if( identifier.size() > 2 && isLeftDelimited && isRightDelimited ) + return true; + else + return false; +} + QT_END_NAMESPACE diff --git a/src/sql/drivers/odbc/qsql_odbc.h b/src/sql/drivers/odbc/qsql_odbc.h index 4148007..51f53ea 100644 --- a/src/sql/drivers/odbc/qsql_odbc.h +++ b/src/sql/drivers/odbc/qsql_odbc.h @@ -145,10 +145,14 @@ public: QString escapeIdentifier(const QString &identifier, IdentifierType type) const; +protected Q_SLOTS: + bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const; + protected: bool beginTransaction(); bool commitTransaction(); bool rollbackTransaction(); + private: void init(); bool endTrans(); diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index e33dd95..16d19f1 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -351,8 +351,9 @@ QVariant QPSQLResult::data(int i) #ifndef QT_NO_DATESTRING if (str.isEmpty()) return QVariant(QTime()); - if (str.at(str.length() - 3) == QLatin1Char('+')) + if (str.at(str.length() - 3) == QLatin1Char('+') || str.at(str.length() - 3) == QLatin1Char('-')) // strip the timezone + // TODO: fix this when timestamp support comes into QDateTime return QVariant(QTime::fromString(str.left(str.length() - 3), Qt::ISODate)); return QVariant(QTime::fromString(str, Qt::ISODate)); #else @@ -365,7 +366,8 @@ QVariant QPSQLResult::data(int i) if (dtval.length() < 10) return QVariant(QDateTime()); // remove the timezone - if (dtval.at(dtval.length() - 3) == QLatin1Char('+')) + // TODO: fix this when timestamp support comes into QDateTime + if (dtval.at(dtval.length() - 3) == QLatin1Char('+') || dtval.at(dtval.length() - 3) == QLatin1Char('-')) dtval.chop(3); // milliseconds are sometimes returned with 2 digits only if (dtval.at(dtval.length() - 3).isPunct()) @@ -892,6 +894,16 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const QString schema; qSplitTableName(tbl, schema); + if (isIdentifierEscaped(tbl, QSqlDriver::TableName)) + tbl = stripDelimiters(tbl, QSqlDriver::TableName); + else + tbl = tbl.toLower(); + + if (isIdentifierEscaped(schema, QSqlDriver::TableName)) + schema = stripDelimiters(schema, QSqlDriver::TableName); + else + schema = schema.toLower(); + switch(d->pro) { case QPSQLDriver::Version6: stmt = QLatin1String("select pg_att1.attname, int(pg_att1.atttypid), pg_cl.relname " @@ -924,7 +936,7 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const "FROM pg_attribute, pg_class " "WHERE %1 pg_class.oid IN " "(SELECT indexrelid FROM pg_index WHERE indisprimary = true AND indrelid IN " - " (SELECT oid FROM pg_class WHERE lower(relname) = '%2')) " + " (SELECT oid FROM pg_class WHERE relname = '%2')) " "AND pg_attribute.attrelid = pg_class.oid " "AND pg_attribute.attisdropped = false " "ORDER BY pg_attribute.attnum"); @@ -932,11 +944,11 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const stmt = stmt.arg(QLatin1String("pg_table_is_visible(pg_class.oid) AND")); else stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from " - "pg_namespace where pg_namespace.nspname = '%1') AND ").arg(schema.toLower())); + "pg_namespace where pg_namespace.nspname = '%1') AND ").arg(schema)); break; } - i.exec(stmt.arg(tbl.toLower())); + i.exec(stmt.arg(tbl)); while (i.isActive() && i.next()) { QSqlField f(i.value(0).toString(), qDecodePSQLType(i.value(1).toInt())); idx.append(f); @@ -955,6 +967,16 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const QString schema; qSplitTableName(tbl, schema); + if (isIdentifierEscaped(tbl, QSqlDriver::TableName)) + tbl = stripDelimiters(tbl, QSqlDriver::TableName); + else + tbl = tbl.toLower(); + + if (isIdentifierEscaped(schema, QSqlDriver::TableName)) + schema = stripDelimiters(schema, QSqlDriver::TableName); + else + schema = schema.toLower(); + QString stmt; switch(d->pro) { case QPSQLDriver::Version6: @@ -999,7 +1021,7 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const "left join pg_attrdef on (pg_attrdef.adrelid = " "pg_attribute.attrelid and pg_attrdef.adnum = pg_attribute.attnum) " "where %1 " - "and lower(pg_class.relname) = '%2' " + "and pg_class.relname = '%2' " "and pg_attribute.attnum > 0 " "and pg_attribute.attrelid = pg_class.oid " "and pg_attribute.attisdropped = false " @@ -1008,12 +1030,12 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const stmt = stmt.arg(QLatin1String("pg_table_is_visible(pg_class.oid)")); else stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from " - "pg_namespace where pg_namespace.nspname = '%1')").arg(schema.toLower())); + "pg_namespace where pg_namespace.nspname = '%1')").arg(schema)); break; } QSqlQuery query(createResult()); - query.exec(stmt.arg(tbl.toLower())); + query.exec(stmt.arg(tbl)); if (d->pro >= QPSQLDriver::Version71) { while (query.next()) { int len = query.value(3).toInt(); diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 605c4e8..f732077 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -661,9 +661,13 @@ QSqlIndex QSQLiteDriver::primaryIndex(const QString &tblname) const if (!isOpen()) return QSqlIndex(); + QString table = tblname; + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + QSqlQuery q(createResult()); q.setForwardOnly(true); - return qGetTableInfo(q, tblname, true); + return qGetTableInfo(q, table, true); } QSqlRecord QSQLiteDriver::record(const QString &tbl) const @@ -671,9 +675,13 @@ QSqlRecord QSQLiteDriver::record(const QString &tbl) const if (!isOpen()) return QSqlRecord(); + QString table = tbl; + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + QSqlQuery q(createResult()); q.setForwardOnly(true); - return qGetTableInfo(q, tbl); + return qGetTableInfo(q, table); } QVariant QSQLiteDriver::handle() const @@ -681,10 +689,10 @@ QVariant QSQLiteDriver::handle() const return qVariantFromValue(d->access); } -QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType /*type*/) const +QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const { QString res = identifier; - if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + if(!identifier.isEmpty() && !isIdentifierEscaped(identifier, type) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp index a40dc08..d0c6e18 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp @@ -167,7 +167,15 @@ void QSQLite2ResultPrivate::init(const char **cnames, int numCols) for (int i = 0; i < numCols; ++i) { const char* lastDot = strrchr(cnames[i], '.'); const char* fieldName = lastDot ? lastDot + 1 : cnames[i]; - rInf.append(QSqlField(QString::fromAscii(fieldName), + + //remove quotations around the field name if any + QString fieldStr = QString::fromAscii(fieldName); + QString quote = QString::fromLatin1("\""); + if ( fieldStr.length() > 2 && fieldStr.left(1) == quote && fieldStr.right(1) == quote) { + fieldStr = fieldStr.mid(1); + fieldStr.chop(1); + } + rInf.append(QSqlField(fieldStr, nameToType(QString::fromAscii(cnames[i+numCols])))); } } @@ -297,6 +305,11 @@ bool QSQLite2Result::reset (const QString& query) // we have to fetch one row to find out about // the structure of the result set d->skippedStatus = d->fetchNext(cache(), 0, true); + if (lastError().isValid()) { + setSelect(false); + setActive(false); + return false; + } setSelect(!d->rInf.isEmpty()); setActive(true); return true; @@ -498,8 +511,11 @@ QSqlIndex QSQLite2Driver::primaryIndex(const QString &tblname) const QSqlQuery q(createResult()); q.setForwardOnly(true); + QString table = tblname; + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); // finrst find a UNIQUE INDEX - q.exec(QLatin1String("PRAGMA index_list('") + tblname + QLatin1String("');")); + q.exec(QLatin1String("PRAGMA index_list('") + table + QLatin1String("');")); QString indexname; while(q.next()) { if (q.value(2).toInt()==1) { @@ -512,7 +528,7 @@ QSqlIndex QSQLite2Driver::primaryIndex(const QString &tblname) const q.exec(QLatin1String("PRAGMA index_info('") + indexname + QLatin1String("');")); - QSqlIndex index(tblname, indexname); + QSqlIndex index(table, indexname); while(q.next()) { QString name = q.value(2).toString(); QVariant::Type type = QVariant::Invalid; @@ -527,6 +543,9 @@ QSqlRecord QSQLite2Driver::record(const QString &tbl) const { if (!isOpen()) return QSqlRecord(); + QString table = tbl; + if (isIdentifierEscaped(tbl, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); QSqlQuery q(createResult()); q.setForwardOnly(true); diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index 46e4a0b..515f0de 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -293,6 +293,8 @@ QTDSResult::QTDSResult(const QTDSDriver* db) // insert d in error handler dict errs()->insert(d->dbproc, d); + dbcmd(d->dbproc, "set quoted_identifier on"); + dbsqlexec(d->dbproc); } QTDSResult::~QTDSResult() @@ -367,7 +369,7 @@ bool QTDSResult::gotoNext(QSqlCachedResult::ValueCache &values, int index) if (qIsNull(d->buffer.at(i * 2 + 1))) values[idx] = QVariant(QVariant::String); else - values[idx] = QString::fromLocal8Bit((const char*)d->buffer.at(i * 2)); + values[idx] = QString::fromLocal8Bit((const char*)d->buffer.at(i * 2)).trimmed(); break; case QVariant::ByteArray: { if (qIsNull(d->buffer.at(i * 2 + 1))) @@ -698,9 +700,14 @@ QSqlRecord QTDSDriver::record(const QString& tablename) const return info; QSqlQuery t(createResult()); t.setForwardOnly(true); + + QString table = tablename; + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + QString stmt (QLatin1String("select name, type, length, prec from syscolumns " "where id = (select id from sysobjects where name = '%1')")); - t.exec(stmt.arg(tablename)); + t.exec(stmt.arg(table)); while (t.next()) { QSqlField f(t.value(0).toString().simplified(), qDecodeTDSType(t.value(1).toInt())); f.setLength(t.value(2).toInt()); @@ -770,13 +777,17 @@ QSqlIndex QTDSDriver::primaryIndex(const QString& tablename) const { QSqlRecord rec = record(tablename); - QSqlIndex idx(tablename); - if ((!isOpen()) || (tablename.isEmpty())) + QString table = tablename; + if (isIdentifierEscaped(table, QSqlDriver::TableName)) + table = stripDelimiters(table, QSqlDriver::TableName); + + QSqlIndex idx(table); + if ((!isOpen()) || (table.isEmpty())) return QSqlIndex(); QSqlQuery t(createResult()); t.setForwardOnly(true); - t.exec(QString::fromLatin1("sp_helpindex '%1'").arg(tablename)); + t.exec(QString::fromLatin1("sp_helpindex '%1'").arg(table)); if (t.next()) { QStringList fNames = t.value(2).toString().simplified().split(QLatin1Char(',')); QRegExp regx(QLatin1String("\\s*(\\S+)(?:\\s+(DESC|desc))?\\s*")); diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index ddebe45..40bc0df 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -49,6 +49,17 @@ QT_BEGIN_NAMESPACE +static QString prepareIdentifier(const QString &identifier, + QSqlDriver::IdentifierType type, const QSqlDriver *driver) +{ + Q_ASSERT( driver != NULL ); + QString ret = identifier; + if (!driver->isIdentifierEscaped(identifier, type)) { + ret = driver->escapeIdentifier(identifier, type); + } + return ret; +} + class QSqlDriverPrivate : public QObjectPrivate { public: @@ -372,6 +383,7 @@ QSqlRecord QSqlDriver::record(const QString & /* tableName */) const on \a type. The default implementation does nothing. + \sa isIdentifierEscaped() */ QString QSqlDriver::escapeIdentifier(const QString &identifier, IdentifierType) const { @@ -379,6 +391,55 @@ QString QSqlDriver::escapeIdentifier(const QString &identifier, IdentifierType) } /*! + Returns whether \a identifier is escaped according to the database rules. + \a identifier can either be a table name or field name, dependent + on \a type. + + \warning Because of binary compatability constraints, this function is not virtual. + If you want to provide your own implementation in your QSqlDriver subclass, + reimplement the isIdentifierEscapedImplementation() slot in your subclass instead. + The isIdentifierEscapedFunction() will dynamically detect the slot and call it. + + \sa stripDelimiters(), escapeIdentifier() + */ +bool QSqlDriver::isIdentifierEscaped(const QString &identifier, IdentifierType type) const +{ + bool result; + QMetaObject::invokeMethod(const_cast<QSqlDriver*>(this), + "isIdentifierEscapedImplementation", Qt::DirectConnection, + Q_RETURN_ARG(bool, result), + Q_ARG(QString, identifier), + Q_ARG(IdentifierType, type)); + return result; +} + +/*! + Returns the \a identifier with the leading and trailing delimiters removed, + \a identifier can either be a table name or field name, + dependent on \a type. If \a identifier does not have leading + and trailing delimiter characters, \a identifier is returned without + modification. + + \warning Because of binary compatability constraints, this function is not virtual, + If you want to provide your own implementation in your QSqlDriver subclass, + reimplement the stripDelimitersImplementation() slot in your subclass instead. + The stripDelimiters() function will dynamically detect the slot and call it. + + \since 4.5 + \sa isIdentifierEscaped() + */ +QString QSqlDriver::stripDelimiters(const QString &identifier, IdentifierType type) const +{ + QString result; + QMetaObject::invokeMethod(const_cast<QSqlDriver*>(this), + "stripDelimitersImplementation", Qt::DirectConnection, + Q_RETURN_ARG(QString, result), + Q_ARG(QString, identifier), + Q_ARG(IdentifierType, type)); + return result; +} + +/*! Returns a SQL statement of type \a type for the table \a tableName with the values from \a rec. If \a preparedStatement is true, the string will contain placeholders instead of values. @@ -397,21 +458,26 @@ QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, case SelectStatement: for (i = 0; i < rec.count(); ++i) { if (rec.isGenerated(i)) - s.append(escapeIdentifier(rec.fieldName(i), FieldName)).append(QLatin1String(", ")); + s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", ")); } if (s.isEmpty()) return s; s.chop(2); - s.prepend(QLatin1String("SELECT ")).append(QLatin1String(" FROM ")).append(escapeIdentifier(tableName, TableName)); + s.prepend(QLatin1String("SELECT ")).append(QLatin1String(" FROM ")).append(tableName); break; case WhereStatement: if (preparedStatement) { - for (int i = 0; i < rec.count(); ++i) - s.append(escapeIdentifier(rec.fieldName(i), FieldName)).append( - QLatin1String(" = ? AND ")); + for (int i = 0; i < rec.count(); ++i) { + s.append(prepareIdentifier(rec.fieldName(i), FieldName,this)); + if (rec.isNull(i)) + s.append(QLatin1String(" IS NULL")); + else + s.append(QLatin1String(" = ?")); + s.append(QLatin1String(" AND ")); + } } else { for (i = 0; i < rec.count(); ++i) { - s.append(escapeIdentifier(rec.fieldName(i), FieldName)); + s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)); QString val = formatValue(rec.field(i)); if (val == QLatin1String("NULL")) s.append(QLatin1String(" IS NULL")); @@ -426,12 +492,12 @@ QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, } break; case UpdateStatement: - s.append(QLatin1String("UPDATE ")).append(escapeIdentifier(tableName, TableName)).append( + s.append(QLatin1String("UPDATE ")).append(tableName).append( QLatin1String(" SET ")); for (i = 0; i < rec.count(); ++i) { if (!rec.isGenerated(i) || !rec.value(i).isValid()) continue; - s.append(escapeIdentifier(rec.fieldName(i), FieldName)).append(QLatin1Char('=')); + s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1Char('=')); if (preparedStatement) s.append(QLatin1Char('?')); else @@ -444,15 +510,15 @@ QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, s.clear(); break; case DeleteStatement: - s.append(QLatin1String("DELETE FROM ")).append(escapeIdentifier(tableName, TableName)); + s.append(QLatin1String("DELETE FROM ")).append(tableName); break; case InsertStatement: { - s.append(QLatin1String("INSERT INTO ")).append(escapeIdentifier(tableName, TableName)).append(QLatin1String(" (")); + s.append(QLatin1String("INSERT INTO ")).append(tableName).append(QLatin1String(" (")); QString vals; for (i = 0; i < rec.count(); ++i) { if (!rec.isGenerated(i) || !rec.value(i).isValid()) continue; - s.append(escapeIdentifier(rec.fieldName(i), FieldName)).append(QLatin1String(", ")); + s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", ")); if (preparedStatement) vals.append(QLatin1String("?")); else @@ -800,4 +866,56 @@ QStringList QSqlDriver::subscribedToNotificationsImplementation() const return QStringList(); } +/*! + This slot returns whether \a identifier is escaped according to the database rules. + \a identifier can either be a table name or field name, dependent + on \a type. + + Because of binary compatability constraints, isIdentifierEscaped() function + (introduced in Qt 4.5) is not virtual. Instead, isIdentifierEscaped() will + dynamically detect and call \e this slot. The default implementation + assumes the escape/delimiter character is a double quote. Reimplement this + slot in your own QSqlDriver if your database engine uses a different + delimiter character. + + \since 4.5 + \sa isIdentifierEscaped() + */ +bool QSqlDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const +{ + Q_UNUSED(type); + bool isLeftDelimited = identifier.left(1) == QString(QLatin1Char('"')); + bool isRightDelimited = identifier.right(1) == QString(QLatin1Char('"')); + if( identifier.size() > 2 && isLeftDelimited && isRightDelimited ) + return true; + else + return false; +} + +/*! + This slot returns \a identifier with the leading and trailing delimiters removed, + \a identifier can either be a tablename or field name, dependent on \a type. + If \a identifier does not have leading and trailing delimiter characters, \a + identifier is returned without modification. + + Because of binary compatability constraints, the stripDelimiters() function + (introduced in Qt 4.5) is not virtual. Instead, stripDelimiters() will + dynamically detect and call \e this slot. It generally unnecessary + to reimplement this slot. + + \since 4.5 + \sa stripDelimiters() + */ +QString QSqlDriver::stripDelimitersImplementation(const QString &identifier, IdentifierType type) const +{ + QString ret; + if (this->isIdentifierEscaped(identifier, type)) { + ret = identifier.mid(1); + ret.chop(1); + } else { + ret = identifier; + } + return ret; +} + QT_END_NAMESPACE diff --git a/src/sql/kernel/qsqldriver.h b/src/sql/kernel/qsqldriver.h index e763719..8ac1471 100644 --- a/src/sql/kernel/qsqldriver.h +++ b/src/sql/kernel/qsqldriver.h @@ -127,6 +127,9 @@ public: bool unsubscribeFromNotification(const QString &name); // ### Qt 5: make virtual QStringList subscribedToNotifications() const; // ### Qt 5: make virtual + bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const; // ### Qt 5: make virtual + QString stripDelimiters(const QString &identifier, IdentifierType type) const; // ### Qt 5: make virtual + Q_SIGNALS: void notification(const QString &name); @@ -140,6 +143,9 @@ protected Q_SLOTS: bool unsubscribeFromNotificationImplementation(const QString &name); // ### Qt 5: eliminate, see unsubscribeFromNotification() QStringList subscribedToNotificationsImplementation() const; // ### Qt 5: eliminate, see subscribedNotifications() + bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const; // ### Qt 5: eliminate, see isIdentifierEscaped() + QString stripDelimitersImplementation(const QString &identifier, IdentifierType type) const; // ### Qt 5: eliminate, see stripDelimiters() + private: Q_DISABLE_COPY(QSqlDriver) }; diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp index 935466b..12eae84 100644 --- a/src/sql/models/qsqlrelationaltablemodel.cpp +++ b/src/sql/models/qsqlrelationaltablemodel.cpp @@ -182,10 +182,21 @@ void QRelation::populateDictionary() populateModel(); QSqlRecord record; + QString indexColumn; + QString displayColumn; for (int i=0; i < model->rowCount(); ++i) { record = model->record(i); - dictionary[record.field(rel.indexColumn()).value().toString()] = - record.field(rel.displayColumn()).value(); + + indexColumn = rel.indexColumn(); + if (m_parent->database().driver()->isIdentifierEscaped(indexColumn, QSqlDriver::FieldName)) + indexColumn = m_parent->database().driver()->stripDelimiters(indexColumn, QSqlDriver::FieldName); + + displayColumn = rel.displayColumn(); + if (m_parent->database().driver()->isIdentifierEscaped(displayColumn, QSqlDriver::FieldName)) + displayColumn = m_parent->database().driver()->stripDelimiters(displayColumn, QSqlDriver::FieldName); + + dictionary[record.field(indexColumn).value().toString()] = + record.field(displayColumn).value(); } m_dictInitialized = true; } @@ -215,7 +226,7 @@ public: QSqlRelationalTableModelPrivate() : QSqlTableModelPrivate() {} - QString escapedRelationField(const QString &tableName, const QString &fieldName) const; + QString relationField(const QString &tableName, const QString &fieldName) const; int nameToIndex(const QString &name) const; mutable QVector<QRelation> relations; @@ -255,7 +266,10 @@ void QSqlRelationalTableModelPrivate::revertCachedRow(int row) int QSqlRelationalTableModelPrivate::nameToIndex(const QString &name) const { - return baseRec.indexOf(name); + QString fieldname = name; + if (db.driver()->isIdentifierEscaped(fieldname, QSqlDriver::FieldName)) + fieldname = db.driver()->stripDelimiters(fieldname, QSqlDriver::FieldName); + return baseRec.indexOf(fieldname); } void QSqlRelationalTableModelPrivate::clearEditBuffer() @@ -481,14 +495,14 @@ QSqlRelation QSqlRelationalTableModel::relation(int column) const return d->relations.value(column).rel; } -QString QSqlRelationalTableModelPrivate::escapedRelationField(const QString &tableName, +QString QSqlRelationalTableModelPrivate::relationField(const QString &tableName, const QString &fieldName) const { - QString esc; - esc.reserve(tableName.size() + fieldName.size() + 1); - esc.append(tableName).append(QLatin1Char('.')).append(fieldName); + QString ret; + ret.reserve(tableName.size() + fieldName.size() + 1); + ret.append(tableName).append(QLatin1Char('.')).append(fieldName); - return db.driver()->escapeIdentifier(esc, QSqlDriver::FieldName); + return ret; } /*! @@ -514,15 +528,29 @@ QString QSqlRelationalTableModel::selectStatement() const // Count how many times each field name occurs in the record QHash<QString, int> fieldNames; + QStringList fieldList; for (int i = 0; i < rec.count(); ++i) { QSqlRelation relation = d->relations.value(i, nullRelation).rel; QString name; if (relation.isValid()) + { // Count the display column name, not the original foreign key name = relation.displayColumn(); + if (d->db.driver()->isIdentifierEscaped(name, QSqlDriver::FieldName)) + name = d->db.driver()->stripDelimiters(name, QSqlDriver::FieldName); + + QSqlRecord rec = database().record(relation.tableName()); + for (int i = 0; i < rec.count(); ++i) { + if (name.compare(rec.fieldName(i), Qt::CaseInsensitive) == 0) { + name = rec.fieldName(i); + break; + } + } + } else name = rec.fieldName(i); fieldNames.insert(name, fieldNames.value(name, 0) + 1); + fieldList.append(name); } for (int i = 0; i < rec.count(); ++i) { @@ -531,27 +559,30 @@ QString QSqlRelationalTableModel::selectStatement() const QString relTableAlias = QString::fromLatin1("relTblAl_%1").arg(i); if (!fList.isEmpty()) fList.append(QLatin1String(", ")); - fList.append(d->escapedRelationField(relTableAlias, relation.displayColumn())); + fList.append(d->relationField(relTableAlias,relation.displayColumn())); // If there are duplicate field names they must be aliased - if (fieldNames.value(relation.displayColumn()) > 1) { - fList.append(QString::fromLatin1(" AS %1_%2").arg(relation.tableName()).arg(relation.displayColumn())); + if (fieldNames.value(fieldList[i]) > 1) { + QString relTableName = relation.tableName(); + if (d->db.driver()->isIdentifierEscaped(relTableName, QSqlDriver::TableName)) + relTableName = d->db.driver()->stripDelimiters(relTableName, QSqlDriver::TableName); + QString displayColumn = relation.displayColumn(); + if (d->db.driver()->isIdentifierEscaped(displayColumn, QSqlDriver::FieldName)) + displayColumn = d->db.driver()->stripDelimiters(displayColumn, QSqlDriver::FieldName); + fList.append(QString::fromLatin1(" AS %1_%2").arg(relTableName).arg(displayColumn)); } // this needs fixing!! the below if is borken. - if (!tables.contains(relation.tableName())) - tables.append(d->db.driver()->escapeIdentifier(relation.tableName(),QSqlDriver::TableName) - .append(QLatin1String(" ")) - .append(d->db.driver()->escapeIdentifier(relTableAlias, QSqlDriver::TableName))); + tables.append(relation.tableName().append(QLatin1String(" ")).append(relTableAlias)); if(!where.isEmpty()) where.append(QLatin1String(" AND ")); - where.append(d->escapedRelationField(tableName(), rec.fieldName(i))); + where.append(d->relationField(tableName(), d->db.driver()->escapeIdentifier(rec.fieldName(i), QSqlDriver::FieldName))); where.append(QLatin1String(" = ")); - where.append(d->escapedRelationField(relTableAlias, relation.indexColumn())); + where.append(d->relationField(relTableAlias, relation.indexColumn())); } else { if (!fList.isEmpty()) fList.append(QLatin1String(", ")); - fList.append(d->escapedRelationField(tableName(), rec.fieldName(i))); + fList.append(d->relationField(tableName(), d->db.driver()->escapeIdentifier(rec.fieldName(i), QSqlDriver::FieldName))); } } if (!tables.isEmpty()) @@ -560,7 +591,7 @@ QString QSqlRelationalTableModel::selectStatement() const return query; if(!tList.isEmpty()) tList.prepend(QLatin1String(", ")); - tList.prepend(d->db.driver()->escapeIdentifier(tableName(),QSqlDriver::TableName)); + tList.prepend(tableName()); query.append(QLatin1String("SELECT ")); query.append(fList).append(QLatin1String(" FROM ")).append(tList); qAppendWhereClause(query, where, filter()); @@ -690,7 +721,7 @@ QString QSqlRelationalTableModel::orderByClause() const return QSqlTableModel::orderByClause(); QString s = QLatin1String("ORDER BY "); - s.append(d->escapedRelationField(QLatin1String("relTblAl_") + QString::number(d->sortColumn), + s.append(d->relationField(QLatin1String("relTblAl_") + QString::number(d->sortColumn), rel.displayColumn())); s += d->sortOrder == Qt::AscendingOrder ? QLatin1String(" ASC") : QLatin1String(" DESC"); return s; diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 2fb9b0f..c2442c5 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -98,7 +98,10 @@ bool QSqlTableModelPrivate::setRecord(int row, const QSqlRecord &record) int QSqlTableModelPrivate::nameToIndex(const QString &name) const { - return rec.indexOf(name); + QString fieldname = name; + if (db.driver()->isIdentifierEscaped(fieldname, QSqlDriver::FieldName)) + fieldname = db.driver()->stripDelimiters(fieldname, QSqlDriver::FieldName); + return rec.indexOf(fieldname); } void QSqlTableModelPrivate::initRecordAndPrimaryIndex() @@ -367,10 +370,7 @@ void QSqlTableModel::setTable(const QString &tableName) { Q_D(QSqlTableModel); clear(); - if(d->db.tables().contains(tableName.toUpper())) - d->tableName = tableName.toUpper(); - else - d->tableName = tableName; + d->tableName = tableName; d->initRecordAndPrimaryIndex(); d->initColOffsets(d->rec.count()); @@ -976,7 +976,9 @@ QString QSqlTableModel::orderByClause() const if (!f.isValid()) return s; - QString table = d->db.driver()->escapeIdentifier(d->tableName, QSqlDriver::TableName); + QString table = d->tableName; + //we can safely escape the field because it would have been obtained from the database + //and have the correct case QString field = d->db.driver()->escapeIdentifier(f.name(), QSqlDriver::FieldName); s.append(QLatin1String("ORDER BY ")).append(table).append(QLatin1Char('.')).append(field); s += d->sortOrder == Qt::AscendingOrder ? QLatin1String(" ASC") : QLatin1String(" DESC"); @@ -1317,8 +1319,12 @@ bool QSqlTableModel::setRecord(int row, const QSqlRecord &record) mrow.rec = d->rec; mrow.primaryValues = d->primaryValues(indexInQuery(createIndex(row, 0)).row()); } + QString fieldName; for (int i = 0; i < record.count(); ++i) { - int idx = mrow.rec.indexOf(record.fieldName(i)); + fieldName = record.fieldName(i); + if (d->db.driver()->isIdentifierEscaped(fieldName, QSqlDriver::FieldName)) + fieldName = d->db.driver()->stripDelimiters(fieldName, QSqlDriver::FieldName); + int idx = mrow.rec.indexOf(fieldName); if (idx == -1) isOk = false; else diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index f7b2ae8..e822da5 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -516,7 +516,34 @@ public: \brief The QSvgGenerator class provides a paint device that is used to create SVG drawings. \reentrant - \sa QSvgRenderer, QSvgWidget + This paint device represents a Scalable Vector Graphics (SVG) drawing. Like QPrinter, it is + designed as a write-only device that generates output in a specific format. + + To write an SVG file, you first need to configure the output by setting the \l fileName + or \l outputDevice properties. It is usually necessary to specify the size of the drawing + by setting the \l size property, and in some cases where the drawing will be included in + another, the \l viewBox property also needs to be set. + + \snippet examples/painting/svggenerator/window.cpp configure SVG generator + + Other meta-data can be specified by setting the \a title, \a description and \a resolution + properties. + + As with other QPaintDevice subclasses, a QPainter object is used to paint onto an instance + of this class: + + \snippet examples/painting/svggenerator/window.cpp begin painting + \dots + \snippet examples/painting/svggenerator/window.cpp end painting + + Painting is performed in the same way as for any other paint device. However, + it is necessary to use the QPainter::begin() and \l{QPainter::}{end()} to + explicitly begin and end painting on the device. + + The \l{SVG Generator Example} shows how the same painting commands can be used + for painting a widget and writing an SVG file. + + \sa QSvgRenderer, QSvgWidget, {About SVG} */ /*! diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 56dab5f..433a3ad 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -2587,10 +2587,12 @@ static void parseBaseGradient(QSvgNode *node, if (prop && prop->type() == QSvgStyleProperty::GRADIENT) { QSvgGradientStyle *inherited = static_cast<QSvgGradientStyle*>(prop); - if (!inherited->stopLink().isEmpty()) + if (!inherited->stopLink().isEmpty()) { gradProp->setStopLink(inherited->stopLink(), handler->document()); - else + } else { grad->setStops(inherited->qgradient()->stops()); + gradProp->setGradientStopsSet(inherited->gradientStopsSet()); + } matrix = inherited->qmatrix(); } else { @@ -2649,7 +2651,6 @@ static QSvgStyleProperty *createLinearGradientNode(QSvgNode *node, } QLinearGradient *grad = new QLinearGradient(nx1, ny1, nx2, ny2); - grad->setColorAt(qQNaN(), QColor()); grad->setInterpolationMode(QGradient::ComponentInterpolation); QSvgGradientStyle *prop = new QSvgGradientStyle(grad); parseBaseGradient(node, attributes, prop, handler); @@ -2783,7 +2784,6 @@ static QSvgStyleProperty *createRadialGradientNode(QSvgNode *node, nfy = toDouble(fy); QRadialGradient *grad = new QRadialGradient(ncx, ncy, nr, nfx, nfy); - grad->setColorAt(qQNaN(), QColor()); grad->setInterpolationMode(QGradient::ComponentInterpolation); QSvgGradientStyle *prop = new QSvgGradientStyle(grad); @@ -2929,12 +2929,9 @@ static bool parseStopNode(QSvgStyleProperty *parent, QGradient *grad = style->qgradient(); offset = qMin(qreal(1), qMax(qreal(0), offset)); // Clamp to range [0, 1] - QGradientStops stops = grad->stops(); - // Check if the gradient is marked as empty (marked with one single stop at NaN). - if ((stops.size() == 1) && qIsNaN(stops.at(0).first)) { - stops.clear(); - grad->setStops(stops); - } else { + QGradientStops stops; + if (style->gradientStopsSet()) { + stops = grad->stops(); // If the stop offset equals the one previously added, add an epsilon to make it greater. if (offset <= stops.back().first) offset = stops.back().first + FLT_EPSILON; @@ -2950,6 +2947,7 @@ static bool parseStopNode(QSvgStyleProperty *parent, } grad->setColorAt(offset, color); + style->setGradientStopsSet(true); if (!colorOK) style->addResolve(offset); return true; diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index 389f68f..b065395 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -231,7 +231,7 @@ void QSvgSolidColorStyle::revert(QPainter *p, QSvgExtraStates &) } QSvgGradientStyle::QSvgGradientStyle(QGradient *grad) - : m_gradient(grad) + : m_gradient(grad), m_gradientStopsSet(false) { } @@ -256,14 +256,13 @@ void QSvgGradientStyle::apply(QPainter *p, const QRectF &/*rect*/, QSvgNode *, Q } // If the gradient is marked as empty, insert transparent black - QGradientStops stops = m_gradient->stops(); - if (stops.size() == 1 && qIsNaN(stops.at(0).first)) + if (!m_gradientStopsSet) { m_gradient->setStops(QGradientStops() << QGradientStop(0.0, QColor(0, 0, 0, 0))); - - QGradient gradient = *m_gradient; + m_gradientStopsSet = true; + } QBrush brush; - brush = QBrush(gradient); + brush = QBrush(*m_gradient); if (!m_matrix.isIdentity()) brush.setMatrix(m_matrix); diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h index ff4058b..058ba35 100644 --- a/src/svg/qsvgstyle_p.h +++ b/src/svg/qsvgstyle_p.h @@ -376,6 +376,16 @@ public: } void addResolve(qreal offset); + + bool gradientStopsSet() const + { + return m_gradientStopsSet; + } + + void setGradientStopsSet(bool set) + { + m_gradientStopsSet = set; + } private: QGradient *m_gradient; QList<qreal> m_resolvePoints; @@ -386,6 +396,7 @@ private: QSvgTinyDocument *m_doc; QString m_link; + bool m_gradientStopsSet; }; class QSvgTransformStyle : public QSvgStyleProperty diff --git a/src/tools/moc/util/generate.sh b/src/tools/moc/util/generate.sh index 4c6c431..215b8cb 100755 --- a/src/tools/moc/util/generate.sh +++ b/src/tools/moc/util/generate.sh @@ -1,11 +1,7 @@ #!/bin/sh -p4 edit ../keywords.cpp -p4 edit ../ppkeywords.cpp qmake make cat licenseheader.txt > ../keywords.cpp cat licenseheader.txt > ../ppkeywords.cpp ./generate_keywords >> ../keywords.cpp ./generate_keywords preprocessor >> ../ppkeywords.cpp -p4 revert -a ../keywords.cpp -p4 revert -a ../ppkeywords.cpp diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index 990db84..8b061cd 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -49,80 +49,58 @@ #include <QtCore/QFileInfo> #include <QtCore/QTextStream> -QT_BEGIN_NAMESPACE - -namespace { - enum { debugWriteIncludes = 0 }; - enum { warnHeaderGeneration = 0 }; - -struct StringPair -{ - const char *key; - const char *value; +#include <stdio.h> - inline bool operator<(const StringPair &b) const { return qstrcmp(key, b.key) < 0; } -}; +QT_BEGIN_NAMESPACE +enum { debugWriteIncludes = 0 }; +enum { warnHeaderGeneration = 0 }; -class StringPairs +struct ClassInfoEntry { -public: - StringPairs(StringPair *begin, int n) - : m_begin(begin), m_n(n) - { - qSort(m_begin, m_begin + n); - } - - const char *searchEntry(const QString &str) const - { - QByteArray ba = str.toLatin1(); - const StringPair *begin = m_begin; - const StringPair *end = m_begin + m_n; - while (true) { - int d = (end - begin) / 2; - if (d == 0) - return 0; - const StringPair *mid = begin + d; - int i = qstrcmp(mid->key, ba.constData()); - if (i == 0) - return mid->value; - if (i < 0) - begin = mid; - else - end = mid; - } - } - -private: - StringPair *m_begin; - int m_n; + const char *klass; + const char *module; + const char *header; }; - -static StringPair cth[] = { -#define QT_CLASS_LIB(klass, module, header) { #klass, #module "/" #klass }, +static const ClassInfoEntry qclass_lib_map[] = { +#define QT_CLASS_LIB(klass, module, header) { #klass, #module, #header }, #include "qclass_lib_map.h" -#undef QT_CLASS_LIB -}; - -static StringPair hth[] = { -#define QT_CLASS_LIB(klass, module, header) { #header, #module "/" #klass }, -#include "qclass_lib_map.h" #undef QT_CLASS_LIB }; -static StringPairs classToHeader(cth, sizeof(cth) / sizeof(cth[0])); -static StringPairs oldHeaderToHeader(hth, sizeof(hth) / sizeof(hth[0])); - -} // namespace anon - +// Format a module header as 'QtCore/QObject' +static inline QString moduleHeader(const QString &module, const QString &header) +{ + QString rc = module; + rc += QLatin1Char('/'); + rc += header; + return rc; +} namespace CPP { WriteIncludes::WriteIncludes(Uic *uic) : m_uic(uic), m_output(uic->output()), m_scriptsActivated(false) { + // When possible (no namespace) use the "QtModule/QClass" convention + // and create a re-mapping of the old header "qclass.h" to it. Do not do this + // for the "Phonon::Someclass" classes, however. + const QString namespaceDelimiter = QLatin1String("::"); + const ClassInfoEntry *classLibEnd = qclass_lib_map + sizeof(qclass_lib_map)/sizeof(ClassInfoEntry); + for(const ClassInfoEntry *it = qclass_lib_map; it < classLibEnd; ++it) { + const QString klass = QLatin1String(it->klass); + const QString module = QLatin1String(it->module); + QLatin1String header = QLatin1String(it->header); + if (klass.contains(namespaceDelimiter)) { + m_classToHeader.insert(klass, moduleHeader(module, header)); + } else { + const QString newHeader = moduleHeader(module, klass); + m_classToHeader.insert(klass, newHeader); + m_oldHeaderToNewHeader.insert(header, newHeader); + } + } } void WriteIncludes::acceptUI(DomUI *node) @@ -171,6 +149,9 @@ void WriteIncludes::acceptUI(DomUI *node) void WriteIncludes::acceptWidget(DomWidget *node) { + if (debugWriteIncludes) + fprintf(stderr, "%s '%s'\n", Q_FUNC_INFO, qPrintable(node->attributeClass())); + add(node->attributeClass()); TreeWalker::acceptWidget(node); } @@ -198,17 +179,17 @@ void WriteIncludes::acceptProperty(DomProperty *node) void WriteIncludes::insertIncludeForClass(const QString &className, QString header, bool global) { - if (debugWriteIncludes) { - qDebug() << "WriteIncludes::insertIncludeForClass" << className << header << global; - } + if (debugWriteIncludes) + fprintf(stderr, "%s %s '%s' %d\n", Q_FUNC_INFO, qPrintable(className), qPrintable(header), global); do { if (!header.isEmpty()) break; - // Known class - if (const char *p = classToHeader.searchEntry(className)) { - header = QLatin1String(p); + // Known class + const StringMap::const_iterator it = m_classToHeader.constFind(className); + if (it != m_classToHeader.constEnd()) { + header = it.value(); global = true; break; } @@ -245,9 +226,8 @@ void WriteIncludes::insertIncludeForClass(const QString &className, QString head void WriteIncludes::add(const QString &className, bool determineHeader, const QString &header, bool global) { - if (debugWriteIncludes) { - qDebug() << "WriteIncludes::add" << className << header << global; - } + if (debugWriteIncludes) + fprintf(stderr, "%s %s '%s' %d\n", Q_FUNC_INFO, qPrintable(className), qPrintable(header), global); if (className.isEmpty() || m_knownClasses.contains(className)) return; @@ -283,7 +263,7 @@ void WriteIncludes::acceptCustomWidget(DomCustomWidget *node) // custom header unless it is a built-in qt class QString header; bool global = false; - if (!classToHeader.searchEntry(className)) { + if (!m_classToHeader.contains(className)) { global = node->elementHeader()->attributeLocation().toLower() == QLatin1String("global"); header = node->elementHeader()->text(); } @@ -311,9 +291,8 @@ void WriteIncludes::acceptInclude(DomInclude *node) void WriteIncludes::insertInclude(const QString &header, bool global) { - if (debugWriteIncludes) { - qDebug() << "WriteIncludes::insertInclude" << header << global; - } + if (debugWriteIncludes) + fprintf(stderr, "%s %s %d\n", Q_FUNC_INFO, qPrintable(header), global); OrderedSet &includes = global ? m_globalIncludes : m_localIncludes; if (includes.contains(header)) @@ -328,17 +307,13 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global) { const QChar openingQuote = global ? QLatin1Char('<') : QLatin1Char('"'); const QChar closingQuote = global ? QLatin1Char('>') : QLatin1Char('"'); - const QChar qHeaderStart = QLatin1Char('q'); + // Check for the old headers 'qslider.h' and replace by 'QtGui/QSlider' const OrderedSet::const_iterator cend = headers.constEnd(); for (OrderedSet::const_iterator sit = headers.constBegin(); sit != cend; ++sit) { - QString header = sit.key(); - // Check for the old qslider.h and replace by QtGui/QSlider, - // but don't do that for phonon headers (volumeslider.h) - if (header.startsWith(qHeaderStart)) { - if (const char *p = oldHeaderToHeader.searchEntry(header)) - header = QLatin1String(p); - } + const StringMap::const_iterator hit = m_oldHeaderToNewHeader.constFind(sit.key()); + const bool mapped = hit != m_oldHeaderToNewHeader.constEnd(); + const QString header = mapped ? hit.value() : sit.key(); if (!header.trimmed().isEmpty()) { m_output << "#include " << openingQuote << header << closingQuote << QLatin1Char('\n'); } diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h index 55bd433..8b79041 100644 --- a/src/tools/uic/cpp/cppwriteincludes.h +++ b/src/tools/uic/cpp/cppwriteincludes.h @@ -101,6 +101,11 @@ private: QSet<QString> m_includeBaseNames; QSet<QString> m_knownClasses; + + typedef QMap<QString, QString> StringMap; + StringMap m_classToHeader; + StringMap m_oldHeaderToNewHeader; + bool m_scriptsActivated; }; diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index ed06006..3d702dd 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1648,21 +1648,21 @@ QString WriteInitialization::writeIconProperties(const DomResourceIcon *i) const QString pixmap = QLatin1String("QPixmap"); m_output << m_indent << "QIcon " << iconName << ";\n"; if (i->hasElementNormalOff()) - m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementNormalOff()->text()) << ", QIcon::Normal, QIcon::Off);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Normal, QIcon::Off);\n"; if (i->hasElementNormalOn()) - m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementNormalOn()->text()) << ", QIcon::Normal, QIcon::On);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Normal, QIcon::On);\n"; if (i->hasElementDisabledOff()) - m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementDisabledOff()->text()) << ", QIcon::Disabled, QIcon::Off);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Disabled, QIcon::Off);\n"; if (i->hasElementDisabledOn()) - m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementDisabledOn()->text()) << ", QIcon::Disabled, QIcon::On);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Disabled, QIcon::On);\n"; if (i->hasElementActiveOff()) - m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementActiveOff()->text()) << ", QIcon::Active, QIcon::Off);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Active, QIcon::Off);\n"; if (i->hasElementActiveOn()) - m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementActiveOn()->text()) << ", QIcon::Active, QIcon::On);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Active, QIcon::On);\n"; if (i->hasElementSelectedOff()) - m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementSelectedOff()->text()) << ", QIcon::Selected, QIcon::Off);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Selected, QIcon::Off);\n"; if (i->hasElementSelectedOn()) - m_output << m_indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementSelectedOn()->text()) << ", QIcon::Selected, QIcon::On);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Selected, QIcon::On);\n"; } else { // pre-4.4 legacy m_output << m_indent << "const QIcon " << iconName << " = " << pixCall(QLatin1String("QIcon"), i->text())<< ";\n"; } diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp index a72e689..6ab71f8 100644 --- a/tests/arthur/common/paintcommands.cpp +++ b/tests/arthur/common/paintcommands.cpp @@ -1886,7 +1886,6 @@ void PaintCommands::command_setBrushOrigin(QRegExp re) /***************************************************************************************************/ void PaintCommands::command_brushTranslate(QRegExp re) { -#if QT_VERSION > 0x040200 QStringList caps = re.capturedTexts(); double dx = convertToDouble(caps.at(1)); double dy = convertToDouble(caps.at(2)); @@ -1899,13 +1898,11 @@ void PaintCommands::command_brushTranslate(QRegExp re) brush_matrix.translate(dx, dy); new_brush.setTransform(brush_matrix); m_painter->setBrush(new_brush); -#endif } /***************************************************************************************************/ void PaintCommands::command_brushScale(QRegExp re) { -#if QT_VERSION > 0x040200 QStringList caps = re.capturedTexts(); double sx = convertToDouble(caps.at(1)); double sy = convertToDouble(caps.at(2)); @@ -1918,13 +1915,11 @@ void PaintCommands::command_brushScale(QRegExp re) brush_matrix.scale(sx, sy); new_brush.setTransform(brush_matrix); m_painter->setBrush(new_brush); -#endif } /***************************************************************************************************/ void PaintCommands::command_brushRotate(QRegExp re) { -#if QT_VERSION > 0x040200 QStringList caps = re.capturedTexts(); double rot = convertToDouble(caps.at(1)); @@ -1936,13 +1931,11 @@ void PaintCommands::command_brushRotate(QRegExp re) brush_matrix.rotate(rot); new_brush.setTransform(brush_matrix); m_painter->setBrush(new_brush); -#endif } /***************************************************************************************************/ void PaintCommands::command_brushShear(QRegExp re) { -#if QT_VERSION > 0x040200 QStringList caps = re.capturedTexts(); double sx = convertToDouble(caps.at(1)); double sy = convertToDouble(caps.at(2)); @@ -1955,7 +1948,6 @@ void PaintCommands::command_brushShear(QRegExp re) brush_matrix.shear(sx, sy); new_brush.setTransform(brush_matrix); m_painter->setBrush(new_brush); -#endif } /***************************************************************************************************/ @@ -2326,10 +2318,8 @@ void PaintCommands::command_gradient_setLinear(QRegExp re) lg.setSpread(m_gradientSpread); lg.setCoordinateMode(m_gradientCoordinate); QBrush brush(lg); -#if QT_VERSION > 0x040200 QTransform brush_matrix = m_painter->brush().transform(); brush.setTransform(brush_matrix); -#endif m_painter->setBrush(brush); } @@ -2375,10 +2365,8 @@ void PaintCommands::command_gradient_setRadial(QRegExp re) rg.setSpread(m_gradientSpread); rg.setCoordinateMode(m_gradientCoordinate); QBrush brush(rg); -#if QT_VERSION > 0x040200 QTransform brush_matrix = m_painter->brush().transform(); brush.setTransform(brush_matrix); -#endif m_painter->setBrush(brush); } @@ -2400,10 +2388,8 @@ void PaintCommands::command_gradient_setConical(QRegExp re) cg.setSpread(m_gradientSpread); cg.setCoordinateMode(m_gradientCoordinate); QBrush brush(cg); -#if QT_VERSION > 0x040200 QTransform brush_matrix = m_painter->brush().transform(); brush.setTransform(brush_matrix); -#endif m_painter->setBrush(brush); } @@ -2448,7 +2434,6 @@ void PaintCommands::command_surface_begin(QRegExp re) m_surface_painter = m_painter; -#if QT_VERSION > 0x040200 if (m_type == OpenGLType || m_type == OpenGLPBufferType) { #ifndef QT_NO_OPENGL m_surface_pbuffer = new QGLPixelBuffer(qRound(w), qRound(h)); @@ -2461,9 +2446,7 @@ void PaintCommands::command_surface_begin(QRegExp re) m_surface_pixmap.fill(Qt::transparent); m_painter = new QPainter(&m_surface_pixmap); #endif - } else -#endif - { + } else { m_surface_image = QImage(qRound(w), qRound(h), QImage::Format_ARGB32_Premultiplied); m_surface_image.fill(0); m_painter = new QPainter(&m_surface_image); diff --git a/tests/arthur/common/qengines.cpp b/tests/arthur/common/qengines.cpp index 46f4e6b..9cd2389 100644 --- a/tests/arthur/common/qengines.cpp +++ b/tests/arthur/common/qengines.cpp @@ -243,11 +243,7 @@ void GLEngine::prepare(const QSize &_size, const QColor &color) size = _size; fillColor = color; if (usePixelBuffers) { -#if (QT_VERSION < 0x040200) && defined(Q_WS_MAC) - pbuffer = new QGLPixelBuffer(QSize(512, 512), QGLFormat(QGL::SampleBuffers)); -#else pbuffer = new QGLPixelBuffer(size, QGLFormat(QGL::SampleBuffers)); -#endif } else { widget = new QGLWidget(QGLFormat(QGL::SampleBuffers)); widget->setAutoFillBackground(false); diff --git a/tests/arthur/data/qps/primitives.qps b/tests/arthur/data/qps/primitives.qps index dcb6516..c4cc92c 100644 --- a/tests/arthur/data/qps/primitives.qps +++ b/tests/arthur/data/qps/primitives.qps @@ -177,3 +177,22 @@ repeat_block drawShapes setPen black 4 translate 75 0 repeat_block drawShapes + +resetMatrix +setRenderHint Antialiasing off +setPen nopen +translate 550 100 +setBrush #7f7f7fff +drawRect -0.5 -0.5 21 21 +setBrush red +drawEllipse 0 0 20 20 +setBrush nobrush +setPen black +drawEllipse 0 0 20 20 + +translate 25 0 +setPen nopen +setBrush #7f7f7fff +drawRect 0 0 20 20 +setBrush red +drawEllipse 0 0 20 20 diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index ee44a62..f8f15a3 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -273,7 +273,6 @@ SUBDIRS += bic \ qspinbox \ qsplitter \ qsql \ - qsqlbatch \ qsqldatabase \ qsqlerror \ qsqlfield \ @@ -414,8 +413,7 @@ SUBDIRS += checkxmlfiles \ xmlpatternsdiagnosticsts \ xmlpatternsview \ xmlpatternsxqts \ - xmlpatternsxslts \ - xmlpatterns + xmlpatternsxslts xmlpatternsdiagnosticsts.depends = xmlpatternsxqts xmlpatternsview.depends = xmlpatternsxqts diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp index e0f42f0..181c275 100644 --- a/tests/auto/bic/tst_bic.cpp +++ b/tests/auto/bic/tst_bic.cpp @@ -195,29 +195,10 @@ void tst_Bic::sizesAndVTables_data() && archFileName420.isEmpty()) QSKIP("No reference files found for this platform", SkipAll); -#if QT_VERSION >= 0x040100 bool isPatchRelease400 = false; -#else - bool isPatchRelease400 = true; -#endif - -#if QT_VERSION >= 0x040200 bool isPatchRelease410 = false; -#else - bool isPatchRelease410 = true; -#endif - -#if QT_VERSION >= 0x040300 bool isPatchRelease420 = false; -#else - bool isPatchRelease420 = true; -#endif - -#if QT_VERSION >= 0x040400 bool isPatchRelease430 = false; -#else - bool isPatchRelease430 = true; -#endif QTest::addColumn<QString>("oldLib"); QTest::addColumn<bool>("isPatchRelease"); diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp index 6d3d1df..c05d8da 100644 --- a/tests/auto/collections/tst_collections.cpp +++ b/tests/auto/collections/tst_collections.cpp @@ -161,9 +161,7 @@ private slots: void q_init(); void pointersize(); void containerInstantiation(); -#if QT_VERSION >= 0x040101 void qtimerList(); -#endif void containerTypedefs(); void forwardDeclared(); }; @@ -1907,11 +1905,9 @@ void tst_Collections::map() i.toFront(); while(i.hasNext()) { sum += i.next().value(); -#if QT_VERSION >= 0x040100 i.setValue(10); i.value() += 22; QVERIFY(i.value() == 32); -#endif } QVERIFY(sum == 11); } @@ -2870,10 +2866,8 @@ void tst_Collections::javaStyleIterators() while (i.hasPrevious()) { i.previous(); QVERIFY(i.value().isEmpty()); -#if QT_VERSION >= 0x040100 i.value() = "x"; QCOMPARE(i.value(), QString("x")); -#endif } } @@ -3355,7 +3349,6 @@ void tst_Collections::containerInstantiation() instantiateRandomAccess<Stack, EqualsComparable>(); } -#if QT_VERSION >= 0x040101 void tst_Collections::qtimerList() { QList<double> foo; @@ -3378,7 +3371,6 @@ void tst_Collections::qtimerList() } QFAIL("QList preallocates too much memory"); } -#endif template <typename Container> void testContainerTypedefs(Container container) @@ -3387,11 +3379,11 @@ void testContainerTypedefs(Container container) { typedef typename Container::value_type Foo; } { typedef typename Container::iterator Foo; } { typedef typename Container::const_iterator Foo; } - { typedef typename Container::reference Foo; } - { typedef typename Container::const_reference Foo; } - { typedef typename Container::pointer Foo; } - { typedef typename Container::difference_type Foo; } - { typedef typename Container::size_type Foo; } + { typedef typename Container::reference Foo; } + { typedef typename Container::const_reference Foo; } + { typedef typename Container::pointer Foo; } + { typedef typename Container::difference_type Foo; } + { typedef typename Container::size_type Foo; } } template <typename Container> @@ -3403,11 +3395,11 @@ void testPairAssociativeContainerTypedefs(Container container) // { typedef typename Container::value_type Foo; } // { typedef typename Container::const_iterator Foo; } // { typedef typename Container::reference Foo; } -// { typedef typename Container::const_reference Foo; } -// { typedef typename Container::pointer Foo; } +// { typedef typename Container::const_reference Foo; } +// { typedef typename Container::pointer Foo; } - { typedef typename Container::difference_type Foo; } - { typedef typename Container::size_type Foo; } + { typedef typename Container::difference_type Foo; } + { typedef typename Container::size_type Foo; } { typedef typename Container::iterator Foo; } { typedef typename Container::key_type Foo; } { typedef typename Container::mapped_type Foo; } @@ -3422,11 +3414,11 @@ void testSetContainerTypedefs(Container container) Q_UNUSED(container) { typedef typename Container::iterator Foo; } { typedef typename Container::const_iterator Foo; } - { typedef typename Container::reference Foo; } - { typedef typename Container::const_reference Foo; } - { typedef typename Container::pointer Foo; } - { typedef typename Container::difference_type Foo; } - { typedef typename Container::size_type Foo; } + { typedef typename Container::reference Foo; } + { typedef typename Container::const_reference Foo; } + { typedef typename Container::pointer Foo; } + { typedef typename Container::difference_type Foo; } + { typedef typename Container::size_type Foo; } { typedef typename Container::key_type Foo; } } @@ -3450,7 +3442,7 @@ void tst_Collections::containerTypedefs() } #if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) -class Key1 +class Key1 {}; class T1 {}; diff --git a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp index 232af55..1f5f479 100644 --- a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp +++ b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp @@ -173,9 +173,7 @@ void tst_CompilerWarnings::warnings() << "-Wno-long-long" << "-Wshadow" << "-Wpacked" << "-Wunreachable-code" << "-Wundef" << "-Wchar-subscripts" << "-Wformat-nonliteral" << "-Wformat-security" << "-Wcast-align" -#if QT_VERSION >= 0x040100 << "-Wfloat-equal" -#endif << "-o" << tmpFile << tmpSourceFile; #elif defined(Q_CC_XLC) diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index 96589b7..1b113b2 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -349,6 +349,18 @@ void tst_MediaObject::_pausePlayback() void tst_MediaObject::initTestCase() { QCoreApplication::setApplicationName("tst_MediaObject"); + m_stateChangedSignalSpy = 0; + m_media = 0; + +#ifdef Q_OS_WINCE + QString pluginsPath = QLibraryInfo::location(QLibraryInfo::PluginsPath); +#ifdef DEBUG + QVERIFY(QFile::exists(pluginsPath + "/phonon_backend/phonon_waveoutd4.dll") || QFile::exists(pluginsPath + "/phonon_backend/phonon_phonon_ds9d4.dll")); +#else + QVERIFY(QFile::exists(pluginsPath + "/phonon_backend/phonon_waveout4.dll") || QFile::exists(pluginsPath + "/phonon_backend/phonon_phonon_ds94.dll")); +#endif +#endif + m_url = qgetenv("PHONON_TESTURL"); m_media = new MediaObject(this); @@ -787,7 +799,7 @@ void tst_MediaObject::setMediaAndPlay() QSignalSpy totalTimeChangedSignalSpy(m_media, SIGNAL(totalTimeChanged(qint64))); QVERIFY(m_media->currentSource().type() != MediaSource::Invalid); Phonon::State state = m_media->state(); - QVERIFY(state == Phonon::StoppedState || state == Phonon::PlayingState); + QVERIFY(state == Phonon::StoppedState || state == Phonon::PlayingState || Phonon::PausedState); m_media->setCurrentSource(m_url); // before calling play() we better make sure that if play() finishes very fast that we don't get // called again @@ -856,8 +868,10 @@ void tst_MediaObject::testPlayBeforeFinish() void tst_MediaObject::cleanupTestCase() { - delete m_stateChangedSignalSpy; - delete m_media; + if (m_stateChangedSignalSpy) + delete m_stateChangedSignalSpy; + if (m_media) + delete m_media; #ifdef Q_OS_WINCE QTest::qWait(200); #endif diff --git a/tests/auto/moc/forgotten-qinterface.h b/tests/auto/moc/forgotten-qinterface.h index a11793b..370a3d0 100644 --- a/tests/auto/moc/forgotten-qinterface.h +++ b/tests/auto/moc/forgotten-qinterface.h @@ -39,6 +39,8 @@ ** ****************************************************************************/ +#include <QObject> + struct MyInterface { virtual ~MyInterface() {} diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index 39f4f23..afb31f6 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -151,7 +151,6 @@ public slots: Q_DECLARE_METATYPE(MyStruct) Q_DECLARE_METATYPE(MyStruct*) -#if QT_VERSION >= 0x040200 namespace myNS { struct Points { @@ -161,7 +160,6 @@ namespace myNS { } Q_DECLARE_METATYPE(myNS::Points) -#endif class TestClassinfoWithEscapes: public QObject { @@ -195,10 +193,7 @@ class TestClass : public MyNamespace::TestSuperClass, public DONT_CONFUSE_MOC(My public DONT_CONFUSE_MOC_EVEN_MORE(MyStruct2, dummy, ignored) { Q_OBJECT -#if QT_VERSION >= 0x040101 Q_CLASSINFO("help", QT_TR_NOOP("Opening this will let you configure something")) -#endif -#if QT_VERSION >= 0x040102 Q_PROPERTY(short int shortIntProperty READ shortIntProperty) Q_PROPERTY(unsigned short int unsignedShortIntProperty READ unsignedShortIntProperty) Q_PROPERTY(signed short int signedShortIntProperty READ signedShortIntProperty) @@ -206,10 +201,7 @@ class TestClass : public MyNamespace::TestSuperClass, public DONT_CONFUSE_MOC(My Q_PROPERTY(unsigned long int unsignedLongIntProperty READ unsignedLongIntProperty) Q_PROPERTY(signed long int signedLongIntProperty READ signedLongIntProperty) Q_PROPERTY(long double longDoubleProperty READ longDoubleProperty) -#endif -#if QT_VERSION >= 0x040200 Q_PROPERTY(myNS::Points points READ points WRITE setPoints) -#endif Q_CLASSINFO("Multi" "line", @@ -294,9 +286,7 @@ private slots: #ifndef NOLONGLONG void slotWithULongLong(unsigned long long) {} -#if QT_VERSION >= 0x040101 void slotWithULongLongP(unsigned long long*) {} -#endif void slotWithULong(unsigned long) {} void slotWithLongLong(long long) {} void slotWithLong(long) {} @@ -304,9 +294,7 @@ private slots: void slotWithColonColonType(::Int::Type) {} -#if QT_VERSION >= 0x040101 TestClass &slotWithReferenceReturnType() { return *this; } -#endif #if (0 && 1) || 1 void expressionEvaluationShortcut1() {} @@ -321,7 +309,6 @@ public slots: void slotWithNamedArray(const double namedArray[3]) {} void slotWithMultiArray(const double[3][4]) {} -#if QT_VERSION >= 0x040102 short int shortIntProperty() { return 0; } unsigned short int unsignedShortIntProperty() { return 0; } signed short int signedShortIntProperty() { return 0; } @@ -329,12 +316,9 @@ public slots: unsigned long int unsignedLongIntProperty() { return 0; } signed long int signedLongIntProperty() { return 0; } long double longDoubleProperty() { return 0.0; } -#endif -#if QT_VERSION >= 0x040200 myNS::Points points() { return m_points; } void setPoints(myNS::Points points) { m_points = points; } -#endif signals: void signalWithArray(const double[3]); @@ -384,10 +368,8 @@ public: public slots: void slotWithVoidStar(void *) {} -#if QT_VERSION >= 0x040200 private: myNS::Points m_points; -#endif private slots: inline virtual void blub1() {} @@ -466,6 +448,8 @@ public: inline tst_Moc() {} private slots: + void initTestCase(); + void slotWithException() throw(MyStruct); void dontStripNamespaces(); void oldStyleCasts(); @@ -519,8 +503,28 @@ private: bool user2() { return false; }; bool user3() { return false; }; bool userFunction(){ return false; }; + +private: + QString qtIncludePath; }; +void tst_Moc::initTestCase() +{ +#if defined(Q_OS_UNIX) + QProcess proc; + proc.start("qmake", QStringList() << "-query" << "QT_INSTALL_HEADERS"); + QVERIFY(proc.waitForFinished()); + QCOMPARE(proc.exitCode(), 0); + QByteArray output = proc.readAllStandardOutput(); + QVERIFY(!output.isEmpty()); + QCOMPARE(proc.readAllStandardError(), QByteArray()); + qtIncludePath = QString::fromLocal8Bit(output).trimmed(); + QFileInfo fi(qtIncludePath); + QVERIFY(fi.exists()); + QVERIFY(fi.isDir()); +#endif +} + void tst_Moc::slotWithException() throw(MyStruct) { // be happy @@ -552,8 +556,6 @@ void tst_Moc::oldStyleCasts() QSKIP("Not tested when cross-compiled", SkipAll); #endif #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - QVERIFY(!qgetenv("QTDIR").isNull()); - QProcess proc; proc.start("moc", QStringList(srcify("/oldstyle-casts.h"))); QVERIFY(proc.waitForFinished()); @@ -564,7 +566,7 @@ void tst_Moc::oldStyleCasts() QStringList args; args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "." - << "-I" << qgetenv("QTDIR") + "/include" << "-o" << "/dev/null" << "-"; + << "-I" << qtIncludePath << "-o" << "/dev/null" << "-"; proc.start("gcc", args); QVERIFY(proc.waitForStarted()); proc.write(mocOut); @@ -584,8 +586,6 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction() QSKIP("Not tested when cross-compiled", SkipAll); #endif #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - QVERIFY(!qgetenv("QTDIR").isNull()); - QProcess proc; proc.start("moc", QStringList(srcify("extraqualification.h"))); QVERIFY(proc.waitForFinished()); @@ -610,10 +610,8 @@ void tst_Moc::uLongLong() QVERIFY(idx != -1); idx = mobj->indexOfSlot("slotWithULongLong(unsigned long long)"); QVERIFY(idx != -1); -#if QT_VERSION >= 0x040101 idx = mobj->indexOfSlot("slotWithULongLongP(unsigned long long*)"); QVERIFY(idx != -1); -#endif idx = mobj->indexOfSlot("slotWithLong(long)"); QVERIFY(idx != -1); @@ -630,8 +628,6 @@ void tst_Moc::inputFileNameWithDotsButNoExtension() QSKIP("Not tested when cross-compiled", SkipAll); #endif #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - QVERIFY(!qgetenv("QTDIR").isNull()); - QProcess proc; proc.setWorkingDirectory(QString(SRCDIR) + "/task71021"); proc.start("moc", QStringList("../Header")); @@ -643,7 +639,7 @@ void tst_Moc::inputFileNameWithDotsButNoExtension() QStringList args; args << "-c" << "-x" << "c++" << "-I" << ".." - << "-I" << qgetenv("QTDIR") + "/include" << "-o" << "/dev/null" << "-"; + << "-I" << qtIncludePath << "-o" << "/dev/null" << "-"; proc.start("gcc", args); QVERIFY(proc.waitForStarted()); proc.write(mocOut); @@ -691,22 +687,14 @@ void tst_Moc::supportConstSignals() void tst_Moc::task87883() { -#if QT_VERSION >= 0x040101 QVERIFY(Task87883::staticMetaObject.className()); -#else - QSKIP("Fixed in >= 4.1.1", SkipAll); -#endif } #include "c-comments.h" void tst_Moc::multilineComments() { -#if QT_VERSION >= 0x040101 QVERIFY(IfdefedClass::staticMetaObject.className()); -#else - QSKIP("Fixed in >= 4.1.1", SkipAll); -#endif } void tst_Moc::classinfoWithEscapes() @@ -848,10 +836,11 @@ void tst_Moc::warnOnMultipleInheritance() QSKIP("Not tested when cross-compiled", SkipAll); #endif #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - QVERIFY(!qgetenv("QTDIR").isNull()); - QProcess proc; - proc.start("moc", QStringList(srcify("warn-on-multiple-qobject-subclasses.h"))); + QStringList args; + args << "-I" << qtIncludePath + "/QtGui" + << srcify("warn-on-multiple-qobject-subclasses.h"); + proc.start("moc", args); QVERIFY(proc.waitForFinished()); QCOMPARE(proc.exitCode(), 0); QByteArray mocOut = proc.readAllStandardOutput(); @@ -870,17 +859,18 @@ void tst_Moc::forgottenQInterface() QSKIP("Not tested when cross-compiled", SkipAll); #endif #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - QVERIFY(!qgetenv("QTDIR").isNull()); - QProcess proc; - proc.start("moc", QStringList(srcify("forgotten-qinterface.h"))); + QStringList args; + args << "-I" << qtIncludePath + "/QtCore" + << srcify("forgotten-qinterface.h"); + proc.start("moc", args); QVERIFY(proc.waitForFinished()); QCOMPARE(proc.exitCode(), 0); QByteArray mocOut = proc.readAllStandardOutput(); QVERIFY(!mocOut.isEmpty()); QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError()); QCOMPARE(mocWarning, QString(SRCDIR) + - QString("/forgotten-qinterface.h:53: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n")); + QString("/forgotten-qinterface.h:55: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n")); #else QSKIP("Only tested on linux/gcc", SkipAll); #endif @@ -951,8 +941,6 @@ void tst_Moc::frameworkSearchPath() QSKIP("Not tested when cross-compiled", SkipAll); #endif #if defined(Q_OS_UNIX) - QVERIFY(!qgetenv("QTDIR").isNull()); - QStringList args; args << "-F" << srcify(".") << srcify("interface-from-framework.h") @@ -991,8 +979,6 @@ void tst_Moc::templateGtGt() QSKIP("Not tested when cross-compiled", SkipAll); #endif #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - QVERIFY(!qgetenv("QTDIR").isNull()); - QProcess proc; proc.start("moc", QStringList(srcify("template-gtgt.h"))); QVERIFY(proc.waitForFinished()); @@ -1009,8 +995,6 @@ void tst_Moc::templateGtGt() void tst_Moc::defineMacroViaCmdline() { #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - QVERIFY(!qgetenv("QTDIR").isNull()); - QProcess proc; QStringList args; @@ -1099,8 +1083,6 @@ void tst_Moc::warnOnPropertyWithoutREAD() QSKIP("Not tested when cross-compiled", SkipAll); #endif #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - QVERIFY(!qgetenv("QTDIR").isNull()); - QProcess proc; proc.start("moc", QStringList(srcify("warn-on-property-without-read.h"))); QVERIFY(proc.waitForFinished()); diff --git a/tests/auto/q3accel/tst_q3accel.cpp b/tests/auto/q3accel/tst_q3accel.cpp index c2ba9dd..7b1c8ae 100644 --- a/tests/auto/q3accel/tst_q3accel.cpp +++ b/tests/auto/q3accel/tst_q3accel.cpp @@ -142,10 +142,8 @@ void tst_Q3Accel::initTestCase() edit->setObjectName("test_edit"); connect( accel1, SIGNAL(activated(int)), this, SLOT(accelTrig1()) ); connect( accel2, SIGNAL(activated(int)), this, SLOT(accelTrig2()) ); -#if QT_VERSION >= 0x30100 connect( accel1, SIGNAL(activatedAmbiguously(int)), this, SLOT(ambig1()) ); connect( accel2, SIGNAL(activatedAmbiguously(int)), this, SLOT(ambig2()) ); -#endif mainW->setCentralWidget( edit ); connect( mainW->statusBar(), SIGNAL(messageChanged(const QString&)), this, SLOT(statusMessage(const QString&)) ); @@ -160,11 +158,9 @@ int tst_Q3Accel::toButtons( int key ) result |= Qt::ShiftModifier; if ( key & Qt::CTRL ) result |= Qt::ControlModifier; -#if QT_VERSION >= 0x30100 - if ( key & Qt::META ) + if ( key & Qt::META ) result |= Qt::MetaModifier; -#endif - if ( key & Qt::ALT ) + if ( key & Qt::ALT ) result |= Qt::AltModifier; return result; } @@ -185,7 +181,6 @@ void tst_Q3Accel::defElements() QTest::addColumn<int>("theResult"); } -#if QT_VERSION >= 0x30100 void tst_Q3Accel::number() { testElement(); @@ -369,34 +364,17 @@ void tst_Q3Accel::number_data() int(Qt::Key_Aring) UNICODE_ACCEL + int(Qt::Key_K) */ - /* The #ifdefs for Qt4 are there, because accelerators are always case insensitive in Qt4. - It was not wise to differentiate between ASCII (where accelerators where case insensitive) and all other - unicode chars in 3.x. - */ QTest::newRow( "N06 - sA1" ) << int(SetupAccel) << int(Accel1) << QString("") << int(Qt::Key_aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(NoResult); -#if QT_VERSION < 0x040000 - QTest::newRow( "N07 - sA2" ) << int(SetupAccel) << int(Accel2) << QString("") - << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(NoResult); -#endif QTest::newRow( "N08 - sA2" ) << int(SetupAccel) << int(Accel1) << QString("") << int(Qt::UNICODE_ACCEL) + int(Qt::Key_K) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(NoResult); QTest::newRow( "N:int(Qt::Key_aring)" ) << int(TestAccel) << int(NoWidget) << QString("") << int(Qt::Key_aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel1Triggered); -#if QT_VERSION < 0x040000 - QTest::newRow( "N:int(Qt::Key_Aring)" ) << int(TestAccel) << int(NoWidget) << QString("") - << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel2Triggered); -#endif QTest::newRow( "N:int(Qt::Key_aring) - Text Form" ) << int(TestAccel) << int(NoWidget) << QString("") << int(Qt::Key_unknown) << 0xE5 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel1Triggered); -#if QT_VERSION < 0x040000 - QTest::newRow( "N:int(Qt::Key_Aring) - Text Form" ) << int(TestAccel) << int(NoWidget) << QString("") - << int(Qt::Key_unknown) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel2Triggered); -#else QTest::newRow( "N:int(Qt::Key_Aring) - Text Form" ) << int(TestAccel) << int(NoWidget) << QString("") << int(Qt::Key_unknown) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel1Triggered); -#endif QTest::newRow( "N:UNICODE_ACCEL + int(Qt::Key_K)" ) << int(TestAccel) << int(NoWidget) << QString("") << int(Qt::UNICODE_ACCEL) + int(Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel1Triggered); @@ -615,28 +593,15 @@ void tst_Q3Accel::text_data() /* see comments above on the #ifdef'ery */ QTest::newRow( "T06 - sA1" ) << int(SetupAccel) << int(Accel1) << QString("\x0E5") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(NoResult); -#if QT_VERSION < 0x040000 - QTest::newRow( "T07 - sA2" ) << int(SetupAccel) << int(Accel2) << QString("\x0C5") - << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(NoResult); -#endif QTest::newRow( "T08 - sA2" ) << int(SetupAccel) << int(Accel1) << QString("K") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(NoResult); QTest::newRow( "T:int(Qt::Key_aring)" ) << int(TestAccel) << int(NoWidget) << QString("") << int(Qt::Key_aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel1Triggered); -#if QT_VERSION < 0x040000 - QTest::newRow( "T:int(Qt::Key_Aring)" ) << int(TestAccel) << int(NoWidget) << QString("") - << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel2Triggered); -#endif QTest::newRow( "T:int(Qt::Key_aring) - Text Form" ) << int(TestAccel) << int(NoWidget) << QString("") << int(Qt::Key_unknown) << 0xE5 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel1Triggered); -#if QT_VERSION < 0x040000 - QTest::newRow( "T:int(Qt::Key_Aring) - Text Form" ) << int(TestAccel) << int(NoWidget) << QString("") - << int(Qt::Key_unknown) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel2Triggered); -#else QTest::newRow( "T:int(Qt::Key_Aring) - Text Form" ) << int(TestAccel) << int(NoWidget) << QString("") << int(Qt::Key_unknown) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel1Triggered); -#endif QTest::newRow( "T:UNICODE_ACCEL + int(Qt::Key_K)" ) << int(TestAccel) << int(NoWidget) << QString("") << int(Qt::UNICODE_ACCEL) + int(Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << int(Accel1Triggered); @@ -986,11 +951,7 @@ void tst_Q3Accel::sendKeyEvents( int k1, QChar c1, int k2, QChar c2, int k3, QCh k2 &= ~Qt::MODIFIER_MASK; k3 &= ~Qt::MODIFIER_MASK; k4 &= ~Qt::MODIFIER_MASK; -#if QT_VERSION < 0x040000 - QKeyEvent ke( QEvent::Accel, k1, k1, b1, QString(c1) ); -#else QKeyEvent ke( QEvent::Accel, k1, (Qt::KeyboardModifiers)b1, QString(c1) ); -#endif QApplication::sendEvent( mainW, &ke ); if ( k2 ) { QKeyEvent ke( QEvent::Accel, k2, k2, b2, QString(c2) ); @@ -1006,48 +967,5 @@ void tst_Q3Accel::sendKeyEvents( int k1, QChar c1, int k2, QChar c2, int k3, QCh } } -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- - -#else // For Qt < 3.1 -void tst_Q3Accel::number_data() -{ - QTest::addColumn<int>("bogus"); - QTest::newRow( "b01" ) << 0; -} - -void tst_Q3Accel::number() -{ - QSKIP( "Accel test for Qt < 3.1 not implemented", SkipAll); -} - -void tst_Q3Accel::text_data() -{ - QTest::addColumn<int>("bogus"); - QTest::newRow( "b02" ) << 0; -} - -void tst_Q3Accel::text() -{ - QSKIP( "Accel test for Qt < 3.1 not implemented", SkipAll); -} -void tst_Q3Accel::disabledItems() -{ - QSKIP( "Accel test for Qt < 3.1 not implemented", SkipAll); -} -void tst_Q3Accel::ambiguousItems() -{ - QSKIP( "Amibguous signals non-existant in Qt < 3.1", SkipAll); -} -void tst_Q3Accel::unicodeCompare() -{ - QSKIP( "Accel test for Qt < 3.1 not implemented", SkipAll); -} -void tst_Q3Accel::unicodeCompose() -{ - QSKIP( "Unicode composing non-existant in Qt < 3.1", SkipAll); -} -#endif // QT_VERSION >= 0x30100 - QTEST_MAIN(tst_Q3Accel) #include "tst_q3accel.moc" diff --git a/tests/auto/q3cstring/tst_q3cstring.cpp b/tests/auto/q3cstring/tst_q3cstring.cpp index f9bdf6b..60a66a9 100644 --- a/tests/auto/q3cstring/tst_q3cstring.cpp +++ b/tests/auto/q3cstring/tst_q3cstring.cpp @@ -69,8 +69,6 @@ private slots: void replace_uint_uint(); void replace_string_data(); void replace_string(); - void replace_regexp_data(); - void replace_regexp(); void remove_uint_uint_data(); void remove_uint_uint(); void prepend(); @@ -132,11 +130,6 @@ void tst_Q3CString::remove_string_data() replace_string_data(); } -void tst_Q3CString::remove_regexp_data() -{ - replace_regexp_data(); -} - void tst_Q3CString::length_data() { QTest::addColumn<Q3CString>("s1"); @@ -202,9 +195,6 @@ void tst_Q3CString::replace_string_data() QTest::newRow( "rem13" ) << Q3CString("") << Q3CString("A") << Q3CString(0) << Q3CString(""); QTest::newRow( "rem14" ) << Q3CString(0) << Q3CString("A") << Q3CString("") << Q3CString(0); QTest::newRow( "rem15" ) << Q3CString(0) << Q3CString("A") << Q3CString(0) << Q3CString(0); -#if QT_VERSION < 0x040000 - QTest::newRow( "rem16" ) << Q3CString(0) << Q3CString("") << Q3CString("A") << Q3CString(0); -#endif QTest::newRow( "rem17" ) << Q3CString(0) << Q3CString("") << Q3CString("") << Q3CString(0); // ### how should the one below behave in Q3CString???? // QTest::newRow( "rem18" ) << Q3CString("") << Q3CString(0) << Q3CString("A") << Q3CString("A"); @@ -216,7 +206,7 @@ void tst_Q3CString::replace_string_data() QTest::newRow( "rep03" ) << Q3CString("") << Q3CString("") << Q3CString("X") << Q3CString("X"); } -void tst_Q3CString::replace_regexp_data() +void tst_Q3CString::remove_regexp_data() { QTest::addColumn<Q3CString>("string"); QTest::addColumn<Q3CString>("regexp"); @@ -224,20 +214,16 @@ void tst_Q3CString::replace_regexp_data() QTest::addColumn<Q3CString>("result"); QTest::newRow( "rem00" ) << Q3CString("alpha") << Q3CString("a+") << Q3CString("") << Q3CString("lph"); -#if QT_VERSION >= 0x030100 QTest::newRow( "rem01" ) << Q3CString("banana") << Q3CString("^.a") << Q3CString("") << Q3CString("nana"); -#endif QTest::newRow( "rem02" ) << Q3CString("") << Q3CString("^.a") << Q3CString("") << Q3CString(""); QTest::newRow( "rem03" ) << Q3CString("") << Q3CString("^.a") << Q3CString(0) << Q3CString(""); QTest::newRow( "rem04" ) << Q3CString(0) << Q3CString("^.a") << Q3CString("") << Q3CString(0); QTest::newRow( "rem05" ) << Q3CString(0) << Q3CString("^.a") << Q3CString(0) << Q3CString(0); -#if QT_VERSION >= 0x030100 QTest::newRow( "rep00" ) << Q3CString("A <i>bon mot</i>.") << Q3CString("<i>([^<]*)</i>") << Q3CString("\\emph{\\1}") << Q3CString("A \\emph{bon mot}."); QTest::newRow( "rep01" ) << Q3CString("banana") << Q3CString("^.a()") << Q3CString("\\1") << Q3CString("nana"); QTest::newRow( "rep02" ) << Q3CString("banana") << Q3CString("(ba)") << Q3CString("\\1X\\1") << Q3CString("baXbanana"); QTest::newRow( "rep03" ) << Q3CString("banana") << Q3CString("(ba)(na)na") << Q3CString("\\2X\\1") << Q3CString("naXba"); -#endif } void tst_Q3CString::length() @@ -364,11 +350,7 @@ void tst_Q3CString::acc_01() QCOMPARE('X'+a,(Q3CString)"XABC"); a = (const char*)0; QVERIFY(a.isNull()); -#if QT_VERSION < 0x040000 - QVERIFY((const char*)a==0); -#else QVERIFY(*((const char *)a) == 0); -#endif { QFile f("COMPARE.txt"); @@ -420,11 +402,7 @@ void tst_Q3CString::constructor() QCOMPARE(a,ca); QVERIFY(a.isNull()); -#if QT_VERSION < 0x040000 - QVERIFY(a != (Q3CString)""); -#else QVERIFY(a == Q3CString("")); -#endif QCOMPARE(b,cb); QCOMPARE(c,cc); QCOMPARE(d,(Q3CString)"String D"); @@ -509,18 +487,6 @@ void tst_Q3CString::find() //QCOMPARE(a.find('G',-1),14); // -ve does what? Parameter should be uint? //QCOMPARE(a.find('G',-2),11); // -ve does what? Parameter should be uint? QCOMPARE(a.find('f'),10); -#if QT_VERSION < 0x040000 - // case sensitive find has been removed in 4.0 - QCOMPARE(a.find('f',0,FALSE),5); - QCOMPARE(a.find('g',0,TRUE),-1); - QCOMPARE(a.find("fgh",0,FALSE),5); - QCOMPARE(a.find("fgh",0,TRUE),-1); - QCOMPARE(a.find("EFG",5,TRUE),12); - QCOMPARE(a.find("EFG",5,FALSE),9); - QCOMPARE(a.find("EFG",4,TRUE),4); - QCOMPARE(a.find("EfG",4,FALSE),4); - QCOMPARE(a.find("EfG",4,TRUE),9); -#endif // QCOMPARE(a.find("efg",-1,FALSE),12); // -ve does what? Parameter should be uint? // QCOMPARE(a.find("efg",-2,FALSE),12); // -ve does what? Parameter should be uint? // QCOMPARE(a.find("efg",-3,FALSE),12); // -ve does what? Parameter should be uint? @@ -544,14 +510,6 @@ void tst_Q3CString::findRev() QCOMPARE(a.findRev('B'),1); QCOMPARE(a.findRev('B',1),1); QCOMPARE(a.findRev('B',0),-1); -#if QT_VERSION < 0x040000 - QCOMPARE(a.findRev("efg",99,FALSE),-1); -// QCOMPARE(a.findRev("efg",15,FALSE),-1); - QCOMPARE(a.findRev("efg",16,FALSE),-1); - QCOMPARE(a.findRev("efg",14,FALSE),12); - QCOMPARE(a.findRev("efg",12,FALSE),12); - QCOMPARE(a.findRev("efg",11,FALSE),9); -#endif // QCOMPARE(a.findRev(QRegExp("[EFG][EFG]"),14),13); // QCOMPARE(a.findRev(QRegExp("[EFG][EFG]"),11),11); } @@ -560,15 +518,6 @@ void tst_Q3CString::contains() { Q3CString a; a="ABCDEFGHIEfGEFG"; // 15 chars -#if QT_VERSION < 0x040000 - QCOMPARE(a.contains('A'),1); - QCOMPARE(a.contains('Z'),0); - QCOMPARE(a.contains('E'),3); - QCOMPARE(a.contains('F'),2); - QCOMPARE(a.contains('F',FALSE),3); - QCOMPARE(a.contains("FG"),2); - QCOMPARE(a.contains("FG",FALSE),3); -#else QVERIFY(a.contains('A')); QVERIFY(!a.contains('Z')); QVERIFY(a.contains('E')); @@ -579,7 +528,6 @@ void tst_Q3CString::contains() QCOMPARE(a.count('E'),3); QCOMPARE(a.count('F'),2); QCOMPARE(a.count("FG"),2); -#endif // QCOMPARE(a.contains(QRegExp("[FG][HI]")),1); // QCOMPARE(a.contains(QRegExp("[G][HE]")),2); } @@ -771,7 +719,6 @@ void tst_Q3CString::replace_uint_uint() void tst_Q3CString::replace_string() { -#if QT_VERSION >= 0x030100 QFETCH( Q3CString, string ); QFETCH( Q3CString, before ); QFETCH( Q3CString, after ); @@ -788,37 +735,6 @@ void tst_Q3CString::replace_string() Q3CString s3 = string; s3.replace( before, after ); QCOMPARE( s3, result ); - -#if QT_VERSION < 0x040000 - if ( !string.isNull() ) { - /* - I've changed the isNull() behavior in QString::replace() in - Qt 3.2, according to the philosophy that null and empty - should behave mostly the same. - */ - Q3CString s4 = string; - s4.replace( QRegExp(QRegExp::escape(before)), after ); - QVERIFY( s4 == result ); - } -#endif -#else - QSKIP( "Not tested with Qt versions < 3.1", SkipAll); -#endif -} - -void tst_Q3CString::replace_regexp() -{ -#if QT_VERSION >= 0x040000 - QSKIP("This functionality has been removed in Qt 4.", SkipAll); -#else - QFETCH( Q3CString, string ); - QFETCH( Q3CString, regexp ); - QFETCH( Q3CString, after ); - QFETCH( Q3CString, result ); - - string.replace( QRegExp(regexp), after ); - QVERIFY( string == result ); -#endif } void tst_Q3CString::remove_uint_uint() diff --git a/tests/auto/q3header/tst_q3header.cpp b/tests/auto/q3header/tst_q3header.cpp index f0ad9d4..fe290e8 100644 --- a/tests/auto/q3header/tst_q3header.cpp +++ b/tests/auto/q3header/tst_q3header.cpp @@ -59,9 +59,7 @@ public slots: void cleanupTestCase(); private slots: void bug_setOffset(); -#if QT_VERSION >= 0x040101 void nullStringLabel(); -#endif private: Q3Header *testW; @@ -108,7 +106,6 @@ void tst_Q3Header::bug_setOffset() QCOMPARE( testW->offset(), offs ); } -#if QT_VERSION >= 0x040101 // Task 95640 void tst_Q3Header::nullStringLabel() { @@ -123,7 +120,6 @@ void tst_Q3Header::nullStringLabel() QCOMPARE(testW->label(testW->addLabel(QString())), QString()); QCOMPARE(testW->label(testW->addLabel(QString(""))), QString("")); } -#endif QTEST_MAIN(tst_Q3Header) #include "tst_q3header.moc" diff --git a/tests/auto/q3ptrlist/tst_q3ptrlist.cpp b/tests/auto/q3ptrlist/tst_q3ptrlist.cpp index 49b5a3e..c3d8b16 100644 --- a/tests/auto/q3ptrlist/tst_q3ptrlist.cpp +++ b/tests/auto/q3ptrlist/tst_q3ptrlist.cpp @@ -92,7 +92,6 @@ void tst_Q3PtrList::cleanup() void tst_Q3PtrList::replace() { -#if QT_VERSION >= 0x030100 Q3PtrList<int> list; int foo = 4; list.setAutoDelete( TRUE ); @@ -110,15 +109,10 @@ void tst_Q3PtrList::replace() int *p = new int(7); QCOMPARE( list.insert(2, p), (bool)TRUE ); QCOMPARE( list.replace(2, p), (bool)TRUE ); - -#else - QSKIP( "Not tested with Qt versions < 3.1", SkipAll); -#endif } void tst_Q3PtrList::replaceStrDeep() { -#if QT_VERSION >= 0x030100 Q3StrList list; const char *str; @@ -137,14 +131,10 @@ void tst_Q3PtrList::replaceStrDeep() QCOMPARE( list.insert(2, str), (bool)TRUE ); QCOMPARE( list.replace(2, str), (bool)TRUE ); -#else - QSKIP( "Not tested with Qt versions < 3.1", SkipAll); -#endif } void tst_Q3PtrList::replaceStrShallow() { -#if QT_VERSION >= 0x030100 Q3StrList list( FALSE ); char str1[] = "This is string 1"; char str2[] = "This is string 2"; @@ -166,9 +156,6 @@ void tst_Q3PtrList::replaceStrShallow() QCOMPARE( list.insert(2, str), (bool)TRUE ); QCOMPARE( list.replace(2, str), (bool)TRUE ); -#else - QSKIP( "Not tested with Qt versions < 3.1", SkipAll); -#endif } void tst_Q3PtrList::take() diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index 2f88367..2d91186 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -89,7 +89,7 @@ private slots: void unicode(); void precision_data() { generic_data(); } void precision(); - void insertORA_data(); + void insertORA_data() { generic_data("QOCI"); } void insertORA(); void batchInsert_data() { generic_data(); } void batchInsert(); @@ -101,7 +101,7 @@ private slots: void insertFieldNameContainsWS(); // For task 117996 private: - void generic_data(); + void generic_data(const QString &engine=QString()); void createTestTables( QSqlDatabase db ); void dropTestTables( QSqlDatabase db ); void populateTestTables( QSqlDatabase db ); @@ -117,10 +117,14 @@ tst_Q3SqlCursor::~tst_Q3SqlCursor() { } -void tst_Q3SqlCursor::generic_data() +void tst_Q3SqlCursor::generic_data(const QString &engine) { - if ( dbs.fillTestTable() == 0 ) - QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + if ( dbs.fillTestTable(engine) == 0 ) { + if(engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); + } } void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) @@ -297,9 +301,9 @@ void tst_Q3SqlCursor::insert() // check that primeInsert returns a valid QSqlRecord QCOMPARE( (int)irec->count(), 4 ); if ( ( irec->field( 0 ).type() != QVariant::Int ) && - ( irec->field( 0 ).type() != QVariant::Double ) ) { + ( irec->field( 0 ).type() != QVariant::String ) ) { QFAIL( QString( "Wrong datatype %1 for field 'ID'" - " (expected Int or Double)" ).arg( QVariant::typeToName( irec->field( 0 ).type() ) ) ); + " (expected Int or String)" ).arg( QVariant::typeToName( irec->field( 0 ).type() ) ) ); } QCOMPARE( QVariant::typeToName( irec->field( 1 ).type() ), QVariant::typeToName( QVariant::String ) ); QCOMPARE( QVariant::typeToName( irec->field( 2 ).type() ), QVariant::typeToName( QVariant::String ) ); @@ -429,12 +433,6 @@ static QString dumpUtf8( const QString& str ) return res; } -void tst_Q3SqlCursor::insertORA_data() -{ - if ( dbs.fillTestTable( "QOCI" ) == 0 ) - QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll ); -} - void tst_Q3SqlCursor::insertORA() { QFETCH( QString, dbName ); diff --git a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp index a8c5940..9ab74f0 100644 --- a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp +++ b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp @@ -76,7 +76,7 @@ private slots: void _exec(); private: - void generic_data(); + void generic_data(const QString &engine=QString()); void createTestTables( QSqlDatabase db ); void dropTestTables( QSqlDatabase db ); void populateTestTables( QSqlDatabase db ); @@ -92,10 +92,14 @@ tst_Q3SqlSelectCursor::~tst_Q3SqlSelectCursor() { } -void tst_Q3SqlSelectCursor::generic_data() +void tst_Q3SqlSelectCursor::generic_data(const QString& engine) { - if ( dbs.fillTestTable() == 0 ) - QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + if ( dbs.fillTestTable(engine) == 0 ) { + if(engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); + } } void tst_Q3SqlSelectCursor::createTestTables( QSqlDatabase db ) diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp index 2fab3eb..7db0a40 100644 --- a/tests/auto/q3table/tst_q3table.cpp +++ b/tests/auto/q3table/tst_q3table.cpp @@ -387,7 +387,6 @@ public: void tst_Q3Table::selectComboTableItem() { -// #if QT_VERSION >= 0x030100 #if 0 MyTable table(4,4,0,"subclassTestWidget"); // Test for task #25026 diff --git a/tests/auto/q3textedit/tst_q3textedit.cpp b/tests/auto/q3textedit/tst_q3textedit.cpp index 21bc8b5..1fcce7b 100644 --- a/tests/auto/q3textedit/tst_q3textedit.cpp +++ b/tests/auto/q3textedit/tst_q3textedit.cpp @@ -159,12 +159,10 @@ void tst_Q3TextEdit::getSetCheck() Q3TextDocument *var2 = new Q3TextDocument(0); obj1.setDocument(var2); QCOMPARE(obj1.document(), var2); -#if QT_VERSION >= 0x040200 // Should've done as QTextEdit, and created a new document, if you setDocument(0). // Unfortunately it doesn't, and we cannot change it. obj1.setDocument((Q3TextDocument *)0); QCOMPARE(obj1.document(), var2); -#endif // delete var2; // No delete, since Q3TextEdit takes ownership } diff --git a/tests/auto/q3textstream/tst_q3textstream.cpp b/tests/auto/q3textstream/tst_q3textstream.cpp index 7932b79..b13e83f 100644 --- a/tests/auto/q3textstream/tst_q3textstream.cpp +++ b/tests/auto/q3textstream/tst_q3textstream.cpp @@ -346,9 +346,6 @@ void tst_Q3TextStream::operator_shiftleft() QFETCH( QString, device ); QFETCH( QString, encoding ); QFETCH( QByteArray, encoded ); -#if QT_VERSION < 0x040000 - encoded.resize( encoded.size() - 1 ); -#endif if ( device == "file" ) { QFile outFile( "qtextstream.out" ); @@ -400,9 +397,6 @@ void tst_Q3TextStream::operator_shiftright() QFETCH( int, intVal ); QFETCH( QString, stringVal ); QFETCH( QByteArray, encoded ); -#if QT_VERSION < 0x040000 - encoded.resize( encoded.size() - 1 ); -#endif if ( device == "file" ) { QFile outFile( "qtextstream.out" ); @@ -1295,7 +1289,6 @@ void tst_Q3TextStream::write_Q3CString( Q3TextStream *s ) void tst_Q3TextStream::task28319() { /* -#if QT_VERSION >= 0x040000 // Specific test for task 28319 QFile f("28319.txt"); if (f.open(IO_WriteOnly)) { @@ -1324,9 +1317,6 @@ void tst_Q3TextStream::task28319() } else { QVERIFY(FALSE); } -#else - QSKIP( "A minor bug we don't want to fix in 3.2.", SkipAll); -#endif */ } diff --git a/tests/auto/q3timeedit/tst_q3timeedit.cpp b/tests/auto/q3timeedit/tst_q3timeedit.cpp index 967bb51..1cdd87c 100644 --- a/tests/auto/q3timeedit/tst_q3timeedit.cpp +++ b/tests/auto/q3timeedit/tst_q3timeedit.cpp @@ -130,10 +130,8 @@ void tst_Q3TimeEdit::init() QTime maximumTime(23, 59, 59); testWidget->setMinValue(minimumTime); testWidget->setMaxValue(maximumTime); -#if QT_VERSION >= 0x030100 // We don't want the locale impacting on the test testWidget->setDisplay(Q3TimeEdit::Hours | Q3TimeEdit::Minutes | Q3TimeEdit::Seconds); -#endif testWidget->setTime(QTime(11, 0, 0)); // make sure we start with the hour focused @@ -174,10 +172,8 @@ void tst_Q3TimeEdit::valueRange() QTime maximumTime(maximumHours, maximumMinutes, maximumSeconds); testWidget->setMinValue(minimumTime); testWidget->setMaxValue(maximumTime); -#if QT_VERSION >= 0x030100 // We don't want the locale impacting on the test testWidget->setDisplay(Q3TimeEdit::Hours | Q3TimeEdit::Minutes | Q3TimeEdit::Seconds); -#endif // When pressing Key_Up we want to check it goes to the minimum time testWidget->setTime(maximumTime); diff --git a/tests/auto/q3valuelist/tst_q3valuelist.cpp b/tests/auto/q3valuelist/tst_q3valuelist.cpp index 8abeee2..b10664a 100644 --- a/tests/auto/q3valuelist/tst_q3valuelist.cpp +++ b/tests/auto/q3valuelist/tst_q3valuelist.cpp @@ -296,7 +296,6 @@ void tst_Q3ValueList::beginEnd() QCOMPARE( *(cit1), 2 ); QCOMPARE( *(cit2), 200 ); -#if (QT_VERSION >= 0x030200) Q3ValueList<int> b; b.append( 1 ); Q3ValueList<int> b2 = b; @@ -305,7 +304,6 @@ void tst_Q3ValueList::beginEnd() b2.append( 2 ); QVERIFY( b.constBegin() != b2.constBegin() ); QVERIFY( b2.constBegin() == b2.constBegin() ); -#endif } void tst_Q3ValueList::pushing() @@ -593,11 +591,7 @@ void tst_Q3ValueList::opStreamOut() class ListVerifier : public Q3ValueList<int> { public: -#if QT_VERSION < 0x040000 - void* pointer() { return sh; } -#else const int* pointer() const { return &*begin(); } -#endif }; void tst_Q3ValueList::shared() { diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp index b613b81..c0ffea0 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -346,14 +346,11 @@ void tst_QAbstractItemModel::match() QCOMPARE(res.count(), 2); res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegExp | Qt::MatchCaseSensitive); QCOMPARE(res.count(), 0); - // MatchFixedString seems new in 4.2 -#if QT_VERSION >= 0x040200 res = model.match(start, Qt::DisplayRole, QVariant("BOAR"), -1, Qt::MatchFixedString); QCOMPARE(res.count(), 1); res = model.match(start, Qt::DisplayRole, QVariant("bat"), -1, Qt::MatchFixedString | Qt::MatchCaseSensitive); QCOMPARE(res.count(), 1); -#endif } typedef QPair<int, int> Position; @@ -582,7 +579,6 @@ void tst_QAbstractItemModel::dropMimeData_data() << (qStringTableRow("" , "" , "A")) << (qStringTableRow("" , "" , "B"))); } -#if QT_VERSION >= 0x040200 { QTest::newRow("2x 1x2 dropped at [3, 2] (different rows)") << (STRINGTABLE // source table @@ -624,7 +620,6 @@ void tst_QAbstractItemModel::dropMimeData_data() << (qStringTableRow("" , "" , "B")) << (qStringTableRow("" , "" , "H"))); } -#endif } void tst_QAbstractItemModel::dropMimeData() diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index 3337a49..3a845e1 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -53,6 +53,8 @@ #include <qspinbox.h> #include <qitemdelegate.h> #include <qpushbutton.h> +#include <qscrollbar.h> +#include <qboxlayout.h> #include "../../shared/util.h" //TESTED_CLASS= @@ -209,6 +211,7 @@ private slots: void setCurrentIndex(); void task221955_selectedEditor(); + void task250754_fontChange(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -231,11 +234,8 @@ void tst_QAbstractItemView::getSetCheck() MyAbstractItemDelegate *var1 = new MyAbstractItemDelegate; obj1->setItemDelegate(var1); QCOMPARE((QAbstractItemDelegate*)var1, obj1->itemDelegate()); -#if QT_VERSION >= 0x040200 - // Itemviews in Qt < 4.2 have asserts for this. Qt >= 4.2 should handle this gracefully obj1->setItemDelegate((QAbstractItemDelegate *)0); QCOMPARE((QAbstractItemDelegate *)0, obj1->itemDelegate()); -#endif delete var1; // EditTriggers QAbstractItemView::editTriggers() @@ -276,26 +276,6 @@ void tst_QAbstractItemView::getSetCheck() obj1->setAlternatingRowColors(true); QCOMPARE(true, obj1->alternatingRowColors()); -#if QT_VERSION < 0x040200 - // int QAbstractItemView::horizontalStepsPerItem() - // void QAbstractItemView::setHorizontalStepsPerItem(int) - obj1->tst_setHorizontalStepsPerItem(0); - QCOMPARE(0, obj1->tst_horizontalStepsPerItem()); - obj1->tst_setHorizontalStepsPerItem(INT_MIN); - QCOMPARE(INT_MIN, obj1->tst_horizontalStepsPerItem()); - obj1->tst_setHorizontalStepsPerItem(INT_MAX); - QCOMPARE(INT_MAX, obj1->tst_horizontalStepsPerItem()); - - // int QAbstractItemView::verticalStepsPerItem() - // void QAbstractItemView::setVerticalStepsPerItem(int) - obj1->tst_setVerticalStepsPerItem(0); - QCOMPARE(0, obj1->tst_verticalStepsPerItem()); - obj1->tst_setVerticalStepsPerItem(INT_MIN); - QCOMPARE(INT_MIN, obj1->tst_verticalStepsPerItem()); - obj1->tst_setVerticalStepsPerItem(INT_MAX); - QCOMPARE(INT_MAX, obj1->tst_verticalStepsPerItem()); -#endif - // State QAbstractItemView::state() // void QAbstractItemView::setState(State) obj1->tst_setState(TestView::tst_State(TestView::NoState)); @@ -311,13 +291,11 @@ void tst_QAbstractItemView::getSetCheck() obj1->tst_setState(TestView::tst_State(TestView::CollapsingState)); QCOMPARE(TestView::tst_State(TestView::CollapsingState), obj1->tst_state()); -#if QT_VERSION >= 0x040200 // QWidget QAbstractScrollArea::viewport() // void setViewport(QWidget*) QWidget *vp = new QWidget; obj1->setViewport(vp); QCOMPARE(vp, obj1->viewport()); -#endif QCOMPARE(16, obj1->autoScrollMargin()); obj1->setAutoScrollMargin(20); @@ -1179,8 +1157,46 @@ void tst_QAbstractItemView::task221955_selectedEditor() button->setFocus(); QTest::qWait(50); QVERIFY(tree.selectionModel()->selectedIndexes().isEmpty()); +} + +void tst_QAbstractItemView::task250754_fontChange() +{ + QString app_css = qApp->styleSheet(); + qApp->setStyleSheet("/* */"); + + QWidget w; + QTreeView tree(&w); + QVBoxLayout *vLayout = new QVBoxLayout(&w); + vLayout->addWidget(&tree); + + QStandardItemModel *m = new QStandardItemModel(this); + for (int i=0; i<5; ++i) { + QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i)); + for (int j=0; j<5; ++j) { + QStandardItem *child = new QStandardItem(QString("Child Item number %1").arg(j)); + item->setChild(j, 0, child); + } + m->setItem(i, 0, item); + } + tree.setModel(m); + + w.show(); + w.resize(150,150); + QTest::qWait(30); + QFont font = tree.font(); + font.setPointSize(5); + tree.setFont(font); + QTest::qWait(30); + + QVERIFY(!tree.verticalScrollBar()->isVisible()); + + font.setPointSize(45); + tree.setFont(font); + QTest::qWait(30); + //now with the huge items, the scrollbar must be visible + QVERIFY(tree.verticalScrollBar()->isVisible()); - + qApp->setStyleSheet(app_css); } QTEST_MAIN(tst_QAbstractItemView) diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp index 9e3acb8..dc1c866 100644 --- a/tests/auto/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp @@ -864,11 +864,7 @@ void tst_QAbstractSlider::wheelEvent() QVERIFY(applicationInstance->sendEvent(slider,&event)); QCOMPARE(slider->sliderPosition(),expectedSliderPosition); int expectedSignalCount = (initialSliderPosition == expectedSliderPosition) ? 0 : 1; -#if QT_VERSION >= 0x040200 QCOMPARE(spy1.count(), expectedSignalCount); -#else - QCOMPARE(spy1.count(), 0); -#endif QCOMPARE(spy2.count(), expectedSignalCount); if (expectedSignalCount) QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp); diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index d023557..dc52416 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -218,8 +218,6 @@ public: tst_QAccessibility(); virtual ~tst_QAccessibility(); - - public slots: void initTestCase(); void cleanupTestCase(); @@ -275,6 +273,7 @@ private slots: void accessibleName(); void treeWidgetTest(); void labelTest(); + void accelerators(); private: QWidget *createGUI(); @@ -408,15 +407,15 @@ public: QtTestAccessibleWidgetIface(QtTestAccessibleWidget *w): QAccessibleWidget(w) {} QString text(Text t, int control) const { - if (t == Help) - return QString::fromLatin1("Help yourself"); - return QAccessibleWidget::text(t, control); + if (t == Help) + return QString::fromLatin1("Help yourself"); + return QAccessibleWidget::text(t, control); } static QAccessibleInterface *ifaceFactory(const QString &key, QObject *o) { - if (key == "QtTestAccessibleWidget") - return new QtTestAccessibleWidgetIface(static_cast<QtTestAccessibleWidget*>(o)); - return 0; + if (key == "QtTestAccessibleWidget") + return new QtTestAccessibleWidgetIface(static_cast<QtTestAccessibleWidget*>(o)); + return 0; } }; #endif @@ -454,15 +453,15 @@ void tst_QAccessibility::cleanup() #ifdef QTEST_ACCESSIBILITY const EventList list = QTestAccessibility::events(); if (!list.isEmpty()) { - qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(), - QString(QTest::currentTestFunction()).toAscii().constData()); - for (int i = 0; i < list.count(); ++i) - qWarning(" %d: Object: %p Event: '%s' (%d) Child: %d", i + 1, list.at(i).object, - eventName(list.at(i).event).toAscii().constData(), list.at(i).event, list.at(i).child); + qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(), + QString(QTest::currentTestFunction()).toAscii().constData()); + for (int i = 0; i < list.count(); ++i) + qWarning(" %d: Object: %p Event: '%s' (%d) Child: %d", i + 1, list.at(i).object, + eventName(list.at(i).event).toAscii().constData(), list.at(i).event, list.at(i).child); } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -485,7 +484,7 @@ void tst_QAccessibility::eventTest() delete button; #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -504,7 +503,7 @@ void tst_QAccessibility::customWidget() delete iface; delete widget; #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -522,7 +521,7 @@ void tst_QAccessibility::deletedWidget() QVERIFY(!iface->isValid()); delete iface; #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -541,52 +540,52 @@ QWidget *tst_QAccessibility::createGUI() topLeft->setSpacing(2); grid->addWidget(topLeft, 0, 0); - Q3VButtonGroup *group1 = new Q3VButtonGroup("Title1:", topLeft, "group1"); - /*QPushButton *pb1 = */ new QPushButton("Button&1", group1, "pb1"); - Q3VButtonGroup *group2 = new Q3VButtonGroup("Title2:", topLeft, "group2"); - /*QPushButton *pb2 = */ new QPushButton("Button2", group2, "pb2"); + Q3VButtonGroup *group1 = new Q3VButtonGroup("Title1:", topLeft, "group1"); + /*QPushButton *pb1 = */ new QPushButton("Button&1", group1, "pb1"); + Q3VButtonGroup *group2 = new Q3VButtonGroup("Title2:", topLeft, "group2"); + /*QPushButton *pb2 = */ new QPushButton("Button2", group2, "pb2"); - Q3WidgetStack *stack = new Q3WidgetStack(topLeft, "stack"); - QLabel *page1 = new QLabel("Page 1", stack, "page1"); - stack->addWidget(page1); - QLabel *page2 = new QLabel("Page 2", stack, "page2"); - stack->addWidget(page2); - QLabel *page3 = new QLabel("Page 3", stack, "page3"); - stack->addWidget(page3); + Q3WidgetStack *stack = new Q3WidgetStack(topLeft, "stack"); + QLabel *page1 = new QLabel("Page 1", stack, "page1"); + stack->addWidget(page1); + QLabel *page2 = new QLabel("Page 2", stack, "page2"); + stack->addWidget(page2); + QLabel *page3 = new QLabel("Page 3", stack, "page3"); + stack->addWidget(page3); // topRight - controlling Q3VBox *topRight= new Q3VBox(toplevel, "topRight"); grid->addWidget(topRight, 0, 1); - QPushButton *pbOk = new QPushButton("Ok", topRight, "pbOk" ); - pbOk->setDefault(TRUE); - QSlider *slider = new QSlider(Qt::Horizontal, topRight, "slider"); - QLCDNumber *sliderLcd = new QLCDNumber(topRight, "sliderLcd"); - QSpinBox *spinBox = new QSpinBox(topRight, "spinBox"); + QPushButton *pbOk = new QPushButton("Ok", topRight, "pbOk" ); + pbOk->setDefault(TRUE); + QSlider *slider = new QSlider(Qt::Horizontal, topRight, "slider"); + QLCDNumber *sliderLcd = new QLCDNumber(topRight, "sliderLcd"); + QSpinBox *spinBox = new QSpinBox(topRight, "spinBox"); - connect(pbOk, SIGNAL(clicked()), toplevel, SLOT(close()) ); - connect(slider, SIGNAL(valueChanged(int)), sliderLcd, SLOT(display(int))); - connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int))); + connect(pbOk, SIGNAL(clicked()), toplevel, SLOT(close()) ); + connect(slider, SIGNAL(valueChanged(int)), sliderLcd, SLOT(display(int))); + connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int))); - spinBox->setValue(50); + spinBox->setValue(50); // bottomLeft - labeling and controlling Q3HBox *bottomLeft = new Q3HBox(toplevel, "bottomLeft"); grid->addWidget(bottomLeft, 1, 0); - QLabel *label = new QLabel("This is a &lineedit:", bottomLeft, "label"); - QLineEdit *lineedit = new QLineEdit(bottomLeft, "lineedit"); - label->setBuddy(lineedit); - QLabel *label2 = new QLabel(bottomLeft, "label2"); + QLabel *label = new QLabel("This is a &lineedit:", bottomLeft, "label"); + QLineEdit *lineedit = new QLineEdit(bottomLeft, "lineedit"); + label->setBuddy(lineedit); + QLabel *label2 = new QLabel(bottomLeft, "label2"); - connect(lineedit, SIGNAL(textChanged(const QString&)), label2, SLOT(setText(const QString&))); + connect(lineedit, SIGNAL(textChanged(const QString&)), label2, SLOT(setText(const QString&))); - Q3VButtonGroup *radiogroup = new Q3VButtonGroup("Exclusive &choices:", bottomLeft, "radiogroup"); - QLineEdit *frequency = new QLineEdit(radiogroup, "frequency"); - frequency->setText("100 Mhz"); - QRadioButton *radioAM = new QRadioButton("&AM", radiogroup, "radioAM"); - /* QRadioButton *radioFM = */ new QRadioButton("&FM", radiogroup, "radioFM"); - /* QRadioButton *radioSW = */ new QRadioButton("&Shortwave", radiogroup, "radioSW"); + Q3VButtonGroup *radiogroup = new Q3VButtonGroup("Exclusive &choices:", bottomLeft, "radiogroup"); + QLineEdit *frequency = new QLineEdit(radiogroup, "frequency"); + frequency->setText("100 Mhz"); + QRadioButton *radioAM = new QRadioButton("&AM", radiogroup, "radioAM"); + /* QRadioButton *radioFM = */ new QRadioButton("&FM", radiogroup, "radioFM"); + /* QRadioButton *radioSW = */ new QRadioButton("&Shortwave", radiogroup, "radioSW"); // bottomRight - ### empty Q3HBox *bottomRight = new Q3HBox(toplevel, "bottomRight"); @@ -625,23 +624,23 @@ void tst_QAccessibility::childAt() QObjectList children = toplevel->queryList("QWidget", 0, 0, 0); for (int c = 1; c <= children.count(); ++c) { - QWidget *child = qobject_cast<QWidget*>(children.at(c-1)); - QAccessibleInterface *acc_child = QAccessible::queryAccessibleInterface(child); - QVERIFY(acc_child); - QCOMPARE(acc_child->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, QAccessible::Child); - - QPoint center(child->mapToGlobal(child->rect().center())); - QRect childRect(child->geometry()); - childRect.moveCenter(center); - - QCOMPARE(acc_child->rect(0), childRect); - QCOMPARE(acc_toplevel->childAt(childRect.center().x(), childRect.center().y()), c); - QCOMPARE(acc_toplevel->childAt(childRect.left(), childRect.top()), c); - QCOMPARE(acc_toplevel->childAt(childRect.left(), childRect.bottom()), c); - QCOMPARE(acc_toplevel->childAt(childRect.right(), childRect.top()), c); - QCOMPARE(acc_toplevel->childAt(childRect.right(), childRect.bottom()), c); - - QCOMPARE(acc_toplevel->indexOfChild(acc_child), c); + QWidget *child = qobject_cast<QWidget*>(children.at(c-1)); + QAccessibleInterface *acc_child = QAccessible::queryAccessibleInterface(child); + QVERIFY(acc_child); + QCOMPARE(acc_child->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, QAccessible::Child); + + QPoint center(child->mapToGlobal(child->rect().center())); + QRect childRect(child->geometry()); + childRect.moveCenter(center); + + QCOMPARE(acc_child->rect(0), childRect); + QCOMPARE(acc_toplevel->childAt(childRect.center().x(), childRect.center().y()), c); + QCOMPARE(acc_toplevel->childAt(childRect.left(), childRect.top()), c); + QCOMPARE(acc_toplevel->childAt(childRect.left(), childRect.bottom()), c); + QCOMPARE(acc_toplevel->childAt(childRect.right(), childRect.top()), c); + QCOMPARE(acc_toplevel->childAt(childRect.right(), childRect.bottom()), c); + + QCOMPARE(acc_toplevel->indexOfChild(acc_child), c); delete acc_child; } @@ -649,7 +648,7 @@ void tst_QAccessibility::childAt() delete toplevel; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif // !QT3_SUPPORT } @@ -693,7 +692,7 @@ void tst_QAccessibility::childCount() delete toplevel; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif // !QT3_SUPPORT } @@ -715,33 +714,33 @@ void tst_QAccessibility::relationTo() QAccessibleInterface *acc_toplevel = QAccessible::queryAccessibleInterface(toplevel); - QAccessibleInterface *acc_topLeft = QAccessible::queryAccessibleInterface(topLeft); - QAccessibleInterface *acc_group1 = QAccessible::queryAccessibleInterface(topLeft->child("group1")); - QVERIFY(topLeft->child("group1")); - QAccessibleInterface *acc_pb1 = QAccessible::queryAccessibleInterface(topLeft->child("group1")->child("pb1")); - QAccessibleInterface *acc_group2 = QAccessible::queryAccessibleInterface(topLeft->child("group2")); - QAccessibleInterface *acc_pb2 = 0; - QAccessibleInterface *acc_stack = QAccessible::queryAccessibleInterface(topLeft->child("stack")); - QAccessibleInterface *acc_page1 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page1")); - QAccessibleInterface *acc_page2 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page2")); - QAccessibleInterface *acc_page3 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page3")); - QAccessibleInterface *acc_topRight = QAccessible::queryAccessibleInterface(topRight); - QAccessibleInterface *acc_pbOk = QAccessible::queryAccessibleInterface(topRight->child("pbOk")); - QAccessibleInterface *acc_slider = QAccessible::queryAccessibleInterface(topRight->child("slider")); - QAccessibleInterface *acc_spinBox = QAccessible::queryAccessibleInterface(topRight->child("spinBox")); - QAccessibleInterface *acc_sliderLcd = QAccessible::queryAccessibleInterface(topRight->child("sliderLcd")); - - QAccessibleInterface *acc_bottomLeft = QAccessible::queryAccessibleInterface(bottomLeft); - QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(bottomLeft->child("label")); - QAccessibleInterface *acc_lineedit = QAccessible::queryAccessibleInterface(bottomLeft->child("lineedit")); - QAccessibleInterface *acc_label2 = QAccessible::queryAccessibleInterface(bottomLeft->child("label2")); - QAccessibleInterface *acc_radiogroup = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")); - QAccessibleInterface *acc_radioAM = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioAM")); - QAccessibleInterface *acc_radioFM = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioFM")); - QAccessibleInterface *acc_radioSW = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioSW")); - QAccessibleInterface *acc_frequency = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("frequency")); - - QAccessibleInterface *acc_bottomRight = QAccessible::queryAccessibleInterface(bottomRight); + QAccessibleInterface *acc_topLeft = QAccessible::queryAccessibleInterface(topLeft); + QAccessibleInterface *acc_group1 = QAccessible::queryAccessibleInterface(topLeft->child("group1")); + QVERIFY(topLeft->child("group1")); + QAccessibleInterface *acc_pb1 = QAccessible::queryAccessibleInterface(topLeft->child("group1")->child("pb1")); + QAccessibleInterface *acc_group2 = QAccessible::queryAccessibleInterface(topLeft->child("group2")); + QAccessibleInterface *acc_pb2 = 0; + QAccessibleInterface *acc_stack = QAccessible::queryAccessibleInterface(topLeft->child("stack")); + QAccessibleInterface *acc_page1 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page1")); + QAccessibleInterface *acc_page2 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page2")); + QAccessibleInterface *acc_page3 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page3")); + QAccessibleInterface *acc_topRight = QAccessible::queryAccessibleInterface(topRight); + QAccessibleInterface *acc_pbOk = QAccessible::queryAccessibleInterface(topRight->child("pbOk")); + QAccessibleInterface *acc_slider = QAccessible::queryAccessibleInterface(topRight->child("slider")); + QAccessibleInterface *acc_spinBox = QAccessible::queryAccessibleInterface(topRight->child("spinBox")); + QAccessibleInterface *acc_sliderLcd = QAccessible::queryAccessibleInterface(topRight->child("sliderLcd")); + + QAccessibleInterface *acc_bottomLeft = QAccessible::queryAccessibleInterface(bottomLeft); + QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(bottomLeft->child("label")); + QAccessibleInterface *acc_lineedit = QAccessible::queryAccessibleInterface(bottomLeft->child("lineedit")); + QAccessibleInterface *acc_label2 = QAccessible::queryAccessibleInterface(bottomLeft->child("label2")); + QAccessibleInterface *acc_radiogroup = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")); + QAccessibleInterface *acc_radioAM = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioAM")); + QAccessibleInterface *acc_radioFM = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioFM")); + QAccessibleInterface *acc_radioSW = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioSW")); + QAccessibleInterface *acc_frequency = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("frequency")); + + QAccessibleInterface *acc_bottomRight = QAccessible::queryAccessibleInterface(bottomRight); QVERIFY(acc_toplevel); QVERIFY(acc_topLeft); @@ -768,49 +767,49 @@ void tst_QAccessibility::relationTo() // hierachy relations QCOMPARE(acc_toplevel->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Self); + QAccessible::Self); QCOMPARE(acc_toplevel->relationTo(1, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Child); + QAccessible::Child); QCOMPARE(acc_toplevel->relationTo(0, acc_toplevel, 1) & QAccessible::HierarchyMask, - QAccessible::Ancestor); + QAccessible::Ancestor); QCOMPARE(acc_toplevel->relationTo(0, acc_topLeft, 0) & QAccessible::HierarchyMask, - QAccessible::Ancestor); + QAccessible::Ancestor); QCOMPARE(acc_toplevel->relationTo(0, acc_topRight, 0) & QAccessible::HierarchyMask, - QAccessible::Ancestor); + QAccessible::Ancestor); QCOMPARE(acc_toplevel->relationTo(0, acc_bottomLeft, 0) & QAccessible::HierarchyMask, - QAccessible::Ancestor); + QAccessible::Ancestor); QCOMPARE(acc_toplevel->relationTo(0, acc_bottomRight, 0) & QAccessible::HierarchyMask, - QAccessible::Ancestor); + QAccessible::Ancestor); QCOMPARE(acc_toplevel->relationTo(0, acc_group1, 0) & QAccessible::HierarchyMask, - QAccessible::Ancestor); + QAccessible::Ancestor); QCOMPARE(acc_toplevel->relationTo(0, acc_page1, 0) & QAccessible::HierarchyMask, - QAccessible::Ancestor); + QAccessible::Ancestor); QCOMPARE(acc_group1->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Descendent); + QAccessible::Descendent); QCOMPARE(acc_stack->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Descendent); + QAccessible::Descendent); QCOMPARE(acc_page1->relationTo(0, acc_stack, 0) & QAccessible::HierarchyMask, - QAccessible::Child); + QAccessible::Child); QCOMPARE(acc_page1->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Descendent); + QAccessible::Descendent); QCOMPARE(acc_topLeft->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Child); + QAccessible::Child); QCOMPARE(acc_topRight->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Child); + QAccessible::Child); QCOMPARE(acc_bottomLeft->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Child); + QAccessible::Child); QCOMPARE(acc_bottomRight->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, - QAccessible::Child); + QAccessible::Child); QCOMPARE(acc_topLeft->relationTo(0, acc_topRight, 0) & QAccessible::HierarchyMask, - QAccessible::Sibling); + QAccessible::Sibling); QCOMPARE(acc_topLeft->relationTo(0, acc_bottomLeft, 0) & QAccessible::HierarchyMask, - QAccessible::Sibling); + QAccessible::Sibling); QCOMPARE(acc_topLeft->relationTo(0, acc_bottomRight, 0) & QAccessible::HierarchyMask, - QAccessible::Sibling); + QAccessible::Sibling); QCOMPARE(acc_pb1->relationTo(0, acc_pb2, 0), QAccessible::Unrelated); @@ -835,25 +834,25 @@ void tst_QAccessibility::relationTo() // logical relations - focus QCOMPARE(acc_radioAM->relationTo(0, acc_radioFM, 0) & QAccessible::FocusChild, - QAccessible::Unrelated); + QAccessible::Unrelated); QCOMPARE(acc_radioAM->relationTo(0, acc_radiogroup, 0) & QAccessible::FocusChild, - QAccessible::FocusChild); + QAccessible::FocusChild); QCOMPARE(acc_radioAM->relationTo(0, acc_bottomLeft, 0) & QAccessible::FocusChild, - QAccessible::FocusChild); + QAccessible::FocusChild); QCOMPARE(acc_radioAM->relationTo(0, acc_topLeft, 0) & QAccessible::FocusChild, - QAccessible::Unrelated); + QAccessible::Unrelated); QCOMPARE(acc_radioAM->relationTo(0, acc_toplevel, 0) & QAccessible::FocusChild, - QAccessible::FocusChild); + QAccessible::FocusChild); // logical relations - labels QCOMPARE(acc_label->relationTo(0, acc_lineedit, 0) & QAccessible::LogicalMask, - QAccessible::Label); + QAccessible::Label); QCOMPARE(acc_lineedit->relationTo(0, acc_label, 0) & QAccessible::LogicalMask, - QAccessible::Labelled); + QAccessible::Labelled); QCOMPARE(acc_label->relationTo(0, acc_radiogroup, 0) & QAccessible::LogicalMask, - QAccessible::Unrelated); + QAccessible::Unrelated); QCOMPARE(acc_lineedit->relationTo(0, acc_lineedit, 0) & QAccessible::LogicalMask, - QAccessible::Unrelated); + QAccessible::Unrelated); QEXPECT_FAIL("", "Make me accessible", Continue); QCOMPARE(acc_radiogroup->relationTo(0, acc_radioAM, 0) & QAccessible::LogicalMask, @@ -865,21 +864,21 @@ void tst_QAccessibility::relationTo() QCOMPARE(acc_radiogroup->relationTo(0, acc_radioSW, 0) & QAccessible::LogicalMask, QAccessible::Label | QAccessible::Controlled); QCOMPARE(acc_radiogroup->relationTo(0, acc_frequency, 0) & QAccessible::LogicalMask, - QAccessible::Label); + QAccessible::Label); QCOMPARE(acc_frequency->relationTo(0, acc_radiogroup, 0) & QAccessible::LogicalMask, - QAccessible::Labelled); + QAccessible::Labelled); QCOMPARE(acc_radiogroup->relationTo(0, acc_lineedit, 0) & QAccessible::LogicalMask, - QAccessible::Unrelated); + QAccessible::Unrelated); // logical relations - controller QCOMPARE(acc_pbOk->relationTo(0, acc_toplevel, 0) & QAccessible::LogicalMask, - QAccessible::Controller); + QAccessible::Controller); QCOMPARE(acc_slider->relationTo(0, acc_sliderLcd, 0) & QAccessible::LogicalMask, - QAccessible::Controller); + QAccessible::Controller); QCOMPARE(acc_spinBox->relationTo(0, acc_slider, 0) & QAccessible::LogicalMask, - QAccessible::Controller); + QAccessible::Controller); QCOMPARE(acc_lineedit->relationTo(0, acc_label2, 0) & QAccessible::LogicalMask, - QAccessible::Controller); + QAccessible::Controller); delete acc_toplevel; delete acc_topLeft; @@ -910,7 +909,7 @@ void tst_QAccessibility::relationTo() QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif // !QT3_SUPPORT } @@ -933,8 +932,8 @@ void tst_QAccessibility::navigateGeometric() QtTestAccessibleWidget *aw = 0; int i; for (i = 0; i < 360; i += skip) { - aw = new QtTestAccessibleWidget(w, QString::number(i).toLatin1()); - aw->move( int(200.0 + 100.0 * sin(step * (double)i)), int(200.0 + 100.0 * cos(step * (double)i)) ); + aw = new QtTestAccessibleWidget(w, QString::number(i).toLatin1()); + aw->move( int(200.0 + 100.0 * sin(step * (double)i)), int(200.0 + 100.0 * cos(step * (double)i)) ); } aw = new QtTestAccessibleWidget(w, "Earth"); @@ -949,25 +948,24 @@ void tst_QAccessibility::navigateGeometric() QTest::qWait(100); #endif - // let one widget rotate around center for (i = 0; i < 360; i+=skip) { - aw->move( int(200.0 + 75.0 * sin(step * (double)i)), int(200.0 + 75.0 * cos(step * (double)i)) ); - - if (i < 45 || i > 315) { - QCOMPARE(iface->navigate(QAccessible::Down, 0, &target), 0); - } else if ( i < 135 ) { - QCOMPARE(iface->navigate(QAccessible::Right, 0, &target), 0); - } else if ( i < 225 ) { - QCOMPARE(iface->navigate(QAccessible::Up, 0, &target), 0); - } else { - QCOMPARE(iface->navigate(QAccessible::Left, 0, &target), 0); + aw->move( int(200.0 + 75.0 * sin(step * (double)i)), int(200.0 + 75.0 * cos(step * (double)i)) ); + + if (i < 45 || i > 315) { + QCOMPARE(iface->navigate(QAccessible::Down, 0, &target), 0); + } else if ( i < 135 ) { + QCOMPARE(iface->navigate(QAccessible::Right, 0, &target), 0); + } else if ( i < 225 ) { + QCOMPARE(iface->navigate(QAccessible::Up, 0, &target), 0); + } else { + QCOMPARE(iface->navigate(QAccessible::Left, 0, &target), 0); } - QVERIFY(target); - QVERIFY(target->isValid()); - QVERIFY(target->object()); - QCOMPARE(target->object()->objectName(), aw->objectName()); + QVERIFY(target); + QVERIFY(target->isValid()); + QVERIFY(target->object()); + QCOMPARE(target->object()->objectName(), aw->objectName()); delete target; target = 0; } @@ -1015,7 +1013,7 @@ void tst_QAccessibility::navigateGeometric() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -1049,7 +1047,7 @@ void tst_QAccessibility::navigateSlider() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -1091,43 +1089,43 @@ void tst_QAccessibility::navigateCovered() QVERIFY(iface3 == 0); for (int loop = 0; loop < 2; ++loop) { - for (int x = 0; x < w->width(); ++x) { - for (int y = 0; y < w->height(); ++y) { - w1->move(x, y); - if (w1->geometry().intersects(w2->geometry())) { - QVERIFY(iface1->relationTo(0, iface2, 0) & QAccessible::Covers); - QVERIFY(iface2->relationTo(0, iface1, 0) & QAccessible::Covered); - QCOMPARE(iface1->navigate(QAccessible::Covered, 1, &iface3), 0); - QVERIFY(iface3 != 0); - QVERIFY(iface3->isValid()); - QCOMPARE(iface3->object(), iface2->object()); + for (int x = 0; x < w->width(); ++x) { + for (int y = 0; y < w->height(); ++y) { + w1->move(x, y); + if (w1->geometry().intersects(w2->geometry())) { + QVERIFY(iface1->relationTo(0, iface2, 0) & QAccessible::Covers); + QVERIFY(iface2->relationTo(0, iface1, 0) & QAccessible::Covered); + QCOMPARE(iface1->navigate(QAccessible::Covered, 1, &iface3), 0); + QVERIFY(iface3 != 0); + QVERIFY(iface3->isValid()); + QCOMPARE(iface3->object(), iface2->object()); delete iface3; iface3 = 0; - QCOMPARE(iface2->navigate(QAccessible::Covers, 1, &iface3), 0); - QVERIFY(iface3 != 0); - QVERIFY(iface3->isValid()); - QCOMPARE(iface3->object(), iface1->object()); + QCOMPARE(iface2->navigate(QAccessible::Covers, 1, &iface3), 0); + QVERIFY(iface3 != 0); + QVERIFY(iface3->isValid()); + QCOMPARE(iface3->object(), iface1->object()); delete iface3; iface3 = 0; - } else { - QVERIFY(!(iface1->relationTo(0, iface2, 0) & QAccessible::Covers)); - QVERIFY(!(iface2->relationTo(0, iface1, 0) & QAccessible::Covered)); - QCOMPARE(iface1->navigate(QAccessible::Covered, 1, &iface3), -1); - QVERIFY(iface3 == 0); - QCOMPARE(iface1->navigate(QAccessible::Covers, 1, &iface3), -1); - QVERIFY(iface3 == 0); - QCOMPARE(iface2->navigate(QAccessible::Covered, 1, &iface3), -1); - QVERIFY(iface3 == 0); - QCOMPARE(iface2->navigate(QAccessible::Covers, 1, &iface3), -1); - QVERIFY(iface3 == 0); - } - } - } - if (!loop) { - // switch children for second loop - w2->raise(); - QAccessibleInterface *temp = iface1; - iface1 = iface2; - iface2 = temp; - } + } else { + QVERIFY(!(iface1->relationTo(0, iface2, 0) & QAccessible::Covers)); + QVERIFY(!(iface2->relationTo(0, iface1, 0) & QAccessible::Covered)); + QCOMPARE(iface1->navigate(QAccessible::Covered, 1, &iface3), -1); + QVERIFY(iface3 == 0); + QCOMPARE(iface1->navigate(QAccessible::Covers, 1, &iface3), -1); + QVERIFY(iface3 == 0); + QCOMPARE(iface2->navigate(QAccessible::Covered, 1, &iface3), -1); + QVERIFY(iface3 == 0); + QCOMPARE(iface2->navigate(QAccessible::Covers, 1, &iface3), -1); + QVERIFY(iface3 == 0); + } + } + } + if (!loop) { + // switch children for second loop + w2->raise(); + QAccessibleInterface *temp = iface1; + iface1 = iface2; + iface2 = temp; + } } delete iface1; iface1 = 0; delete iface2; iface2 = 0; @@ -1159,7 +1157,7 @@ void tst_QAccessibility::navigateCovered() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -1262,7 +1260,7 @@ void tst_QAccessibility::navigateHierarchy() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -1277,11 +1275,11 @@ void tst_QAccessibility::navigateControllers() #ifdef QTEST_ACCESSIBILITY { Q3VBox vbox; - QSlider slider(&vbox); - QSpinBox spinBox(&vbox); - QLCDNumber lcd1(&vbox); - QLCDNumber lcd2(&vbox); - QLabel label(&vbox); + QSlider slider(&vbox); + QSpinBox spinBox(&vbox); + QLCDNumber lcd1(&vbox); + QLCDNumber lcd2(&vbox); + QLabel label(&vbox); vbox.show(); slider.setObjectName("slider"); @@ -1358,7 +1356,7 @@ void tst_QAccessibility::navigateControllers() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif // !QT3_SUPPORT } @@ -1373,24 +1371,24 @@ void tst_QAccessibility::navigateLabels() Q3VBox vbox; Q3HBox hbox(&vbox); - QLabel label(&hbox); + QLabel label(&hbox); label.setText("This is a lineedit:"); - QLineEdit lineedit(&hbox); + QLineEdit lineedit(&hbox); label.setBuddy(&lineedit); Q3VButtonGroup groupbox(&vbox); groupbox.setTitle("Be my children!"); QRadioButton radio(&groupbox); - QLabel label2(&groupbox); + QLabel label2(&groupbox); label2.setText("Another lineedit:"); - QLineEdit lineedit2(&groupbox); + QLineEdit lineedit2(&groupbox); label2.setBuddy(&lineedit2); Q3GroupBox groupbox2(&groupbox); groupbox2.setTitle("Some grand-children"); - QLineEdit grandchild(&groupbox2); + QLineEdit grandchild(&groupbox2); Q3GroupBox border(&vbox); - QLineEdit lineedit3(&border); + QLineEdit lineedit3(&border); vbox.show(); QTestAccessibility::clearEvents(); @@ -1491,7 +1489,7 @@ void tst_QAccessibility::navigateLabels() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif // !QT3_SUPPORT } @@ -1570,7 +1568,7 @@ void tst_QAccessibility::accessibleName() delete toplevel; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -1677,7 +1675,7 @@ void tst_QAccessibility::text() QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif // !QT3_SUPPORT } @@ -1713,7 +1711,7 @@ void tst_QAccessibility::setText() QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif //QT3_SUPPORT } @@ -1748,7 +1746,7 @@ void tst_QAccessibility::hideShowTest() delete window; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -1785,7 +1783,7 @@ void tst_QAccessibility::userActionCount() QCOMPARE(test->userActionCount(-1), 0); delete test; test = 0; #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -1810,7 +1808,7 @@ void tst_QAccessibility::actionText() delete test; test = 0; #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -1819,7 +1817,7 @@ void tst_QAccessibility::doAction() #ifdef QTEST_ACCESSIBILITY QSKIP("TODO: Implement me", SkipAll); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2006,7 +2004,7 @@ void tst_QAccessibility::buttonTest() QTestAccessibility::clearEvents(); #else -// QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); +// QSKIP("Test needs accessibility support.", SkipAll); QSKIP("No action interface in Qt 4 yet.", SkipAll); #endif } @@ -2206,7 +2204,7 @@ void tst_QAccessibility::sliderTest() QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif //!QT3_SUPPORT } @@ -2304,7 +2302,7 @@ void tst_QAccessibility::scrollBarTest() QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2348,7 +2346,7 @@ void tst_QAccessibility::tabTest() delete interface; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2536,8 +2534,6 @@ void tst_QAccessibility::menuTest() } delete iface; - - // "New" item entry = interface->navigate(QAccessible::Child, 1, &iface); QCOMPARE(entry, 0); @@ -2568,11 +2564,6 @@ void tst_QAccessibility::menuTest() delete iface; - - -#if QT_VERSION < 0x040102 - QEXPECT_FAIL("", "Submenus don't open, task 99301", Continue); -#endif // move mouse pointer away, since that might influence the // subsequent tests QTest::mouseMove(&mw, QPoint(-1, -1)); @@ -2582,9 +2573,6 @@ void tst_QAccessibility::menuTest() interface->doAction(QAccessible::DefaultAction, 1); QTestEventLoop::instance().enterLoop(2); -#if defined (Q_OS_WIN) && QT_VERSION < 0x040300 && !defined(Q_OS_WINCE) - QEXPECT_FAIL("", "Don't expect the File menu to be visible in 4.2", Continue); -#endif QVERIFY(file->isVisible()); QVERIFY(fileNew->isVisible()); QVERIFY(!edit->isVisible()); @@ -2592,8 +2580,8 @@ void tst_QAccessibility::menuTest() QTestAccessibility::clearEvents(); mw.hide(); - - + + // Do not crash if the menu don't have a parent QMenu *menu = new QMenu; menu->addAction(QLatin1String("one")); @@ -2607,7 +2595,7 @@ void tst_QAccessibility::menuTest() delete iface2; delete iface; delete menu; - + } QTestAccessibility::clearEvents(); #else @@ -2638,7 +2626,7 @@ void tst_QAccessibility::spinBoxTest() delete spinBox; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2665,7 +2653,7 @@ void tst_QAccessibility::doubleSpinBoxTest() delete doubleSpinBox; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2687,7 +2675,7 @@ void tst_QAccessibility::textEditTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2711,7 +2699,7 @@ void tst_QAccessibility::textBrowserTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2784,7 +2772,7 @@ void tst_QAccessibility::listViewTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2841,7 +2829,7 @@ void tst_QAccessibility::mdiAreaTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -2971,7 +2959,7 @@ void tst_QAccessibility::mdiSubWindowTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3036,7 +3024,7 @@ void tst_QAccessibility::lineEditTest() delete toplevel; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3097,7 +3085,7 @@ void tst_QAccessibility::workspaceTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3217,7 +3205,7 @@ void tst_QAccessibility::dialogButtonBoxTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3266,7 +3254,7 @@ void tst_QAccessibility::dialTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3280,7 +3268,7 @@ void tst_QAccessibility::rubberBandTest() delete interface; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3445,7 +3433,7 @@ void tst_QAccessibility::abstractScrollAreaTest() QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3466,7 +3454,7 @@ void tst_QAccessibility::scrollAreaTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3511,7 +3499,7 @@ void tst_QAccessibility::tableWidgetTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3629,7 +3617,7 @@ void tst_QAccessibility::tableViewTest() QCOMPARE(client->role(0), QAccessible::Client); QRect globalRect = client->rect(0); QVERIFY(globalRect.isValid()); - // make sure we don't hit the vertical header ##### + // make sure we don't hit the vertical header ##### QPoint p = globalRect.topLeft() + QPoint(8, 8); p.ry() += 50 * (y - 1); p.rx() += 100 * (x - 1); @@ -3677,7 +3665,7 @@ void tst_QAccessibility::tableViewTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3778,7 +3766,7 @@ void tst_QAccessibility::calendarWidgetTest() } QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif // QT_NO_CALENDARWIDGET } @@ -3856,7 +3844,7 @@ void tst_QAccessibility::dockWidgetTest() delete mw; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif // QT_NO_DOCKWIDGET } @@ -3902,7 +3890,7 @@ void tst_QAccessibility::pushButtonTest() delete toplevel; QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif #endif //QT3_SUPPORT } @@ -3949,7 +3937,7 @@ void tst_QAccessibility::comboBoxTest() QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -3988,13 +3976,12 @@ void tst_QAccessibility::treeWidgetTest() QCOMPARE(entry, 0); QCOMPARE(accTreeItem2->text(QAccessible::Name, 0), QLatin1String("row: 1")); - - // test selected/focused state + // test selected/focused state QItemSelectionModel *selModel = tree->selectionModel(); QVERIFY(selModel); selModel->select(QItemSelection(tree->model()->index(0, 0), tree->model()->index(3, 0)), QItemSelectionModel::Select); selModel->setCurrentIndex(tree->model()->index(1, 0), QItemSelectionModel::Current); - + for (int i = 1; i < 10 ; ++i) { QAccessible::State expected; if (i <= 5 && i >= 2) @@ -4014,10 +4001,9 @@ void tst_QAccessibility::treeWidgetTest() delete acc; delete w; - QTestAccessibility::clearEvents(); #else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); + QSKIP("Test needs accessibility support.", SkipAll); #endif } @@ -4046,6 +4032,45 @@ void tst_QAccessibility::labelTest() #endif } +void tst_QAccessibility::accelerators() +{ +#ifdef QTEST_ACCESSIBILITY + QWidget *window = new QWidget; + QHBoxLayout *lay = new QHBoxLayout(window); + QLabel *label = new QLabel(tr("&Line edit"), window); + QLineEdit *le = new QLineEdit(window); + lay->addWidget(label); + lay->addWidget(le); + label->setBuddy(le); + + window->show(); + + QAccessibleInterface *accLineEdit = QAccessible::queryAccessibleInterface(le); + QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString(QKeySequence(Qt::ALT) + QLatin1String("L"))); + label->setText(tr("Q &")); + QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); + label->setText(tr("Q &&")); + QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); + label->setText(tr("Q && A")); + QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); + label->setText(tr("Q &&&A")); + QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString(QKeySequence(Qt::ALT) + QLatin1String("A"))); + label->setText(tr("Q &&A")); + QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); + label->setText(tr("Q &A&B")); + QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString(QKeySequence(Qt::ALT) + QLatin1String("A"))); + +#if defined(Q_WS_X11) + qt_x11_wait_for_window_manager(window); +#endif + QTest::qWait(100); + delete window; + QTestAccessibility::clearEvents(); +#else + QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); +#endif +} + QTEST_MAIN(tst_QAccessibility) diff --git a/tests/auto/qalgorithms/tst_qalgorithms.cpp b/tests/auto/qalgorithms/tst_qalgorithms.cpp index 9c2fa50..423cf69 100644 --- a/tests/auto/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/qalgorithms/tst_qalgorithms.cpp @@ -574,10 +574,8 @@ void tst_QAlgorithms::test_qLowerBound() QCOMPARE(qLowerBound(data.constBegin(), data.constEnd(), resultValue), data.constBegin() + resultIndex); QCOMPARE(qLowerBound(data.begin(), data.end(), resultValue), data.begin() + resultIndex); -#if QT_VERSION >= 0x040200 QCOMPARE(qLowerBound(data, resultValue), data.constBegin() + resultIndex); QCOMPARE(qLowerBound(data.constBegin(), data.constEnd(), resultValue, qLess<int>()), data.constBegin() + resultIndex); -#endif } void tst_QAlgorithms::test_qUpperBound_data() @@ -597,10 +595,8 @@ void tst_QAlgorithms::test_qUpperBound() QCOMPARE(qUpperBound(data.constBegin(), data.constEnd(), resultValue), data.constBegin() + resultIndex); QCOMPARE(qUpperBound(data.begin(), data.end(), resultValue), data.begin() + resultIndex); -#if QT_VERSION >= 0x040200 QCOMPARE(qUpperBound(data, resultValue), data.constBegin() + resultIndex); QCOMPARE(qUpperBound(data.constBegin(), data.constEnd(), resultValue, qLess<int>()), data.constBegin() + resultIndex); -#endif } void tst_QAlgorithms::test_qBinaryFind_data() @@ -618,10 +614,8 @@ void tst_QAlgorithms::test_qBinaryFind() QCOMPARE(*qBinaryFind(data.constBegin(), data.constEnd(), resultValue), resultValue); QCOMPARE(*qBinaryFind(data.begin(), data.end(), resultValue), resultValue); -#if QT_VERSION >= 0x040200 QCOMPARE(*qBinaryFind(data, resultValue), resultValue); QCOMPARE(*qBinaryFind(data.constBegin(), data.constEnd(), resultValue, qLess<int>()), resultValue); -#endif } void tst_QAlgorithms::qBinaryFindOneEntry() @@ -802,7 +796,6 @@ void tst_QAlgorithms::stableSortCorrectnessTest() void tst_QAlgorithms::convenienceAPI() { // Compile-test for QAlgorithm convenience functions. -#if QT_VERSION >= 0x040200 QList<int> list, list2; qCopy(list.begin(), list.end(), list2.begin()); @@ -844,7 +837,6 @@ void tst_QAlgorithms::convenienceAPI() QList<int *> pointerList; qDeleteAll(pointerList); qDeleteAll(pointerList.begin(), pointerList.end()); -#endif } template <typename DataType> diff --git a/tests/auto/qbitarray/tst_qbitarray.cpp b/tests/auto/qbitarray/tst_qbitarray.cpp index bbcb087..ecdffda 100644 --- a/tests/auto/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/qbitarray/tst_qbitarray.cpp @@ -212,10 +212,8 @@ void tst_QBitArray::countBits() } QCOMPARE(bits.count(), numBits); -#if QT_VERSION >= 0x040100 QCOMPARE(bits.count(true), onBits); QCOMPARE(bits.count(false), numBits - onBits); -#endif } void tst_QBitArray::countBits2() @@ -314,7 +312,7 @@ void tst_QBitArray::toggleBit_data() } void tst_QBitArray::toggleBit() -{ +{ QFETCH(int,index); QFETCH(QBitArray, input); QFETCH(QBitArray, res); @@ -322,7 +320,6 @@ void tst_QBitArray::toggleBit() input.toggleBit(index); QCOMPARE(input, res); - } void tst_QBitArray::operator_andeq_data() @@ -331,33 +328,33 @@ void tst_QBitArray::operator_andeq_data() QTest::addColumn<QBitArray>("input2"); QTest::addColumn<QBitArray>("res"); - QTest::newRow( "data0" ) << QStringToQBitArray(QString("11111111")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow( "data0" ) << QStringToQBitArray(QString("11111111")) + << QStringToQBitArray(QString("00101100")) << QStringToQBitArray(QString("00101100")); - QTest::newRow( "data1" ) << QStringToQBitArray(QString("11011011")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow( "data1" ) << QStringToQBitArray(QString("11011011")) + << QStringToQBitArray(QString("00101100")) << QStringToQBitArray(QString("00001000")); - QTest::newRow( "data2" ) << QStringToQBitArray(QString("11011011111")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow( "data2" ) << QStringToQBitArray(QString("11011011111")) + << QStringToQBitArray(QString("00101100")) << QStringToQBitArray(QString("00001000000")); - QTest::newRow( "data3" ) << QStringToQBitArray(QString("11011011")) - << QStringToQBitArray(QString("00101100111")) + QTest::newRow( "data3" ) << QStringToQBitArray(QString("11011011")) + << QStringToQBitArray(QString("00101100111")) << QStringToQBitArray(QString("00001000000")); - QTest::newRow( "data4" ) << QStringToQBitArray(QString()) - << QStringToQBitArray(QString("00101100111")) + QTest::newRow( "data4" ) << QStringToQBitArray(QString()) + << QStringToQBitArray(QString("00101100111")) << QStringToQBitArray(QString("00000000000")); - QTest::newRow( "data5" ) << QStringToQBitArray(QString("00101100111")) - << QStringToQBitArray(QString()) + QTest::newRow( "data5" ) << QStringToQBitArray(QString("00101100111")) + << QStringToQBitArray(QString()) << QStringToQBitArray(QString("00000000000")); - QTest::newRow( "data6" ) << QStringToQBitArray(QString()) - << QStringToQBitArray(QString()) + QTest::newRow( "data6" ) << QStringToQBitArray(QString()) + << QStringToQBitArray(QString()) << QStringToQBitArray(QString()); } @@ -370,7 +367,6 @@ void tst_QBitArray::operator_andeq() input1&=input2; QCOMPARE(input1, res); - } void tst_QBitArray::operator_oreq_data() @@ -379,37 +375,37 @@ void tst_QBitArray::operator_oreq_data() QTest::addColumn<QBitArray>("input2"); QTest::addColumn<QBitArray>("res"); - QTest::newRow( "data0" ) << QStringToQBitArray(QString("11111111")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow( "data0" ) << QStringToQBitArray(QString("11111111")) + << QStringToQBitArray(QString("00101100")) << QStringToQBitArray(QString("11111111")); - QTest::newRow( "data1" ) << QStringToQBitArray(QString("11011011")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow( "data1" ) << QStringToQBitArray(QString("11011011")) + << QStringToQBitArray(QString("00101100")) << QStringToQBitArray(QString("11111111")); - QTest::newRow( "data2" ) << QStringToQBitArray(QString("01000010")) - << QStringToQBitArray(QString("10100001")) + QTest::newRow( "data2" ) << QStringToQBitArray(QString("01000010")) + << QStringToQBitArray(QString("10100001")) << QStringToQBitArray(QString("11100011")); - QTest::newRow( "data3" ) << QStringToQBitArray(QString("11011011")) - << QStringToQBitArray(QString("00101100000")) + QTest::newRow( "data3" ) << QStringToQBitArray(QString("11011011")) + << QStringToQBitArray(QString("00101100000")) << QStringToQBitArray(QString("11111111000")); - QTest::newRow( "data4" ) << QStringToQBitArray(QString("11011011111")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow( "data4" ) << QStringToQBitArray(QString("11011011111")) + << QStringToQBitArray(QString("00101100")) << QStringToQBitArray(QString("11111111111")); - QTest::newRow( "data5" ) << QStringToQBitArray(QString()) - << QStringToQBitArray(QString("00101100111")) + QTest::newRow( "data5" ) << QStringToQBitArray(QString()) + << QStringToQBitArray(QString("00101100111")) << QStringToQBitArray(QString("00101100111")); - QTest::newRow( "data6" ) << QStringToQBitArray(QString("00101100111")) - << QStringToQBitArray(QString()) + QTest::newRow( "data6" ) << QStringToQBitArray(QString("00101100111")) + << QStringToQBitArray(QString()) << QStringToQBitArray(QString("00101100111")); - - QTest::newRow( "data7" ) << QStringToQBitArray(QString()) - << QStringToQBitArray(QString()) + + QTest::newRow( "data7" ) << QStringToQBitArray(QString()) + << QStringToQBitArray(QString()) << QStringToQBitArray(QString()); } @@ -422,7 +418,6 @@ void tst_QBitArray::operator_oreq() input1|=input2; QCOMPARE(input1, res); - } void tst_QBitArray::operator_xoreq_data() @@ -430,36 +425,36 @@ void tst_QBitArray::operator_xoreq_data() QTest::addColumn<QBitArray>("input1"); QTest::addColumn<QBitArray>("input2"); QTest::addColumn<QBitArray>("res"); - QTest::newRow( "data0" ) << QStringToQBitArray(QString("11111111")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow( "data0" ) << QStringToQBitArray(QString("11111111")) + << QStringToQBitArray(QString("00101100")) << QStringToQBitArray(QString("11010011")); - QTest::newRow( "data1" ) << QStringToQBitArray(QString("11011011")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow( "data1" ) << QStringToQBitArray(QString("11011011")) + << QStringToQBitArray(QString("00101100")) << QStringToQBitArray(QString("11110111")); - QTest::newRow( "data2" ) << QStringToQBitArray(QString("01000010")) - << QStringToQBitArray(QString("10100001")) + QTest::newRow( "data2" ) << QStringToQBitArray(QString("01000010")) + << QStringToQBitArray(QString("10100001")) << QStringToQBitArray(QString("11100011")); - QTest::newRow( "data3" ) << QStringToQBitArray(QString("01000010")) - << QStringToQBitArray(QString("10100001101")) + QTest::newRow( "data3" ) << QStringToQBitArray(QString("01000010")) + << QStringToQBitArray(QString("10100001101")) << QStringToQBitArray(QString("11100011101")); - QTest::newRow( "data4" ) << QStringToQBitArray(QString("01000010111")) - << QStringToQBitArray(QString("101000011")) + QTest::newRow( "data4" ) << QStringToQBitArray(QString("01000010111")) + << QStringToQBitArray(QString("101000011")) << QStringToQBitArray(QString("11100011011")); - QTest::newRow( "data5" ) << QStringToQBitArray(QString()) - << QStringToQBitArray(QString("00101100111")) + QTest::newRow( "data5" ) << QStringToQBitArray(QString()) + << QStringToQBitArray(QString("00101100111")) << QStringToQBitArray(QString("00101100111")); - QTest::newRow( "data6" ) << QStringToQBitArray(QString("00101100111")) - << QStringToQBitArray(QString()) + QTest::newRow( "data6" ) << QStringToQBitArray(QString("00101100111")) + << QStringToQBitArray(QString()) << QStringToQBitArray(QString("00101100111")); - - QTest::newRow( "data7" ) << QStringToQBitArray(QString()) - << QStringToQBitArray(QString()) + + QTest::newRow( "data7" ) << QStringToQBitArray(QString()) + << QStringToQBitArray(QString()) << QStringToQBitArray(QString()); } @@ -472,7 +467,6 @@ void tst_QBitArray::operator_xoreq() input1^=input2; QCOMPARE(input1, res); - } @@ -481,37 +475,37 @@ void tst_QBitArray::operator_neg_data() QTest::addColumn<QBitArray>("input"); QTest::addColumn<QBitArray>("res"); - QTest::newRow( "data0" ) << QStringToQBitArray(QString("11111111")) + QTest::newRow( "data0" ) << QStringToQBitArray(QString("11111111")) << QStringToQBitArray(QString("00000000")); - QTest::newRow( "data1" ) << QStringToQBitArray(QString("11011011")) + QTest::newRow( "data1" ) << QStringToQBitArray(QString("11011011")) << QStringToQBitArray(QString("00100100")); - QTest::newRow( "data2" ) << QStringToQBitArray(QString("00000000")) + QTest::newRow( "data2" ) << QStringToQBitArray(QString("00000000")) << QStringToQBitArray(QString("11111111")); - QTest::newRow( "data3" ) << QStringToQBitArray(QString()) + QTest::newRow( "data3" ) << QStringToQBitArray(QString()) << QStringToQBitArray(QString()); - QTest::newRow( "data4" ) << QStringToQBitArray("1") + QTest::newRow( "data4" ) << QStringToQBitArray("1") << QStringToQBitArray("0"); - QTest::newRow( "data5" ) << QStringToQBitArray("0") + QTest::newRow( "data5" ) << QStringToQBitArray("0") << QStringToQBitArray("1"); - QTest::newRow( "data6" ) << QStringToQBitArray("01") + QTest::newRow( "data6" ) << QStringToQBitArray("01") << QStringToQBitArray("10"); - QTest::newRow( "data7" ) << QStringToQBitArray("1110101") + QTest::newRow( "data7" ) << QStringToQBitArray("1110101") << QStringToQBitArray("0001010"); - QTest::newRow( "data8" ) << QStringToQBitArray("01110101") + QTest::newRow( "data8" ) << QStringToQBitArray("01110101") << QStringToQBitArray("10001010"); - QTest::newRow( "data9" ) << QStringToQBitArray("011101010") + QTest::newRow( "data9" ) << QStringToQBitArray("011101010") << QStringToQBitArray("100010101"); - QTest::newRow( "data10" ) << QStringToQBitArray("0111010101111010") + QTest::newRow( "data10" ) << QStringToQBitArray("0111010101111010") << QStringToQBitArray("1000101010000101"); } @@ -521,9 +515,8 @@ void tst_QBitArray::operator_neg() QFETCH(QBitArray, res); input = ~input; - - QCOMPARE(input, res); + QCOMPARE(input, res); } void tst_QBitArray::datastream_data() @@ -554,7 +547,7 @@ void tst_QBitArray::datastream() QFETCH(QString, bitField); QFETCH(int, numBits); QFETCH(int, onBits); - + QBuffer buffer; QVERIFY(buffer.open(QBuffer::ReadWrite)); QDataStream stream(&buffer); @@ -566,11 +559,9 @@ void tst_QBitArray::datastream() } QCOMPARE(bits.count(), numBits); -#if QT_VERSION >= 0x040100 QCOMPARE(bits.count(true), onBits); QCOMPARE(bits.count(false), numBits - onBits); -#endif - + stream << bits << bits << bits; buffer.close(); @@ -583,10 +574,8 @@ void tst_QBitArray::datastream() stream2 >> array1 >> array2 >> array3; QCOMPARE(array1.count(), numBits); -#if QT_VERSION >= 0x040100 QCOMPARE(array1.count(true), onBits); QCOMPARE(array1.count(false), numBits - onBits); -#endif QCOMPARE(array1, bits); QCOMPARE(array2, bits); @@ -595,7 +584,7 @@ void tst_QBitArray::datastream() void tst_QBitArray::invertOnNull() const { - QBitArray a; + QBitArray a; QCOMPARE(a = ~a, QBitArray()); } @@ -605,28 +594,28 @@ void tst_QBitArray::operator_noteq_data() QTest::addColumn<QBitArray>("input2"); QTest::addColumn<bool>("res"); - QTest::newRow("data0") << QStringToQBitArray(QString("11111111")) - << QStringToQBitArray(QString("00101100")) + QTest::newRow("data0") << QStringToQBitArray(QString("11111111")) + << QStringToQBitArray(QString("00101100")) << true; - QTest::newRow("data1") << QStringToQBitArray(QString("11011011")) - << QStringToQBitArray(QString("11011011")) + QTest::newRow("data1") << QStringToQBitArray(QString("11011011")) + << QStringToQBitArray(QString("11011011")) << false; - QTest::newRow("data2") << QStringToQBitArray(QString()) - << QStringToQBitArray(QString("00101100111")) + QTest::newRow("data2") << QStringToQBitArray(QString()) + << QStringToQBitArray(QString("00101100111")) << true; - QTest::newRow("data3") << QStringToQBitArray(QString()) - << QStringToQBitArray(QString()) + QTest::newRow("data3") << QStringToQBitArray(QString()) + << QStringToQBitArray(QString()) << false; - QTest::newRow("data4") << QStringToQBitArray(QString("00101100")) - << QStringToQBitArray(QString("11111111")) + QTest::newRow("data4") << QStringToQBitArray(QString("00101100")) + << QStringToQBitArray(QString("11111111")) << true; - QTest::newRow("data5") << QStringToQBitArray(QString("00101100111")) - << QStringToQBitArray(QString()) + QTest::newRow("data5") << QStringToQBitArray(QString("00101100111")) + << QStringToQBitArray(QString()) << true; } diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp index c38fb66..15cca56 100644 --- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp @@ -95,10 +95,7 @@ private slots: void checkedButton(); - // fixed for Qt 4.2.0 -#if QT_VERSION >= 0x040200 void task106609(); -#endif void task209485_removeFromGroupInEventHandler_data(); void task209485_removeFromGroupInEventHandler(); @@ -211,7 +208,6 @@ void tst_QButtonGroup::arrowKeyNavigation() void tst_QButtonGroup::exclusiveWithActions() { -#if QT_VERSION > 0x040100 QDialog dlg(0); QHBoxLayout layout(&dlg); QAction *action1 = new QAction("Action 1", &dlg); @@ -235,7 +231,7 @@ void tst_QButtonGroup::exclusiveWithActions() buttonGroup->addButton(toolButton2, 2); buttonGroup->addButton(toolButton3, 3); dlg.show(); - + QTest::mouseClick(toolButton1, Qt::LeftButton); QVERIFY(toolButton1->isChecked()); QVERIFY(action1->isChecked()); @@ -251,7 +247,7 @@ void tst_QButtonGroup::exclusiveWithActions() QVERIFY(!toolButton3->isChecked()); QVERIFY(!action1->isChecked()); QVERIFY(!action3->isChecked()); - + QTest::mouseClick(toolButton3, Qt::LeftButton); QVERIFY(toolButton3->isChecked()); QVERIFY(action3->isChecked()); @@ -259,7 +255,7 @@ void tst_QButtonGroup::exclusiveWithActions() QVERIFY(!toolButton2->isChecked()); QVERIFY(!action1->isChecked()); QVERIFY(!action2->isChecked()); - + QTest::mouseClick(toolButton2, Qt::LeftButton); QVERIFY(toolButton2->isChecked()); QVERIFY(action2->isChecked()); @@ -267,7 +263,6 @@ void tst_QButtonGroup::exclusiveWithActions() QVERIFY(!toolButton3->isChecked()); QVERIFY(!action1->isChecked()); QVERIFY(!action3->isChecked()); -#endif } void tst_QButtonGroup::exclusive() @@ -289,7 +284,7 @@ void tst_QButtonGroup::exclusive() buttonGroup->addButton(pushButton2, 2); buttonGroup->addButton(pushButton3, 3); dlg.show(); - + QTest::mouseClick(pushButton1, Qt::LeftButton); QVERIFY(pushButton1->isChecked()); QVERIFY(!pushButton2->isChecked()); @@ -299,12 +294,12 @@ void tst_QButtonGroup::exclusive() QVERIFY(pushButton2->isChecked()); QVERIFY(!pushButton1->isChecked()); QVERIFY(!pushButton3->isChecked()); - + QTest::mouseClick(pushButton3, Qt::LeftButton); QVERIFY(pushButton3->isChecked()); QVERIFY(!pushButton1->isChecked()); QVERIFY(!pushButton2->isChecked()); - + QTest::mouseClick(pushButton2, Qt::LeftButton); QVERIFY(pushButton2->isChecked()); QVERIFY(!pushButton1->isChecked()); @@ -363,7 +358,6 @@ void tst_QButtonGroup::testSignals() QVERIFY(releasedIdSpy.takeFirst().at(0).toInt() == 23); } -#if QT_VERSION >= 0x040200 void tst_QButtonGroup::task106609() { // task is: @@ -403,7 +397,6 @@ void tst_QButtonGroup::task106609() QCOMPARE(spy2.count(), 2); QCOMPARE(spy1.count(), 2); } -#endif void tst_QButtonGroup::checkedButton() { diff --git a/tests/auto/qcache/tst_qcache.cpp b/tests/auto/qcache/tst_qcache.cpp index f0d0454..2b61467 100644 --- a/tests/auto/qcache/tst_qcache.cpp +++ b/tests/auto/qcache/tst_qcache.cpp @@ -39,10 +39,8 @@ ** ****************************************************************************/ - #include <QtTest/QtTest> - #include <qcache.h> //TESTED_CLASS= @@ -56,7 +54,6 @@ public: tst_QCache(); virtual ~tst_QCache(); - public slots: void initTestCase(); void cleanupTestCase(); @@ -344,7 +341,7 @@ void tst_QCache::remove() QCOMPARE(cache.totalCost(), 20); } - cache.setMaxCost(1); + cache.setMaxCost(1); QCOMPARE(cache.size(), 0); cache.remove("beta"); QCOMPARE(cache.size(), 0); @@ -377,7 +374,7 @@ void tst_QCache::take() QCOMPARE(cache.size(), 1); QCOMPARE(cache.totalCost(), 20); - cache.setMaxCost(1); + cache.setMaxCost(1); QCOMPARE(cache.size(), 0); QCOMPARE(cache.take("beta"), (Foo*)0); QCOMPARE(cache.size(), 0); @@ -389,15 +386,8 @@ struct KeyType KeyType(int x) : foo(x) {} - /* - Qt 4.0 and 4.1 require a default ctor and an operator=(). - */ -#if QT_VERSION < 0x040200 - KeyType() : foo(0) {} -#else private: KeyType &operator=(const KeyType &); -#endif }; struct ValueType diff --git a/tests/auto/qcheckbox/tst_qcheckbox.cpp b/tests/auto/qcheckbox/tst_qcheckbox.cpp index be1095a..9ffeb07 100644 --- a/tests/auto/qcheckbox/tst_qcheckbox.cpp +++ b/tests/auto/qcheckbox/tst_qcheckbox.cpp @@ -377,10 +377,8 @@ void tst_QCheckBox::onStateChanged( int state ) void tst_QCheckBox::stateChanged() { -#if QT_VERSION > 0x040101 QSignalSpy stateChangedSpy(testWidget, SIGNAL(stateChanged(int))); -#endif - connect(testWidget, SIGNAL(stateChanged(int)), this, SLOT(onStateChanged(int))); + connect(testWidget, SIGNAL(stateChanged(int)), this, SLOT(onStateChanged(int))); cur_state = -1; testWidget->setChecked( TRUE ); qApp->processEvents(); @@ -396,12 +394,10 @@ void tst_QCheckBox::stateChanged() qApp->processEvents(); QCOMPARE( cur_state, (int)1 ); -#if QT_VERSION > 0x040101 QCOMPARE(stateChangedSpy.count(), 3); testWidget->setCheckState(Qt::PartiallyChecked); qApp->processEvents(); QCOMPARE(stateChangedSpy.count(), 3); -#endif } void tst_QCheckBox::isToggleButton() diff --git a/tests/auto/qcolordialog/tst_qcolordialog.cpp b/tests/auto/qcolordialog/tst_qcolordialog.cpp index e51dfcc..1b5babb 100644 --- a/tests/auto/qcolordialog/tst_qcolordialog.cpp +++ b/tests/auto/qcolordialog/tst_qcolordialog.cpp @@ -108,7 +108,7 @@ void tst_QColorDialog::native_activeModalWidget() // color dialog when it is executing, even when using a native // dialog: TestNativeDialog d; - QTimer::singleShot(100, &d, SLOT(hide())); + QTimer::singleShot(1000, &d, SLOT(hide())); d.exec(); QVERIFY(&d == d.m_activeModalWidget); } diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index fb5e37a..6a87e3c 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -56,6 +56,7 @@ #include <qlistwidget.h> #include <qtreewidget.h> #include <qtablewidget.h> +#include <qscrollbar.h> #ifdef Q_WS_MAC #include <qmacstyle_mac.h> #elif defined Q_WS_X11 @@ -135,7 +136,11 @@ private slots: void task191329_size(); void task166349_setEditableOnReturn(); void task190205_setModelAdjustToContents(); + void task248169_popupWithMinimalSize(); + void task247863_keyBoardSelection(); void setModelColumn(); + void noScrollbar_data(); + void noScrollbar(); protected slots: void onEditTextChanged( const QString &newString ); @@ -278,13 +283,9 @@ void tst_QComboBox::getSetCheck() QLineEdit *var8 = new QLineEdit(0); obj1.setLineEdit(var8); QCOMPARE(var8, obj1.lineEdit()); -#if QT_VERSION >= 0x040200 - // QComboBox in Qt < 4.2 have asserts for this, but handles the situation by ignoring it. - // Qt >= 4.2 should handle this gracefully (no asserts, but define behavior as keeping current) QTest::ignoreMessage(QtWarningMsg, "QComboBox::setLineEdit: cannot set a 0 line edit"); obj1.setLineEdit((QLineEdit *)0); QCOMPARE(var8, obj1.lineEdit()); -#endif // delete var8; // No delete, since QComboBox takes ownership // const QValidator * QComboBox::validator() @@ -301,13 +302,9 @@ void tst_QComboBox::getSetCheck() MyAbstractItemDelegate *var10 = new MyAbstractItemDelegate; obj1.setItemDelegate(var10); QCOMPARE(obj1.itemDelegate(), (QAbstractItemDelegate *)var10); -#if QT_VERSION >= 0x040200 - // QComboBox in Qt < 4.2 have asserts for this, but handles the situation by ignoring it. - // Qt >= 4.2 should handle this gracefully (no asserts, but define behavior as keeping current) QTest::ignoreMessage(QtWarningMsg, "QComboBox::setItemDelegate: cannot set a 0 delegate"); obj1.setItemDelegate((QAbstractItemDelegate *)0); QCOMPARE(obj1.itemDelegate(), (QAbstractItemDelegate *)var10); -#endif // delete var10; // No delete, since QComboBox takes ownership // QAbstractItemModel * QComboBox::model() @@ -315,13 +312,9 @@ void tst_QComboBox::getSetCheck() MyAbstractItemModel *var11 = new MyAbstractItemModel; obj1.setModel(var11); QCOMPARE(obj1.model(), (QAbstractItemModel *)var11); -#if QT_VERSION >= 0x040200 - // QComboBox in Qt < 4.2 have asserts for this, but handles the situation by ignoring it. - // Qt >= 4.2 should handle this gracefully (no asserts, but define behavior as keeping current) QTest::ignoreMessage(QtWarningMsg, "QComboBox::setModel: cannot set a 0 model"); obj1.setModel((QAbstractItemModel *)0); QCOMPARE(obj1.model(), (QAbstractItemModel *)var11); -#endif delete var11; obj1.model(); @@ -340,13 +333,9 @@ void tst_QComboBox::getSetCheck() MyAbstractItemView *var13 = new MyAbstractItemView; obj1.setView(var13); QCOMPARE(obj1.view(), (QAbstractItemView *)var13); -#if QT_VERSION >= 0x040200 - // QComboBox in Qt < 4.2 have asserts for this - // Qt >= 4.2 should handle this gracefully (no asserts, but define behavior as keeping current view) QTest::ignoreMessage(QtWarningMsg, "QComboBox::setView: cannot set a 0 view"); obj1.setView((QAbstractItemView *)0); QCOMPARE(obj1.view(), (QAbstractItemView *)var13); -#endif delete var13; // int QComboBox::currentIndex() @@ -507,13 +496,9 @@ void tst_QComboBox::sizeAdjustPolicy() testWidget->addItem("small"); QCOMPARE(testWidget->sizeHint(), content); testWidget->addItem("looooooooooooooooooooooong item"); -#if QT_VERSION >= 0x040200 // minimumContentsLength() > sizeof("looooooooooooooooooooooong item"), so the sizeHint() // stays the same QCOMPARE(testWidget->sizeHint(), content); -#else - QVERIFY(testWidget->sizeHint().width() > content.width()); -#endif // over 60 characters (cf. setMinimumContentsLength() call above) testWidget->addItem("loooooooooooooooooooooooooooooooooooooooooooooo" "ooooooooooooooooooooooooooooooooooooooooooooooo" @@ -530,10 +515,8 @@ void tst_QComboBox::sizeAdjustPolicy() content = testWidget->sizeHint(); while (testWidget->count()) testWidget->removeItem(0); -#if QT_VERSION >= 0x040200 QCOMPARE(testWidget->sizeHint(), content); testWidget->setMinimumContentsLength(0); -#endif QVERIFY(testWidget->sizeHint().width() < content.width()); } @@ -826,13 +809,9 @@ void tst_QComboBox::autoCompletionCaseSensitivity() QTest::keyClick(testWidget->lineEdit(), Qt::Key_B); qApp->processEvents(); -#if QT_VERSION < 0x040200 - // autocompletions are case-preserving in < 4.2 - QCOMPARE(testWidget->currentText(), QString("aBCDEF")); -#else // autocompletions preserve userkey-case from 4.2 QCOMPARE(testWidget->currentText(), QString("abCDEF")); -#endif + QTest::keyClick(testWidget->lineEdit(), Qt::Key_Enter); qApp->processEvents(); QCOMPARE(testWidget->currentText(), QString("aBCDEF")); // case restored to item's case @@ -2109,6 +2088,47 @@ void tst_QComboBox::task190205_setModelAdjustToContents() QCOMPARE(box.size(), correctBox.size()); } +void tst_QComboBox::task248169_popupWithMinimalSize() +{ + QStringList initialContent; + initialContent << "foo" << "bar" << "foobar"; + + QComboBox comboBox; + comboBox.addItems(initialContent); + comboBox.view()->setMinimumWidth(500); + QDesktopWidget desktop; + comboBox.setGeometry(desktop.availableGeometry().width() - 200, 100, 200, 100); + + comboBox.show(); + QTest::qWait(100); + comboBox.showPopup(); + QTest::qWait(100); + + QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox); + QVERIFY(container); + QVERIFY(desktop.screenGeometry(container).contains(container->geometry())); +} + +void tst_QComboBox::task247863_keyBoardSelection() +{ + QComboBox combo; + combo.setEditable(false); + combo.addItem( QLatin1String("111")); + combo.addItem( QLatin1String("222")); + combo.show(); + QApplication::setActiveWindow(&combo); + QTest::qWait(100); + + QSignalSpy spy(&combo, SIGNAL(activated(const QString &))); + qApp->setEffectEnabled(Qt::UI_AnimateCombo, false); + QTest::keyClick(&combo, Qt::Key_Space); + qApp->setEffectEnabled(Qt::UI_AnimateCombo, true); + QTest::keyClick(0, Qt::Key_Down); + QTest::keyClick(0, Qt::Key_Enter); + QCOMPARE(combo.currentText(), QLatin1String("222")); + QCOMPARE(spy.count(), 1); +} + void tst_QComboBox::setModelColumn() { QStandardItemModel model(5,3); @@ -2135,5 +2155,56 @@ void tst_QComboBox::setModelColumn() QCOMPARE(box.currentText(), QString("zero")); } +void tst_QComboBox::noScrollbar_data() +{ + QTest::addColumn<QString>("stylesheet"); + + QTest::newRow("normal") << QString(); + QTest::newRow("border") << QString::fromLatin1("QAbstractItemView { border: 12px solid blue;}"); + QTest::newRow("margin") << QString::fromLatin1("QAbstractItemView { margin: 12px 15px 13px 10px; }"); + QTest::newRow("padding") << QString::fromLatin1("QAbstractItemView { padding: 12px 15px 13px 10px;}"); + QTest::newRow("everything") << QString::fromLatin1("QAbstractItemView { border: 12px solid blue; " + " padding: 12px 15px 13px 10px; margin: 12px 15px 13px 10px; }"); + QTest::newRow("everything and more") << QString::fromLatin1("QAbstractItemView { border: 1px 3px 5px 1px solid blue; " + " padding: 2px 5px 3px 1px; margin: 2px 5px 3px 1px; } " + " QAbstractItemView::item { border: 2px solid green; " + " padding: 1px 1px 2px 2px margin: 1px; } " ); +} + +void tst_QComboBox::noScrollbar() +{ + QStringList initialContent; + initialContent << "foo" << "bar" << "foobar" << "moo"; + QFETCH(QString, stylesheet); + + { + QComboBox comboBox; + comboBox.setStyleSheet(stylesheet); + comboBox.addItems(initialContent); + comboBox.show(); + comboBox.resize(200, comboBox.height()); + QTest::qWait(100); + comboBox.showPopup(); + QTest::qWait(100); + QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible()); + QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible()); + } + + { + QTableWidget *table = new QTableWidget(2,2); + QComboBox comboBox; + comboBox.setStyleSheet(stylesheet); + comboBox.setView(table); + comboBox.setModel(table->model()); + comboBox.show(); + QTest::qWait(100); + comboBox.resize(200, comboBox.height()); + comboBox.showPopup(); + QTest::qWait(100); + QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible()); + QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible()); + } +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" diff --git a/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp index 5665e6e..45a4301 100644 --- a/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp +++ b/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp @@ -211,11 +211,7 @@ void tst_QCommandLinkButton::setAutoRepeat() QVERIFY( !testWidget->isCheckable() ); // verify autorepeat is off by default. -#if QT_VERSION < 0x040000 - QButton tmp( 0 ); -#else QCommandLinkButton tmp( 0 ); -#endif tmp.setObjectName("tmp"); QVERIFY( !tmp.autoRepeat() ); diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 6434d49..656995a 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -140,6 +140,8 @@ private slots: // task-specific tests below me void task178797_activatedOnReturn(); void task189564_omitNonSelectableItems(); + void task246056_setCompletionPrefix(); + void task250064_lostFocus(); private: void filter(); @@ -1093,5 +1095,94 @@ void tst_QCompleter::task189564_omitNonSelectableItems() QVERIFY(matches2.isEmpty()); } +class task246056_ComboBox : public QComboBox +{ + Q_OBJECT +public: + task246056_ComboBox() + { + setEditable(true); + setInsertPolicy(NoInsert); + Q_ASSERT(completer()); + completer()->setCompletionMode(QCompleter::PopupCompletion); + completer()->setCompletionRole(Qt::DisplayRole); + connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix())); + } +private slots: + void setCompletionPrefix() { completer()->setCompletionPrefix(lineEdit()->text()); } +}; + +void tst_QCompleter::task246056_setCompletionPrefix() +{ + task246056_ComboBox *comboBox = new task246056_ComboBox; + comboBox->addItem(""); + comboBox->addItem("a1"); + comboBox->addItem("a2"); + comboBox->show(); + comboBox->setFocus(); + QTest::qWait(100); + QTest::keyPress(comboBox, 'a'); + QTest::keyPress(comboBox->completer()->popup(), Qt::Key_Down); + QTest::keyPress(comboBox->completer()->popup(), Qt::Key_Down); + QTest::keyPress(comboBox->completer()->popup(), Qt::Key_Enter); // don't crash! +} + +class task250064_TextEdit : public QTextEdit +{ +public: + QCompleter *completer; + + task250064_TextEdit() + { + completer = new QCompleter; + completer->setWidget(this); + } + + void keyPressEvent (QKeyEvent *e) + { + completer->popup(); + QTextEdit::keyPressEvent(e); + } +}; + +class task250064_Widget : public QWidget +{ + Q_OBJECT +public: + task250064_TextEdit *textEdit; + + task250064_Widget(task250064_TextEdit *textEdit) + : textEdit(textEdit) + { + QTabWidget *tabWidget = new QTabWidget; + tabWidget->setFocusPolicy(Qt::ClickFocus); + tabWidget->addTab(textEdit, "untitled"); + + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(tabWidget); + + textEdit->setPlainText("bla bla bla"); + textEdit->setFocus(); + } + + void setCompletionModel() + { + textEdit->completer->setModel(0); + } +}; + +void tst_QCompleter::task250064_lostFocus() +{ + task250064_TextEdit *textEdit = new task250064_TextEdit; + task250064_Widget *widget = new task250064_Widget(textEdit); + widget->show(); + QTest::qWait(100); + QTest::keyPress(textEdit, 'a'); + Qt::FocusPolicy origPolicy = textEdit->focusPolicy(); + QVERIFY(origPolicy != Qt::NoFocus); + widget->setCompletionModel(); + QCOMPARE(textEdit->focusPolicy(), origPolicy); +} + QTEST_MAIN(tst_QCompleter) #include "tst_qcompleter.moc" diff --git a/tests/auto/qcssparser/tst_cssparser.cpp b/tests/auto/qcssparser/tst_cssparser.cpp index 6e277d3..ab6bad6 100644 --- a/tests/auto/qcssparser/tst_cssparser.cpp +++ b/tests/auto/qcssparser/tst_cssparser.cpp @@ -44,7 +44,6 @@ //TESTED_CLASS=QCss //TESTED_FILES=gui/text/qcssparser.cpp gui/text/qcssparser_p.h -#if QT_VERSION >= 0x040200 #include "private/qcssparser_p.h" class tst_CssParser : public QObject @@ -272,7 +271,7 @@ void tst_CssParser::term_data() val.variant = QVariant(QColor("#ffbb00")); QTest::newRow("hexcolor2") << true << "#fb0" << val; - QTest::ignoreMessage(QtWarningMsg, "QColor::setNamedColor: Could not parse color '#cafebabe'"); + QTest::ignoreMessage(QtWarningMsg, "QCssParser::parseHexColor: Unknown color name '#cafebabe'"); QTest::newRow("hexcolor_failure") << false << "#cafebabe" << val; val.type = QCss::Value::Uri; @@ -1592,13 +1591,13 @@ void tst_CssParser::quotedAndUnquotedIdentifiers() QCss::Parser parser("foo { font-style: \"italic\"; font-weight: bold }"); QCss::StyleSheet sheet; QVERIFY(parser.parse(&sheet)); - + QCOMPARE(sheet.styleRules.count() + sheet.nameIndex.count(), 1); QCss::StyleRule rule = (!sheet.styleRules.isEmpty()) ? sheet.styleRules.at(0) : *sheet.nameIndex.begin(); const QVector<QCss::Declaration> decls = rule.declarations; QCOMPARE(decls.size(), 2); - + QCOMPARE(decls.at(0).d->values.first().type, QCss::Value::String); QCOMPARE(decls.at(0).d->property, QLatin1String("font-style")); QCOMPARE(decls.at(0).d->values.first().toString(), QLatin1String("italic")); @@ -1610,6 +1609,3 @@ void tst_CssParser::quotedAndUnquotedIdentifiers() QTEST_MAIN(tst_CssParser) #include "tst_cssparser.moc" -#else -QTEST_NOOP_MAIN -#endif diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index a112c10..d7ca7bc 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -163,10 +163,8 @@ private slots: void setVersion_data(); void setVersion(); -#if QT_VERSION >= 0x040100 void skipRawData_data(); void skipRawData(); -#endif void status_qint8_data(); void status_qint8(); @@ -2435,7 +2433,6 @@ private: int offset; }; -#if QT_VERSION >= 0x040100 void tst_QDataStream::skipRawData_data() { QTest::addColumn<QString>("deviceType"); @@ -2486,7 +2483,6 @@ void tst_QDataStream::skipRawData() delete dev; } -#endif #define TEST_qint(T, UT) \ void tst_QDataStream::status_##T() \ diff --git a/tests/auto/qdate/tst_qdate.cpp b/tests/auto/qdate/tst_qdate.cpp index 121167a..d4273d0 100644 --- a/tests/auto/qdate/tst_qdate.cpp +++ b/tests/auto/qdate/tst_qdate.cpp @@ -143,10 +143,8 @@ void tst_QDate::isValid_data() QTest::newRow("century leap") << 2100 << 2 << 29 << 0U << false; QTest::newRow("400-years leap") << 2000 << 2 << 29 << 2451604U << true; QTest::newRow("400-years leap 2") << 2400 << 2 << 29 << 2597701U << true; -#if QT_VERSION >= 0x040200 QTest::newRow("400-years leap 3") << 1600 << 2 << 29 << 2305507U << true; QTest::newRow("year 0") << 0 << 2 << 27 << 0U << false; -#endif // test the number of days in months: QTest::newRow("jan") << 2000 << 1 << 31 << 2451575U << true; @@ -177,7 +175,6 @@ void tst_QDate::isValid_data() QTest::newRow("idec") << 2000 << 12 << 32 << 0U << false; // the beginning of the Julian Day calendar: -#if QT_VERSION >= 0x040200 QTest::newRow("jd negative1") << -4714 << 1 << 1 << 0U << false; QTest::newRow("jd negative2") << -4713 << 1 << 1 << 0U << false; QTest::newRow("jd negative3") << -4713 << 1 << 2 << 1U << true; @@ -185,7 +182,6 @@ void tst_QDate::isValid_data() QTest::newRow("jd 0") << -4713 << 1 << 1 << 0U << false; QTest::newRow("jd 1") << -4713 << 1 << 2 << 1U << true; QTest::newRow("imminent overflow") << 11754508 << 12 << 13 << 4294967295U << true; -#endif } void tst_QDate::isValid() @@ -243,17 +239,12 @@ void tst_QDate::weekNumber_data() QTest::newRow( "data4" ) << 1 << 2001 << 2001 << 1 << 1; QTest::newRow( "data5" ) << 53 << 1998 << 1998 << 12 << 31; QTest::newRow( "data6" ) << 1 << 1985 << 1984 << 12 << 31; -#if QT_VERSION >= 0x030300 - // This is a bug that was fixed for 3.3 QTest::newRow( "data7" ) << 52 << 2006 << 2006 << 12 << 31; -#endif } void tst_QDate::weekNumber() { -#if QT_VERSION >= 0x030100 int yearNumber; -// int weekNumber; QFETCH( int, year ); QFETCH( int, month ); QFETCH( int, day ); @@ -262,9 +253,6 @@ void tst_QDate::weekNumber() QDate dt1( year, month, day ); QCOMPARE( dt1.weekNumber( &yearNumber ), expectedWeekNum ); QCOMPARE( yearNumber, expectedYearNum ); -#else - QSKIP( "Not tested with Qt versions < 3.1", SkipAll); -#endif } void tst_QDate::weekNumber_invalid_data() @@ -281,14 +269,9 @@ void tst_QDate::weekNumber_invalid_data() void tst_QDate::weekNumber_invalid() { -#if QT_VERSION >= 0x030100 QDate dt; int yearNumber; -// int weekNumber; QCOMPARE( dt.weekNumber( &yearNumber ), 0 ); -#else - QSKIP( "Not tested with Qt versions < 3.1", SkipAll); -#endif } void tst_QDate::addDays() @@ -616,14 +599,12 @@ void tst_QDate::fromString_data() QDate d( 1999, 11, 14 ); QTest::newRow( "data2" ) << d.toString( Qt::TextDate ) << d.toString( Qt::ISODate ) << d; -#if QT_VERSION >= 0x040200 QTest::newRow( "data3" ) << QString("xxx Jan 1 0999") << QString("0999-01-01") << QDate(999, 1, 1); QTest::newRow( "data3b" ) << QString("xxx Jan 1 999") << QString("0999-01-01") << QDate(999, 1, 1); QTest::newRow( "data4" ) << QString("xxx Jan 1 12345") << QString() << QDate(12345, 1, 1); QTest::newRow( "data5" ) << QString("xxx Jan 1 -0001") << QString() << QDate(-1, 1, 1); QTest::newRow( "data6" ) << QString("xxx Jan 1 -4712") << QString() << QDate(-4712, 1, 1); QTest::newRow( "data7" ) << QString("xxx Nov 25 -4713") << QString() << QDate(-4713, 11, 25); -#endif } void tst_QDate::fromString() @@ -647,9 +628,7 @@ void tst_QDate::toString_format_data() QTest::newRow( "data1" ) << QDate(2002,12,17) << QString("dd-MM-yyyy") << QString("17-12-2002"); QTest::newRow( "data2" ) << QDate(1995,5,20) << QString("M-yy") << QString("5-95"); QTest::newRow( "data3" ) << QDate(2002,12,17) << QString("dd") << QString("17"); -#if (QT_VERSION-0 >= 0x030200) QTest::newRow( "data4" ) << QDate() << QString("dd-mm-yyyy") << QString(); -#endif } void tst_QDate::toString_format() diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 9e73d6d..69d8a62 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -220,18 +220,10 @@ void tst_QDateTime::isNull() dt1.setDate(QDate(2004, 1, 2)); QVERIFY(!dt1.isNull()); -#if QT_VERSION < 0x040100 - dt1.setDate(QDate()); - QVERIFY(dt1.isNull()); -#endif dt1.setTime(QTime(12, 34, 56)); QVERIFY(!dt1.isNull()); dt1.setTime(QTime()); -#if QT_VERSION >= 0x040100 QVERIFY(!dt1.isNull()); -#else - QVERIFY(dt1.isNull()); -#endif } void tst_QDateTime::isValid() @@ -1010,15 +1002,10 @@ void tst_QDateTime::toString_strformat_data() void tst_QDateTime::toString_strformat() { -#if (QT_VERSION-0 >= 0x030200) QFETCH( QDateTime, dt ); QFETCH( QString, format ); QFETCH( QString, str ); QCOMPARE( dt.toString( format ), str ); -#else - QSKIP( "No test implemented for < 3.2 yet", SkipAll); -#endif - } void tst_QDateTime::fromStringTextDate_data() @@ -1068,7 +1055,6 @@ void tst_QDateTime::fromStringTextDate_data() << 28 << 6 << 2005 << 7 << 57 << 30 << 110 << int(Qt::LocalTime); -#if QT_VERSION >= 0x040200 QTest::newRow("Year 0999") << QString("Tue Jun 17 08:00:10 0999") << int(Qt::TextDate) << 17 << 6 << 999 << 8 << 0 << 10 << 0 @@ -1088,7 +1074,6 @@ void tst_QDateTime::fromStringTextDate_data() << int(Qt::TextDate) << 1 << 1 << -4712 << 0 << 01 << 02 << 0 << int(Qt::LocalTime); -#endif } void tst_QDateTime::fromStringTextDate() diff --git a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/qdesktopservices/tst_qdesktopservices.cpp index 49f8922..81b35ac 100644 --- a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp +++ b/tests/auto/qdesktopservices/tst_qdesktopservices.cpp @@ -41,9 +41,6 @@ #include <QtTest/QtTest> -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else #include <QStandardItemModel> #include <qdebug.h> #include <qdesktopservices.h> @@ -172,5 +169,3 @@ void tst_qdesktopservices::storageLocationDoesNotEndWithSlash() QTEST_MAIN(tst_qdesktopservices) #include "tst_qdesktopservices.moc" -#endif - diff --git a/tests/auto/qdialog/tst_qdialog.cpp b/tests/auto/qdialog/tst_qdialog.cpp index e77167e..a1cf1c1 100644 --- a/tests/auto/qdialog/tst_qdialog.cpp +++ b/tests/auto/qdialog/tst_qdialog.cpp @@ -375,14 +375,11 @@ void tst_QDialog::showAsTool() testWidget->activateWindow(); dialog.exec(); QTest::qWait(100); - if (testWidget->style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, testWidget)) { -#if defined(Q_WS_QWS) && QT_VERSION < 0x040400 - QEXPECT_FAIL(0, "Qtopia Core has messed up WStyle_Tool (task 126435)", Continue); -#endif - QCOMPARE(dialog.wasActive(), true); - } else { - QCOMPARE(dialog.wasActive(), false); - } + if (testWidget->style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, testWidget)) { + QCOMPARE(dialog.wasActive(), true); + } else { + QCOMPARE(dialog.wasActive(), false); + } } // Verify that pos() returns the same before and after show() @@ -392,10 +389,10 @@ void tst_QDialog::toolDialogPosition() #if defined(Q_OS_WINCE) QSKIP("No real support for Qt::Tool on WinCE", SkipAll); #endif - QDialog dialog(0, Qt::Tool); - dialog.move(QPoint(100,100)); + QDialog dialog(0, Qt::Tool); + dialog.move(QPoint(100,100)); const QPoint beforeShowPosition = dialog.pos(); - dialog.show(); + dialog.show(); const QPoint afterShowPosition = dialog.pos(); QCOMPARE(afterShowPosition, beforeShowPosition); } @@ -445,7 +442,7 @@ public slots: void tst_QDialog::throwInExec() { #ifdef Q_WS_MAC - QSKIP("Qt/Mac: Throwing exceptions in excec() is not supported.", SkipAll); + QSKIP("Qt/Mac: Throwing exceptions in exec() is not supported.", SkipAll); #endif int caughtExceptions = 0; try { diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index f680f46..91ce5b3 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -787,9 +787,7 @@ void tst_QDir::cd_data() #endif QTest::newRow("non existant") << "." << "../anonexistingdir" << false << QDir::currentPath(); QTest::newRow("self") << "." << (QString("../") + QFileInfo(QDir::currentPath()).fileName()) << true << QDir::currentPath(); -#if QT_VERSION > 0x040100 QTest::newRow("file") << "." << "qdir.pro" << false << ""; -#endif } void tst_QDir::cd() @@ -827,10 +825,8 @@ void tst_QDir::setNameFilters_data() << QString("foo. bar,foo.bar").split(","); QTest::newRow("files1") << appPath + "testdir/dir" << QString("*r.cpp *.pro").split(" ") << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(","); -#if QT_VERSION >= 0x040000 QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data") << QString("file1.data,file2.data,file3.data").split(','); -#endif } void tst_QDir::setNameFilters() diff --git a/tests/auto/qdirmodel/tst_qdirmodel.cpp b/tests/auto/qdirmodel/tst_qdirmodel.cpp index f6887da..2084535 100644 --- a/tests/auto/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/qdirmodel/tst_qdirmodel.cpp @@ -614,7 +614,6 @@ void tst_QDirModel::task196768_sorting() QCOMPARE(index.data(), index2.data()); } -#if QT_VERSION >= 0x040102 void tst_QDirModel::filter() { QDirModel model; @@ -625,7 +624,6 @@ void tst_QDirModel::filter() Q_ASSERT(!index2.isValid()); Q_ASSERT(model.rowCount(index) == 0); } -#endif void tst_QDirModel::task244669_remove() { diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index 3d294c0..af11133 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -90,6 +90,7 @@ private slots: void task165177_deleteFocusWidget(); void task169808_setFloating(); void task237438_setFloatingCrash(); + void task248604_infiniteResize(); }; // Testing get/set functions @@ -783,5 +784,19 @@ void tst_QDockWidget::task237438_setFloatingCrash() pqdwDock.show(); } +void tst_QDockWidget::task248604_infiniteResize() +{ + QDockWidget d; + QTabWidget *t = new QTabWidget; + t->addTab(new QWidget, "Foo"); + d.setWidget(t); + d.setContentsMargins(2, 2, 2, 2); + d.setMinimumSize(320, 240); + d.show(); + QTest::qWait(400); + QCOMPARE(d.size(), QSize(320, 240)); +} + + QTEST_MAIN(tst_QDockWidget) #include "tst_qdockwidget.moc" diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/QRC File.pbfiletemplate/resource.qrc b/tests/auto/qfile/rename-fallback.qrc index bf4f322..c8a894a 100644 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/QRC File.pbfiletemplate/resource.qrc +++ b/tests/auto/qfile/rename-fallback.qrc @@ -1,5 +1,5 @@ <!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/"> - <file>YOUR_FILE</file> +<qresource> + <file>rename-fallback.qrc</file> </qresource> </RCC> diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro index 2293bd7..68f4c05 100644 --- a/tests/auto/qfile/test/test.pro +++ b/tests/auto/qfile/test/test.pro @@ -17,7 +17,7 @@ QT = core network DEFINES += SRCDIR=\\\"$$PWD/../\\\" } -RESOURCES += ../qfile.qrc +RESOURCES += ../qfile.qrc ../rename-fallback.qrc TARGET = ../tst_qfile diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 48902c7..98e1859 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -76,10 +76,6 @@ #include "../network-settings.h" -#if QT_VERSION < 0x040200 -#define symLinkTarget readLink -#endif - Q_DECLARE_METATYPE(QFile::FileError) //TESTED_CLASS= @@ -169,6 +165,8 @@ private slots: void rename_data(); void rename(); void renameWithAtEndSpecialFile() const; + void renameFallback(); + void renameMultiple(); void appendAndRead(); void miscWithUncPathAsCurrentDir(); void standarderror(); @@ -214,6 +212,14 @@ void tst_QFile::cleanup() { // TODO: Add cleanup code here. // This will be executed immediately after each test is run. + + // for renameFallback() + QFile::remove("file-rename-destination.txt"); + + // for renameMultiple() + QFile::remove("file-to-be-renamed.txt"); + QFile::remove("file-renamed-once.txt"); + QFile::remove("file-renamed-twice.txt"); } void tst_QFile::initTestCase() @@ -980,12 +986,8 @@ void tst_QFile::link() #ifdef Q_OS_WIN // on windows links are always absolute QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath()); #else -#if QT_VERSION < 0x040101 - QCOMPARE(info2.symLinkTarget(), info1.filePath()); -#else QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath()); #endif -#endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath()); @@ -1051,19 +1053,12 @@ void tst_QFile::readBrokenLink() #ifdef Q_OS_WIN // on windows links are alway absolute QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath()); #else -#if QT_VERSION < 0x040101 - QCOMPARE(info2.symLinkTarget(), info1.filePath()); -#else QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath()); #endif -#endif QVERIFY(QFile::remove(info2.absoluteFilePath())); - -#if QT_VERSION >= 0x040101 QVERIFY(QFile::link("ole/..", "myLink2.lnk")); QCOMPARE(QFileInfo("myLink2.lnk").symLinkTarget(), QDir::currentPath()); -#endif } void tst_QFile::readTextFile_data() @@ -1271,10 +1266,6 @@ void tst_QFile::bufferedRead() QCOMPARE(file.pos(), qlonglong(2)); } -#if QT_VERSION <= 0x040100 - QCOMPARE(int(ftell(stdFile)), 2); -#endif - fclose(stdFile); } @@ -1594,12 +1585,7 @@ void tst_QFile::longFileName() } { QFile file(fileName); -#if QT_VERSION < 0x040100 -# ifdef Q_OS_WIN - QEXPECT_FAIL("244 chars", "Fixed in 4.1", Continue); - QEXPECT_FAIL("244 chars to absolutepath", "Fixed in 4.1", Continue); -# endif -#elif defined(Q_WS_WIN) +#if defined(Q_WS_WIN) #if !defined(Q_OS_WINCE) QT_WA({ if (false) ; }, { QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort); @@ -1824,10 +1810,6 @@ void tst_QFile::removeOpenFile() void tst_QFile::fullDisk() { -#if QT_VERSION < 0x040102 - QSKIP("Fixed for 4.1.2", SkipAll); -#endif - QFile file("/dev/full"); if (!file.exists()) QSKIP("/dev/full doesn't exist on this system", SkipAll); @@ -1971,9 +1953,7 @@ void tst_QFile::virtualFile() // read all: data = f.readAll(); QVERIFY(f.pos() != 0); -#if QT_VERSION >= 0x040200 QVERIFY(!data.isEmpty()); -#endif // seeking QVERIFY(f.seek(1)); @@ -2091,6 +2071,42 @@ void tst_QFile::renameWithAtEndSpecialFile() const QVERIFY(QFile::rename(newName, originalName)); } +void tst_QFile::renameFallback() +{ + // Using a resource file both to trigger QFile::rename's fallback handling + // and as a *read-only* source whose move should fail. + QFile file(":/rename-fallback.qrc"); + QVERIFY(file.exists() && "(test-precondition)"); + QFile::remove("file-rename-destination.txt"); + + QVERIFY(!file.rename("file-rename-destination.txt")); + QVERIFY(!QFile::exists("file-rename-destination.txt")); +} + +void tst_QFile::renameMultiple() +{ + // create the file if it doesn't exist + QFile file("file-to-be-renamed.txt"); + QVERIFY(file.open(QIODevice::ReadWrite) && "(test-precondition)"); + + // any stale files from previous test failures? + QFile::remove("file-renamed-once.txt"); + QFile::remove("file-renamed-twice.txt"); + + // begin testing + QVERIFY(file.rename("file-renamed-once.txt")); + QCOMPARE(file.fileName(), QString("file-renamed-once.txt")); + QVERIFY(file.rename("file-renamed-twice.txt")); + QCOMPARE(file.fileName(), QString("file-renamed-twice.txt")); + + QVERIFY(!QFile::exists("file-to-be-renamed.txt")); + QVERIFY(!QFile::exists("file-renamed-once.txt")); + QVERIFY(QFile::exists("file-renamed-twice.txt")); + + file.remove(); + QVERIFY(!QFile::exists("file-renamed-twice.txt")); +} + void tst_QFile::appendAndRead() { QFile writeFile(QLatin1String("appendfile.txt")); diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 9df9d84..695bfe7 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -681,6 +681,22 @@ void tst_QFiledialog::filters() for (int i = views.at(0)->currentIndex(); i < views.at(0)->count(); ++i) views.at(0)->setCurrentIndex(i); QCOMPARE(spyFilterSelected.count(), 0); + + //Let check if filters with whitespaces + QNonNativeFileDialog fd2; + QStringList expected; + expected << "C++ Source Files(*.cpp)"; + expected << "Any(*.*)"; + fd2.setFilter("C++ Source Files(*.cpp);;Any(*.*)"); + QCOMPARE(expected, fd2.filters()); + fd2.setFilter("C++ Source Files(*.cpp) ;;Any(*.*)"); + QCOMPARE(expected, fd2.filters()); + fd2.setFilter("C++ Source Files(*.cpp);; Any(*.*)"); + QCOMPARE(expected, fd2.filters()); + fd2.setFilter(" C++ Source Files(*.cpp);; Any(*.*)"); + QCOMPARE(expected, fd2.filters()); + fd2.setFilter("C++ Source Files(*.cpp) ;; Any(*.*)"); + QCOMPARE(expected, fd2.filters()); } void tst_QFiledialog::selectFilter() @@ -921,6 +937,18 @@ void tst_QFiledialog::selectFiles() QCOMPARE(spyFilterSelected.count(), 0); for (int i=0; i < 5; ++i) QFile::remove(filesPath + QString::fromLatin1("/qfiledialog_auto_test_not_pres_%1").arg(i)); + + //If the selection is invalid then we fill the line edit but without the / + QNonNativeFileDialog * dialog = new QNonNativeFileDialog( 0, "Save" ); + dialog->setFileMode( QFileDialog::AnyFile ); + dialog->setAcceptMode( QFileDialog::AcceptSave ); + QString temporary = QDir::tempPath() + QLatin1String("/blah"); + dialog->selectFile(temporary); + dialog->show(); + QTest::qWait(500); + QLineEdit *lineEdit = qFindChild<QLineEdit*>(dialog, "fileNameEdit"); + QVERIFY(lineEdit); + QCOMPARE(lineEdit->text(),QLatin1String("blah")); } void tst_QFiledialog::viewMode() @@ -1514,6 +1542,42 @@ private: }; +class sortProxy : public QSortFilterProxyModel +{ +public: + sortProxy(QObject *parent) : QSortFilterProxyModel(parent) + { + } +protected: + virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const + { + QFileSystemModel * const model = qobject_cast<QFileSystemModel *>(sourceModel()); + const QFileInfo leftInfo(model->fileInfo(left)); + const QFileInfo rightInfo(model->fileInfo(right)); + + if (leftInfo.isDir() == rightInfo.isDir()) + return(leftInfo.filePath().compare(rightInfo.filePath(),Qt::CaseInsensitive) < 0); + else if (leftInfo.isDir()) + return(false); + else + return(true); + } +}; + +class CrashDialog : public QNonNativeFileDialog +{ + Q_OBJECT + +public: + CrashDialog(QWidget *parent, const QString &caption, const +QString &dir, const QString &filter) + : QNonNativeFileDialog(parent, caption, dir, filter) + { + sortProxy *proxyModel = new sortProxy(this); + setProxyModel(proxyModel); + } +}; + void tst_QFiledialog::task227304_proxyOnFileDialog() { QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0); @@ -1525,6 +1589,17 @@ void tst_QFiledialog::task227304_proxyOnFileDialog() QTest::keyClick(edit, Qt::Key_S); QTest::qWait(200); QTest::keyClick(edit->completer()->popup(), Qt::Key_Down); + + CrashDialog *dialog = new CrashDialog(0, QString("crash dialog test"), QDir::homePath(), QString("*") ); + dialog->setFileMode(QFileDialog::ExistingFile); + dialog->show(); + + QListView *list = qFindChild<QListView*>(dialog, "listView"); + QTest::qWait(200); + QTest::keyClick(list, Qt::Key_Down); + QTest::keyClick(list, Qt::Key_Return); + QTest::qWait(200); + } void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior() diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 87f9ba3..334acce 100644 --- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -42,10 +42,6 @@ #include <QCoreApplication> -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include <QFileSystemWatcher> #ifdef Q_OS_LINUX @@ -403,5 +399,3 @@ void tst_QFileSystemWatcher::removePaths() QTEST_MAIN(tst_QFileSystemWatcher) #include "tst_qfilesystemwatcher.moc" - -#endif diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp index 58e837e..e3a5ffc 100644 --- a/tests/auto/qfont/tst_qfont.cpp +++ b/tests/auto/qfont/tst_qfont.cpp @@ -537,9 +537,6 @@ void tst_QFont::insertAndRemoveSubstitutions() QStringList moreFonts; moreFonts << "Bar" << "Baz"; QFont::insertSubstitutions("BogusFontFamily", moreFonts); -#if (QT_VERSION <= 0x040102) - QEXPECT_FAIL("", "Uppercase/Lowercase issues fixed in 4.1.3 and beyond", Abort); -#endif QCOMPARE(QFont::substitutes("BogusFontFamily").count(), 3); QCOMPARE(QFont::substitutes("bogusfontfamily").count(), 3); diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp index 28f490a..9c42b49 100644 --- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp @@ -149,9 +149,7 @@ void tst_QFontDatabase::fixedPitch() if (!fdb.families().contains(font)) QSKIP( "Font not installed", SkipSingle); -#if QT_VERSION >= 0x030200 QCOMPARE(fdb.isFixedPitch(font), fixedPitch); -#endif QFont qfont(font); QFontInfo fi(qfont); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index cce76ff..5565aa6 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -42,10 +42,6 @@ #include <QtTest/QtTest> -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include <private/qtextcontrol_p.h> #include <private/qgraphicsitem_p.h> #include <QAbstractTextDocumentLayout> @@ -162,6 +158,8 @@ private slots: void mapFromToParent(); void mapFromToScene(); void mapFromToItem(); + void mapRectFromToParent_data(); + void mapRectFromToParent(); void isAncestorOf(); void commonAncestorItem(); void data(); @@ -220,6 +218,7 @@ private slots: // task specific tests below me void task141694_textItemEnsureVisible(); void task128696_textItemEnsureMovable(); + void ensureUpdateOnTextItem(); void task177918_lineItemUndetected(); void task240400_clickOnTextItem_data(); void task240400_clickOnTextItem(); @@ -2515,6 +2514,87 @@ void tst_QGraphicsItem::mapFromToItem() delete item4; } +void tst_QGraphicsItem::mapRectFromToParent_data() +{ + QTest::addColumn<bool>("parent"); + QTest::addColumn<QPointF>("parentPos"); + QTest::addColumn<QTransform>("parentTransform"); + QTest::addColumn<QPointF>("pos"); + QTest::addColumn<QTransform>("transform"); + QTest::addColumn<QRectF>("inputRect"); + QTest::addColumn<QRectF>("outputRect"); + + QTest::newRow("nil") << false << QPointF() << QTransform() << QPointF() << QTransform() << QRectF() << QRectF(); + QTest::newRow("simple") << false << QPointF() << QTransform() << QPointF() << QTransform() + << QRectF(0, 0, 10, 10) << QRectF(0, 0, 10, 10); + QTest::newRow("simple w/parent") << true + << QPointF() << QTransform() + << QPointF() << QTransform() + << QRectF(0, 0, 10, 10) << QRectF(0, 0, 10, 10); + QTest::newRow("simple w/parent parentPos") << true + << QPointF(50, 50) << QTransform() + << QPointF() << QTransform() + << QRectF(0, 0, 10, 10) << QRectF(0, 0, 10, 10); + QTest::newRow("simple w/parent parentPos parentRotation") << true + << QPointF(50, 50) << QTransform().rotate(45) + << QPointF() << QTransform() + << QRectF(0, 0, 10, 10) << QRectF(0, 0, 10, 10); + QTest::newRow("pos w/parent") << true + << QPointF() << QTransform() + << QPointF(50, 50) << QTransform() + << QRectF(0, 0, 10, 10) << QRectF(50, 50, 10, 10); + QTest::newRow("rotation w/parent") << true + << QPointF() << QTransform() + << QPointF() << QTransform().rotate(90) + << QRectF(0, 0, 10, 10) << QRectF(-10, 0, 10, 10); + QTest::newRow("pos rotation w/parent") << true + << QPointF() << QTransform() + << QPointF(50, 50) << QTransform().rotate(90) + << QRectF(0, 0, 10, 10) << QRectF(40, 50, 10, 10); + QTest::newRow("pos rotation w/parent parentPos parentRotation") << true + << QPointF(-170, -190) << QTransform().rotate(90) + << QPointF(50, 50) << QTransform().rotate(90) + << QRectF(0, 0, 10, 10) << QRectF(40, 50, 10, 10); +} + +void tst_QGraphicsItem::mapRectFromToParent() +{ + QFETCH(bool, parent); + QFETCH(QPointF, parentPos); + QFETCH(QTransform, parentTransform); + QFETCH(QPointF, pos); + QFETCH(QTransform, transform); + QFETCH(QRectF, inputRect); + QFETCH(QRectF, outputRect); + + QGraphicsRectItem *rect = new QGraphicsRectItem; + rect->setPos(pos); + rect->setTransform(transform); + + if (parent) { + QGraphicsRectItem *rectParent = new QGraphicsRectItem; + rect->setParentItem(rectParent); + rectParent->setPos(parentPos); + rectParent->setTransform(parentTransform); + } + + // Make sure we use non-destructive transform operations (e.g., 90 degree + // rotations). + QCOMPARE(rect->mapRectToParent(inputRect), outputRect); + QCOMPARE(rect->mapRectFromParent(outputRect), inputRect); + QCOMPARE(rect->itemTransform(rect->parentItem()).mapRect(inputRect), outputRect); + QCOMPARE(rect->mapToParent(inputRect).boundingRect(), outputRect); + QCOMPARE(rect->mapToParent(QPolygonF(inputRect)).boundingRect(), outputRect); + QCOMPARE(rect->mapFromParent(outputRect).boundingRect(), inputRect); + QCOMPARE(rect->mapFromParent(QPolygonF(outputRect)).boundingRect(), inputRect); + QPainterPath inputPath; + inputPath.addRect(inputRect); + QPainterPath outputPath; + outputPath.addRect(outputRect); + QCOMPARE(rect->mapToParent(inputPath).boundingRect(), outputPath.boundingRect()); + QCOMPARE(rect->mapFromParent(outputPath).boundingRect(), inputPath.boundingRect()); +} + void tst_QGraphicsItem::isAncestorOf() { QGraphicsItem *grandPa = new QGraphicsRectItem; @@ -3934,8 +4014,26 @@ void tst_QGraphicsItem::itemChange() tester.itemSceneChangeTargetScene = 0; tester.itemChangeReturnValue = QVariant(); scene.removeItem(&tester); + ++changeCount; // ItemSceneChange + ++changeCount; // ItemSceneHasChanged QCOMPARE(tester.scene(), (QGraphicsScene *)0); } + { + // ItemToolTipChange/ItemToolTipHasChanged + const QString toolTip(QLatin1String("I'm soo cool")); + const QString overridenToolTip(QLatin1String("No, you are not soo cool")); + tester.itemChangeReturnValue = overridenToolTip; + tester.setToolTip(toolTip); + ++changeCount; // ItemToolTipChange + ++changeCount; // ItemToolTipHasChanged + QCOMPARE(tester.changes.size(), changeCount); + QCOMPARE(tester.changes.at(changeCount - 2), QGraphicsItem::ItemToolTipChange); + QCOMPARE(tester.values.at(changeCount - 2).toString(), toolTip); + QCOMPARE(tester.changes.at(changeCount - 1), QGraphicsItem::ItemToolTipHasChanged); + QCOMPARE(tester.values.at(changeCount - 1).toString(), overridenToolTip); + QCOMPARE(tester.toolTip(), overridenToolTip); + tester.itemChangeReturnValue = QVariant(); + } } class EventFilterTesterItem : public QGraphicsLineItem @@ -4019,6 +4117,25 @@ void tst_QGraphicsItem::sceneEventFilter() QCOMPARE(tester->filteredEventReceivers.at(6), static_cast<QGraphicsItem *>(text2)); QVERIFY(text2->hasFocus()); + + //Let check if the items are correctly removed from the sceneEventFilters array + //to avoid stale pointers. + QGraphicsView gv; + QGraphicsScene *anotherScene = new QGraphicsScene; + QGraphicsTextItem *ti = anotherScene->addText("This is a test #1"); + ti->moveBy(50, 50); + QGraphicsTextItem *ti2 = anotherScene->addText("This is a test #2"); + QGraphicsTextItem *ti3 = anotherScene->addText("This is a test #3"); + gv.setScene(anotherScene); + gv.show(); + QTest::qWait(250); + ti->installSceneEventFilter(ti2); + ti3->installSceneEventFilter(ti); + delete ti2; + //we souldn't crash + QTest::mouseMove(gv.viewport(), gv.mapFromScene(ti->scenePos())); + QTest::qWait(250); + delete ti; } class GeometryChanger : public QGraphicsItem @@ -5152,6 +5269,39 @@ void tst_QGraphicsItem::task240400_clickOnTextItem() QCOMPARE(item->textCursor().columnNumber(), 0); } +class TextItem : public QGraphicsSimpleTextItem +{ +public: + TextItem(const QString& text) : QGraphicsSimpleTextItem(text) + { + updates = 0; + } + + void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) + { + updates++; + QGraphicsSimpleTextItem::paint(painter, option, widget); + } + + int updates; +}; + +void tst_QGraphicsItem::ensureUpdateOnTextItem() +{ + QGraphicsScene scene; + TextItem *text1 = new TextItem(QLatin1String("123")); + scene.addItem(text1); + QGraphicsView view(&scene); + view.show(); + QTest::qWait(250); + QCOMPARE(text1->updates,1); + + //same bouding rect but we have to update + text1->setText(QLatin1String("321")); + QTest::qWait(250); + QCOMPARE(text1->updates,2); +} + void tst_QGraphicsItem::task243707_addChildBeforeParent() { // Task reports that adding the child before the parent leads to an @@ -5877,8 +6027,16 @@ void tst_QGraphicsItem::cacheMode() QCOMPARE(tester->repaints, 12); QCOMPARE(testerChild->repaints, 10); QCOMPARE(testerChild2->repaints, 5); + + // Hiding and showing should invalidate the cache + tester->hide(); + QTest::qWait(250); + tester->show(); + QTest::qWait(250); + QCOMPARE(tester->repaints, 13); + QCOMPARE(testerChild->repaints, 11); + QCOMPARE(testerChild2->repaints, 6); } QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -#endif diff --git a/tests/auto/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp b/tests/auto/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp index d43d0ae..6d20716 100644 --- a/tests/auto/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp +++ b/tests/auto/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp @@ -42,12 +42,7 @@ #include <QtTest/QtTest> -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include <qgraphicsitemanimation.h> - #include <QtCore/qtimeline.h> #include <QtGui/qmatrix.h> @@ -195,4 +190,3 @@ void tst_QGraphicsItemAnimation::setTimeLine() QTEST_MAIN(tst_QGraphicsItemAnimation) #include "tst_qgraphicsitemanimation.moc" -#endif diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index d1d1857..b99f111 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1475,7 +1475,7 @@ void tst_QGraphicsProxyWidget::scrollUpdate() view.paintEventRegion = QRegion(); view.npaints = 0; QTimer::singleShot(0, widget, SLOT(updateScroll())); - QTest::qWait(500); + QTest::qWait(500); QCOMPARE(view.npaints, 2); // QRect(0, 0, 200, 12) is the first update, expanded (-2, -2, 2, 2) // QRect(0, 12, 102, 10) is the scroll update, expanded (-2, -2, 2, 2), @@ -2582,7 +2582,7 @@ void tst_QGraphicsProxyWidget::childPos() { #ifdef Q_OS_IRIX QSKIP("This test is not reliable on IRIX.", SkipAll); -#endif +#endif QFETCH(bool, moveCombo); QFETCH(QPoint, comboPos); QFETCH(QPointF, proxyPos); @@ -2797,6 +2797,7 @@ void tst_QGraphicsProxyWidget::palettePropagation() void tst_QGraphicsProxyWidget::fontPropagation() { // Construct a font with an unlikely setup + QGraphicsScene scene; QFont lineEditFont = QApplication::font("QLineEdit"); QFont font = lineEditFont; font.setPointSize(43); @@ -2805,6 +2806,7 @@ void tst_QGraphicsProxyWidget::fontPropagation() QGraphicsProxyWidget proxy; proxy.setWidget(edit); + scene.addItem(&proxy); EventSpy editSpy(edit); EventSpy proxySpy(&proxy); @@ -2825,6 +2827,7 @@ void tst_QGraphicsProxyWidget::fontPropagation() // Proxy to widget proxy.setFont(font); + QApplication::processEvents(); // wait for QEvent::Polish QVERIFY(proxy.testAttribute(Qt::WA_SetFont)); QCOMPARE(editSpy.counts[QEvent::FontChange], 3); QCOMPARE(proxySpy.counts[QEvent::FontChange], 1); @@ -2893,7 +2896,7 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget() edit2->setText("QLineEdit 2"); QCheckBox *checkbox = new QCheckBox("QCheckBox"); QVBoxLayout *vlayout = new QVBoxLayout; - + vlayout->addWidget(edit1); vlayout->addWidget(edit2); vlayout->addWidget(checkbox); @@ -2916,7 +2919,7 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget() QVERIFY(window.graphicsProxyWidget() == 0); QVERIFY(checkbox->graphicsProxyWidget() == 0); - + QGraphicsProxyWidget *windowProxy = scene.addWidget(&window); QGraphicsView view(&scene); view.show(); @@ -2946,10 +2949,10 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget() QVERIFY(boxProxy->size() == box->size()); QTest::qWait(10); - + QSignalSpy spy(checkbox, SIGNAL(clicked())); - + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(checkboxProxy->mapToScene(QPointF(8,8)))); QTRY_COMPARE(spy.count(), 0); @@ -2958,7 +2961,7 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget() QTRY_COMPARE(spy.count(), 1); - + boxProxy->setWidget(0); QVERIFY(checkbox->graphicsProxyWidget() == 0); @@ -3006,10 +3009,10 @@ void tst_QGraphicsProxyWidget::actionsContextMenu() widget->addAction(new QAction("item 2", widget)); widget->addAction(new QAction("item 3", widget)); widget->setContextMenuPolicy(Qt::ActionsContextMenu); - + QGraphicsScene scene; scene.addWidget(widget); - + QGraphicsView view(&scene); view.show(); #ifdef Q_WS_X11 diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 91ed851..da99c30 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -45,10 +45,6 @@ #include <ceconfig.h> #endif -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include <QtGui> #include <math.h> @@ -245,6 +241,7 @@ private slots: void task139782_containsItemBoundingRect(); void task176178_itemIndexMethodBreaksSceneRect(); void task160653_selectionChanged(); + void task250680_childClip(); }; void tst_QGraphicsScene::initTestCase() @@ -3384,6 +3381,31 @@ void tst_QGraphicsScene::task160653_selectionChanged() QCOMPARE(spy.count(), 1); } +void tst_QGraphicsScene::task250680_childClip() +{ + QGraphicsRectItem *clipper = new QGraphicsRectItem; + clipper->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + clipper->setPen(QPen(Qt::green)); + clipper->setRect(200, 200, 640, 480); + + QGraphicsRectItem *rect = new QGraphicsRectItem(clipper); + rect->setPen(QPen(Qt::red)); + rect->setBrush(QBrush(QColor(255, 0, 0, 75))); + rect->setPos(320, 240); + rect->setRect(-25, -25, 50, 50); + + QGraphicsScene scene; + scene.addItem(clipper); + + QPainterPath path; + path.addRect(-25, -25, 50, 50); + QCOMPARE(rect->clipPath(), path); + + QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); + rect->rotate(45); + QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); +} + void tst_QGraphicsScene::sorting_data() { QTest::addColumn<bool>("cache"); @@ -3563,4 +3585,3 @@ void tst_QGraphicsScene::stickyFocus() QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" -#endif diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 4368e76..b5af115 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -42,10 +42,6 @@ #include <QtTest/QtTest> -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include <qgraphicsitem.h> #include <qgraphicsscene.h> #include <qgraphicssceneevent.h> @@ -155,6 +151,8 @@ private slots: void fitInView(); void itemsAtPoint(); void itemsInRect(); + void itemsInRect_cosmeticAdjust_data(); + void itemsInRect_cosmeticAdjust(); void itemsInPoly(); void itemsInPath(); void itemAt(); @@ -1310,6 +1308,65 @@ void tst_QGraphicsView::itemsInRect() QCOMPARE(items.takeFirst()->zValue(), qreal(3)); } +class CountPaintItem : public QGraphicsRectItem +{ +public: + int numPaints; + + CountPaintItem(const QRectF &rect) + : QGraphicsRectItem(rect), numPaints(0) + { } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + { + ++numPaints; + QGraphicsRectItem::paint(painter, option, widget); + } +}; + +void tst_QGraphicsView::itemsInRect_cosmeticAdjust_data() +{ + QTest::addColumn<QRect>("updateRect"); + QTest::addColumn<int>("numPaints"); + + QTest::newRow("nil") << QRect() << 1; + QTest::newRow("0, 0, 300, 100") << QRect(0, 0, 300, 100) << 1; + QTest::newRow("0, 0, 100, 300") << QRect(0, 0, 100, 300) << 1; + QTest::newRow("200, 0, 100, 300") << QRect(200, 0, 100, 300) << 1; + QTest::newRow("0, 200, 300, 100") << QRect(0, 200, 300, 100) << 1; + QTest::newRow("0, 0, 300, 99") << QRect(0, 0, 300, 99) << 0; + QTest::newRow("0, 0, 99, 300") << QRect(0, 0, 99, 300) << 0; + QTest::newRow("201, 0, 99, 300") << QRect(201, 0, 99, 300) << 0; + QTest::newRow("0, 201, 300, 99") << QRect(0, 201, 300, 99) << 0; +} + +void tst_QGraphicsView::itemsInRect_cosmeticAdjust() +{ + QFETCH(QRect, updateRect); + QFETCH(int, numPaints); + + QGraphicsScene scene(-100, -100, 200, 200); + CountPaintItem *rect = new CountPaintItem(QRectF(-50, -50, 100, 100)); + scene.addItem(rect); + + QGraphicsView view(&scene); + view.setFrameStyle(0); + view.resize(300, 300); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(125); + + rect->numPaints = 0; + if (updateRect.isNull()) + view.viewport()->update(); + else + view.viewport()->update(updateRect); + qApp->processEvents(); + QCOMPARE(rect->numPaints, numPaints); +} + void tst_QGraphicsView::itemsInPoly() { QGraphicsScene scene; @@ -2989,4 +3046,3 @@ void tst_QGraphicsView::centerOnDirtyItem() QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" -#endif diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 86d1acb..f25a079 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -259,6 +259,35 @@ void tst_QGraphicsWidget::cleanup() { } +class SizeHinter : public QGraphicsWidget +{ +public: + SizeHinter(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0, + const QSizeF &min = QSizeF(5,5), + const QSizeF &pref = QSizeF(50, 50), + const QSizeF &max = QSizeF(500, 500)) + : QGraphicsWidget(parent, wFlags) + { + m_sizes[Qt::MinimumSize] = min; + m_sizes[Qt::PreferredSize] = pref; + m_sizes[Qt::MaximumSize] = max; + + } + void setSizeHint(Qt::SizeHint which, const QSizeF &newSizeHint) + { + m_sizes[which] = newSizeHint; + } + +protected: + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const + { + Q_UNUSED(constraint); + return m_sizes[which]; + } +private: + QSizeF m_sizes[4]; +}; + void tst_QGraphicsWidget::qgraphicswidget() { SubQGraphicsWidget widget; @@ -282,6 +311,12 @@ void tst_QGraphicsWidget::qgraphicswidget() QCOMPARE(widget.type(), (int)QGraphicsWidget::Type); QCOMPARE(widget.call_propertyChange(QString(), QVariant()), QVariant()); widget.call_sizeHint(Qt::PreferredSize, QSizeF()); + + QGraphicsScene scene; + QGraphicsWidget *parent = new QGraphicsWidget; + SizeHinter *child = new SizeHinter(parent); + + QCOMPARE(child->minimumSize(), QSizeF(5, 5)); } void tst_QGraphicsWidget::activation() @@ -1516,35 +1551,6 @@ enum WhichSize { None, }; -class SizeHinter : public QGraphicsWidget -{ -public: - SizeHinter(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0, - const QSizeF &min = QSizeF(5,5), - const QSizeF &pref = QSizeF(50, 50), - const QSizeF &max = QSizeF(500, 500)) - : QGraphicsWidget(parent, wFlags) - { - m_sizes[Qt::MinimumSize] = min; - m_sizes[Qt::PreferredSize] = pref; - m_sizes[Qt::MaximumSize] = max; - - } - void setSizeHint(Qt::SizeHint which, const QSizeF &newSizeHint) - { - m_sizes[which] = newSizeHint; - } - -protected: - QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const - { - Q_UNUSED(constraint); - return m_sizes[which]; - } -private: - QSizeF m_sizes[4]; -}; - typedef QPair<int, QVariant> Inst; Q_DECLARE_METATYPE(Inst) diff --git a/tests/auto/qhash/tst_qhash.cpp b/tests/auto/qhash/tst_qhash.cpp index 9343504..f300eec 100644 --- a/tests/auto/qhash/tst_qhash.cpp +++ b/tests/auto/qhash/tst_qhash.cpp @@ -39,16 +39,10 @@ ** ****************************************************************************/ - #include <QtTest/QtTest> - -#if QT_VERSION >= 0x040000 #include <qhash.h> #include <qmap.h> -#endif - - //TESTED_CLASS= //TESTED_FILES= @@ -65,7 +59,7 @@ private slots: void insert1(); void erase(); void key(); - + void count(); // copied from tst_QMap void clear(); // copied from tst_QMap void empty(); // copied from tst_QMap @@ -80,9 +74,7 @@ private slots: void qmultihash_specific(); void compare(); -#if QT_VERSION > 0x040100 void compare2(); -#endif // QT_VERSION void iterators(); // sligthly modified from tst_QMap void keys_values_uniqueKeys(); // slightly modified from tst_QMap void noNeedlessRehashes(); @@ -799,7 +791,6 @@ void tst_QHash::compare() QVERIFY(hash1 != hash2); } -#if QT_VERSION > 0x040100 void tst_QHash::compare2() { QHash<int, int> a; @@ -838,7 +829,6 @@ void tst_QHash::compare2() QVERIFY(!(a == b)); QVERIFY(!(b == a)); } -#endif // QT_VERSION //sligthly modified from tst_QMap void tst_QHash::iterators() @@ -996,9 +986,6 @@ void tst_QHash::rehash_isnt_quadratic() class Bar { public: -#if QT_VERSION < 0x040100 - Bar() : j(0) {} -#endif Bar(int i) : j(i) {} int j; @@ -1180,37 +1167,27 @@ QList<T> sorted(const QList<T> &list) void tst_QHash::keys_values_uniqueKeys() { QHash<QString, int> hash; -#if QT_VERSION >= 0x040200 QVERIFY(hash.uniqueKeys().isEmpty()); -#endif QVERIFY(hash.keys().isEmpty()); QVERIFY(hash.values().isEmpty()); hash.insertMulti("alpha", 1); QVERIFY(sorted(hash.keys()) == (QList<QString>() << "alpha")); -#if QT_VERSION >= 0x040200 QVERIFY(hash.keys() == hash.uniqueKeys()); -#endif QVERIFY(hash.values() == (QList<int>() << 1)); hash.insertMulti("beta", -2); QVERIFY(sorted(hash.keys()) == (QList<QString>() << "alpha" << "beta")); -#if QT_VERSION >= 0x040200 QVERIFY(hash.keys() == hash.uniqueKeys()); -#endif QVERIFY(sorted(hash.values()) == sorted(QList<int>() << 1 << -2)); hash.insertMulti("alpha", 2); -#if QT_VERSION >= 0x040200 QVERIFY(sorted(hash.uniqueKeys()) == (QList<QString>() << "alpha" << "beta")); -#endif QVERIFY(sorted(hash.keys()) == (QList<QString>() << "alpha" << "alpha" << "beta")); QVERIFY(sorted(hash.values()) == sorted(QList<int>() << 2 << 1 << -2)); hash.insertMulti("beta", 4); -#if QT_VERSION >= 0x040200 QVERIFY(sorted(hash.uniqueKeys()) == (QList<QString>() << "alpha" << "beta")); -#endif QVERIFY(sorted(hash.keys()) == (QList<QString>() << "alpha" << "alpha" << "beta" << "beta")); QVERIFY(sorted(hash.values()) == sorted(QList<int>() << 2 << 1 << 4 << -2)); } diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index 3a7698b..0c5bc59 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -305,7 +305,7 @@ void tst_QHostInfo::reverseLookup_data() // ### Use internal DNS instead. Discussed with Andreas. //QTest::newRow("classical.hexago.com") << QString("2001:5c0:0:2::24") << QStringList(QString("classical.hexago.com")) << 0; - QTest::newRow("www.cisco.com") << QString("198.133.219.25") << QStringList(QString("www.cisco.com")) << 0; + QTest::newRow("www.cisco.com") << QString("198.133.219.25") << QStringList(QString("origin-www.cisco.com")) << 0; QTest::newRow("bogusexample.doenstexist.org") << QString("1::2::3::4") << QStringList() << 1; } diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp index e4a798e..46bd8cd 100644 --- a/tests/auto/qhttp/tst_qhttp.cpp +++ b/tests/auto/qhttp/tst_qhttp.cpp @@ -253,11 +253,9 @@ void tst_QHttp::constructing() } -#if QT_VERSION >= 0x040102 { QHttpResponseHeader header(200); } -#endif } void tst_QHttp::invalidRequests() diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 88d6a27..b22397f 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -495,6 +495,8 @@ void tst_QHttpNetworkConnection::get401_data() QTest::newRow("no-credentials") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << false << "" << ""<<401; QTest::newRow("invalid-credentials") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << true << "test" << "test"<<401; QTest::newRow("valid-credentials") << "http://" << QtNetworkSettings::serverName() << "/qtest/rfcs-auth/index.html" << ushort(80) << false << true << "httptest" << "httptest"<<200; + QTest::newRow("digest-authentication-invalid") << "http://" << QtNetworkSettings::serverName() << "/qtest/auth-digest/index.html" << ushort(80) << false << true << "wrong" << "wrong"<<401; + QTest::newRow("digest-authentication-valid") << "http://" << QtNetworkSettings::serverName() << "/qtest/auth-digest/index.html" << ushort(80) << false << true << "httptest" << "httptest"<<200; } void tst_QHttpNetworkConnection::get401() diff --git a/tests/auto/qicoimageformat/tst_qticoimageformat.cpp b/tests/auto/qicoimageformat/tst_qticoimageformat.cpp index 9fca6df..7d7f4ac 100644 --- a/tests/auto/qicoimageformat/tst_qticoimageformat.cpp +++ b/tests/auto/qicoimageformat/tst_qticoimageformat.cpp @@ -264,42 +264,35 @@ void tst_QtIcoImageFormat::nextImageDelay_data() { QTest::addColumn<QString>("fileName"); QTest::addColumn<int>("count"); - QTest::addColumn<int>("delay"); - - QTest::newRow("floppy (16px,32px - 16 colors)") << "valid/35FLOPPY.ICO" << 2 << 0; - QTest::newRow("16px,32px,48px - 256,16M colors") << "valid/abcardWindow.ico" << 6 << 0; - QTest::newRow("16px - 16 colors") << "valid/App.ico" << 1 << 0; - QTest::newRow("16px,32px,48px - 16,256,16M colors") << "valid/Obj_N2_Internal_Mem.ico" << 9 << 0; - QTest::newRow("16px - 16,256,16M colors") << "valid/Status_Play.ico" << 3 << 0; - QTest::newRow("16px,32px - 16 colors") << "valid/TIMER01.ICO" << 2 << 0; - QTest::newRow("16px16c, 32px32c, 32px256c") << "valid/WORLD.ico" << 3 << 0; - QTest::newRow("16px16c, 32px32c, 32px256c") << "valid/WORLDH.ico" << 3 << 0; - QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << -1 << -1; - QTest::newRow("includes 32BPP w/alpha") << "valid/semitransparent.ico" << 9 << 0; + + QTest::newRow("floppy (16px,32px - 16 colors)") << "valid/35FLOPPY.ICO" << 2; + QTest::newRow("16px,32px,48px - 256,16M colors") << "valid/abcardWindow.ico" << 6; + QTest::newRow("16px - 16 colors") << "valid/App.ico" << 1; + QTest::newRow("16px,32px,48px - 16,256,16M colors") << "valid/Obj_N2_Internal_Mem.ico" << 9; + QTest::newRow("16px - 16,256,16M colors") << "valid/Status_Play.ico" << 3; + QTest::newRow("16px,32px - 16 colors") << "valid/TIMER01.ICO" << 2; + QTest::newRow("16px16c, 32px32c, 32px256c") << "valid/WORLD.ico" << 3; + QTest::newRow("16px16c, 32px32c, 32px256c") << "valid/WORLDH.ico" << 3; + QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << -1; + QTest::newRow("includes 32BPP w/alpha") << "valid/semitransparent.ico" << 9; } void tst_QtIcoImageFormat::nextImageDelay() { QFETCH(QString, fileName); QFETCH(int, count); - QFETCH(int, delay); - -#if QT_VERSION > 0x040001 - delay = 0; -#endif QImageReader reader(m_IconPath + "/" + fileName); if (count == -1) { - QCOMPARE(reader.nextImageDelay(), delay); - + QCOMPARE(reader.nextImageDelay(), 0); } else { int i; for (i = 0; i < count; i++) { - QVERIFY(reader.jumpToImage(i)); - QCOMPARE(reader.nextImageDelay(), delay); + QCOMPARE(reader.nextImageDelay(), 0); } } } + QTEST_MAIN(tst_QtIcoImageFormat) #include "tst_qticoimageformat.moc" diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp index 7e515a5..4e9a880 100644 --- a/tests/auto/qicon/tst_qicon.cpp +++ b/tests/auto/qicon/tst_qicon.cpp @@ -186,10 +186,8 @@ void tst_QIcon::actualSize2() QFETCH(QSize, argument); QFETCH(QSize, result); -#if QT_VERSION >= 0x040200 QCOMPARE(icon.actualSize(argument), result); QCOMPARE(icon.pixmap(argument).size(), result); -#endif } void tst_QIcon::svgActualSize() diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 132e373..ee4ece2 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -95,9 +95,8 @@ private slots: void rotate_data(); void rotate(); -#if QT_VERSION >= 0x040102 void copy(); -#endif + void setPixel_data(); void setPixel(); @@ -974,7 +973,6 @@ void tst_QImage::rotate() QCOMPARE(original, dest); } -#if QT_VERSION >= 0x040102 void tst_QImage::copy() { // Task 99250 @@ -983,7 +981,6 @@ void tst_QImage::copy() img.copy(QRect(1000,1,1,1)); } } -#endif void tst_QImage::setPixel_data() { diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index e256227..3841111 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -128,30 +128,22 @@ private slots: void physicalDpi_data(); void physicalDpi(); -#if QT_VERSION > 0x040100 void sizeBeforeRead_data(); void sizeBeforeRead(); -#endif -#if QT_VERSION > 0x040400 void imageFormatBeforeRead_data(); void imageFormatBeforeRead(); -#endif #if defined QTEST_HAVE_GIF void gifHandlerBugs(); #endif -#if QT_VERSION >= 0x040200 void readCorruptImage_data(); void readCorruptImage(); -#endif void readCorruptBmp(); -#if QT_VERSION >= 0x040200 void supportsOption_data(); void supportsOption(); -#endif #if defined QTEST_HAVE_TIFF void tiffCompression_data(); @@ -210,9 +202,7 @@ void tst_QImageReader::readImage_data() QTest::newRow("BMP: 4bpp RLE") << QString("4bpp-rle.bmp") << true << QByteArray("bmp"); QTest::newRow("BMP: 4bpp uncompressed") << QString("tst7.bmp") << true << QByteArray("bmp"); QTest::newRow("BMP: 16bpp") << QString("16bpp.bmp") << true << QByteArray("bmp"); -#if QT_VERSION >= 0x040200 QTest::newRow("BMP: negative height") << QString("negativeheight.bmp") << true << QByteArray("bmp"); -#endif QTest::newRow("XPM: marble") << QString("marble.xpm") << true << QByteArray("xpm"); QTest::newRow("PNG: kollada") << QString("kollada.png") << true << QByteArray("png"); QTest::newRow("PPM: teapot") << QString("teapot.ppm") << true << QByteArray("ppm"); @@ -604,7 +594,6 @@ void tst_QImageReader::supportsAnimation() QCOMPARE(io.supportsAnimation(), success); } -#if QT_VERSION > 0x040100 void tst_QImageReader::sizeBeforeRead_data() { imageFormat_data(); @@ -627,9 +616,7 @@ void tst_QImageReader::sizeBeforeRead() QVERIFY(!image.isNull()); QCOMPARE(size, image.size()); } -#endif // QT_VERSION -#if QT_VERSION > 0x040400 void tst_QImageReader::imageFormatBeforeRead_data() { imageFormat_data(); @@ -649,7 +636,6 @@ void tst_QImageReader::imageFormatBeforeRead() QCOMPARE(image.format(), fileFormat); } } -#endif #if defined QTEST_HAVE_GIF void tst_QImageReader::gifHandlerBugs() @@ -662,7 +648,6 @@ void tst_QImageReader::gifHandlerBugs() QVERIFY(count == 34); } -#if QT_VERSION >= 0x040102 // Task 95166 { QImageReader io1("images/bat1.gif"); @@ -675,9 +660,7 @@ void tst_QImageReader::gifHandlerBugs() QVERIFY(!im2.isNull()); QCOMPARE(im1, im2); } -#endif -#if QT_VERSION >= 0x040104 // Task 9994 { QImageReader io1("images/noclearcode.gif"); @@ -687,7 +670,6 @@ void tst_QImageReader::gifHandlerBugs() QVERIFY(!im1.isNull()); QVERIFY(!im2.isNull()); QCOMPARE(im1.convertToFormat(QImage::Format_ARGB32), im2.convertToFormat(QImage::Format_ARGB32)); } -#endif } #endif @@ -872,11 +854,7 @@ void tst_QImageReader::readFromFileAfterJunk() QVERIFY(!imageData.isNull()); int iterations = 10; -#if QT_VERSION < 0x040200 - if (format == "ppm" || format == "pbm" || format == "pgm" || format == "xpm" || format == "jpeg") -#else if (format == "ppm" || format == "pbm" || format == "pgm") -#endif iterations = 1; if (format == "mng" || !QImageWriter::supportedImageFormats().contains(format)) { @@ -1175,7 +1153,6 @@ void tst_QImageReader::readFromResources() QCOMPARE(QImageReader(fileName).read(), QImageReader(":/" + fileName).read()); } -#if QT_VERSION >= 0x040200 void tst_QImageReader::readCorruptImage_data() { QTest::addColumn<QString>("fileName"); @@ -1203,6 +1180,7 @@ void tst_QImageReader::readCorruptImage_data() QTest::newRow("corrupt tiff") << QString("images/corrupt-data.tif") << true << QString(""); #endif } + void tst_QImageReader::readCorruptImage() { QFETCH(QString, fileName); @@ -1214,14 +1192,12 @@ void tst_QImageReader::readCorruptImage() QVERIFY(reader.canRead()); QCOMPARE(reader.read().isNull(), shouldFail); } -#endif // QT_VERSION void tst_QImageReader::readCorruptBmp() { QCOMPARE(QImage("images/tst7.bmp").convertToFormat(QImage::Format_ARGB32_Premultiplied), QImage("images/tst7.png").convertToFormat(QImage::Format_ARGB32_Premultiplied)); } -#if QT_VERSION >= 0x040200 void tst_QImageReader::supportsOption_data() { QTest::addColumn<QString>("fileName"); @@ -1264,7 +1240,6 @@ void tst_QImageReader::supportsOption() foreach (QImageIOHandler::ImageOption option, allOptions) QVERIFY(!reader.supportsOption(option)); } -#endif #if defined QTEST_HAVE_TIFF void tst_QImageReader::tiffCompression_data() diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/qiodevice/tst_qiodevice.cpp index 6a8ff73..03a0665 100644 --- a/tests/auto/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/qiodevice/tst_qiodevice.cpp @@ -67,9 +67,7 @@ private slots: void constructing_QFile(); void read_QByteArray(); void unget(); -#if QT_VERSION >= 0x040100 void peek(); -#endif // QT_VERSION void getch(); void putch(); @@ -310,7 +308,6 @@ void tst_QIODevice::unget() } //-------------------------------------------------------------------- -#if QT_VERSION >= 0x040100 void tst_QIODevice::peek() { QBuffer buffer; @@ -348,7 +345,6 @@ void tst_QIODevice::peek() } QFile::remove("peektestfile"); } -#endif // QT_VERSION void tst_QIODevice::getch() { @@ -441,7 +437,6 @@ void tst_QIODevice::readLine() result = buffer.readLine(line.data(), linelen + 1); QCOMPARE(result, linelen); -#if QT_VERSION >= 0x0402000 // try with a line length limit QVERIFY(buffer.seek(0)); line = buffer.readLine(linelen + 100); @@ -451,7 +446,6 @@ void tst_QIODevice::readLine() QVERIFY(buffer.seek(0)); line = buffer.readLine(); QCOMPARE(line.size(), linelen); -#endif } QTEST_MAIN(tst_QIODevice) diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp index befe0eb..27741e0 100644 --- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp @@ -777,6 +777,7 @@ void tst_QItemDelegate::dateTimeEditor() QCOMPARE(timeEditor->time(), time); widget.clearFocus(); + qApp->setActiveWindow(&widget); widget.setFocus(); widget.editItem(item2); diff --git a/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp b/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp index c12c583..aa6939d 100644 --- a/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp +++ b/tests/auto/qitemeditorfactory/tst_qitemeditorfactory.cpp @@ -61,9 +61,6 @@ void tst_QItemEditorFactory::createEditor() void tst_QItemEditorFactory::createCustomEditor() { -#if QT_VERSION < 0x040200 - QSKIP("Needs Qt >= 4.2", SkipAll); -#else QItemEditorFactory editorFactory; QItemEditorCreatorBase *creator = new QStandardItemEditorCreator<QDoubleSpinBox>(); @@ -76,7 +73,6 @@ void tst_QItemEditorFactory::createCustomEditor() QCOMPARE(w->metaObject()->userProperty().type(), QVariant::Double); delete creator; -#endif } QTEST_MAIN(tst_QItemEditorFactory) diff --git a/tests/auto/qitemmodel/modelstotest.cpp b/tests/auto/qitemmodel/modelstotest.cpp index 61fc480..2cd6048 100644 --- a/tests/auto/qitemmodel/modelstotest.cpp +++ b/tests/auto/qitemmodel/modelstotest.cpp @@ -117,13 +117,8 @@ ModelsToTest::ModelsToTest() tests.append(test("QTableModel", ReadWrite, HasData)); tests.append(test("QTableModelEmpty", ReadWrite, Empty)); -#if QT_VERSION >= 0x040200 -#define TABLEFEATURE ReadWrite -#else -#define TABLEFEATURE ReadOnly -#endif - tests.append(test("QTreeModel", TABLEFEATURE, HasData)); - tests.append(test("QTreeModelEmpty", TABLEFEATURE, Empty)); + tests.append(test("QTreeModel", ReadWrite, HasData)); + tests.append(test("QTreeModelEmpty", ReadWrite, Empty)); tests.append(test("QSqlQueryModel", ReadOnly, HasData)); tests.append(test("QSqlQueryModelEmpty", ReadOnly, Empty)); diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp index b248aa8..748bd50 100644 --- a/tests/auto/qitemview/tst_qitemview.cpp +++ b/tests/auto/qitemview/tst_qitemview.cpp @@ -230,19 +230,15 @@ void tst_QItemView::setupWithNoTestData() ViewsToTest testViews; QTest::addColumn<QString>("viewType"); QTest::addColumn<bool>("displays"); -#if QT_VERSION >= 0x040200 QTest::addColumn<int>("vscroll"); QTest::addColumn<int>("hscroll"); -#endif for (int i = 0; i < testViews.tests.size(); ++i) { QString view = testViews.tests.at(i).viewType; QString test = view + " ScrollPerPixel"; bool displayIndexes = (testViews.tests.at(i).display == ViewsToTest::DisplayRoot); QTest::newRow(test.toLatin1().data()) << view << displayIndexes -#if QT_VERSION >= 0x040200 << (int)QAbstractItemView::ScrollPerPixel << (int)QAbstractItemView::ScrollPerPixel -#endif ; } for (int i = 0; i < testViews.tests.size(); ++i) { @@ -250,10 +246,8 @@ void tst_QItemView::setupWithNoTestData() QString test = view + " ScrollPerItem"; bool displayIndexes = (testViews.tests.at(i).display == ViewsToTest::DisplayRoot); QTest::newRow(test.toLatin1().data()) << view << displayIndexes -#if QT_VERSION >= 0x040200 << (int)QAbstractItemView::ScrollPerItem << (int)QAbstractItemView::ScrollPerItem -#endif ; } } @@ -296,19 +290,17 @@ void tst_QItemView::nonDestructiveBasicTest() #ifdef Q_OS_IRIX QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif - + #ifdef Q_OS_WINCE QTest::qWait(400); #endif QFETCH(QString, viewType); view = testViews->createView(viewType); -#if QT_VERSION >= 0x040200 QFETCH(int, vscroll); QFETCH(int, hscroll); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); -#endif // setSelectionModel() will assert //view->setSelectionModel(0); @@ -461,12 +453,10 @@ void tst_QItemView::spider() #endif QFETCH(QString, viewType); view = testViews->createView(viewType); -#if QT_VERSION >= 0x040200 QFETCH(int, vscroll); QFETCH(int, hscroll); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); -#endif view->setModel(treeModel); view->show(); #if defined(Q_OS_WINCE) @@ -498,12 +488,10 @@ void tst_QItemView::resize() // doesn't really catch theproblem. QFETCH(QString, viewType); view = testViews->createView(viewType); -#if QT_VERSION >= 0x040200 QFETCH(int, vscroll); QFETCH(int, hscroll); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); -#endif view->setModel(treeModel); view->show(); @@ -528,12 +516,10 @@ void tst_QItemView::visualRect() #endif QFETCH(QString, viewType); view = testViews->createView(viewType); -#if QT_VERSION >= 0x040200 QFETCH(int, vscroll); QFETCH(int, hscroll); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); -#endif QCOMPARE(view->visualRect(QModelIndex()), QRect()); // Add model @@ -664,12 +650,10 @@ void tst_QItemView::indexAt() #endif QFETCH(QString, viewType); view = testViews->createView(viewType); -#if QT_VERSION >= 0x040200 QFETCH(int, vscroll); QFETCH(int, hscroll); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); -#endif view->show(); view->setModel(treeModel); #if 0 @@ -700,12 +684,10 @@ void tst_QItemView::scrollTo() #endif QFETCH(QString, viewType); view = testViews->createView(viewType); -#if QT_VERSION >= 0x040200 QFETCH(int, vscroll); QFETCH(int, hscroll); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); -#endif view->setModel(treeModel); view->show(); diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp index 33de82a..8fcee36 100644 --- a/tests/auto/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp @@ -181,9 +181,7 @@ void tst_QKeySequence::operatorQString_data() #ifndef Q_WS_MAC QTest::newRow( "Ctrl+Left" ) << int(Qt::CTRL) << int(Qt::Key_Left) << QString( "Ctrl+Left" ); -#if QT_VERSION > 0x040100 QTest::newRow( "Ctrl+," ) << int(Qt::CTRL) << int(Qt::Key_Comma) << QString( "Ctrl+," ); -#endif QTest::newRow( "Alt+Left" ) << int(Qt::ALT) << int(Qt::Key_Left) << QString( "Alt+Left" ); QTest::newRow( "Alt+Shift+Left" ) << int(Qt::ALT | Qt::SHIFT) << int(Qt::Key_Left) << QString( "Alt+Shift+Left" ); QTest::newRow( "Ctrl" ) << int(Qt::CTRL) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString( "Ctrl+\x0c5" ); @@ -192,9 +190,7 @@ void tst_QKeySequence::operatorQString_data() QTest::newRow( "Meta" ) << int(Qt::META) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString( "Meta+\x0c5" ); #else QTest::newRow( "Ctrl+Left" ) << int(Qt::CTRL) << int(Qt::Key_Left) << MacCtrl + macSymbolForQtKey(Qt::Key_Left); -#if QT_VERSION > 0x040100 QTest::newRow( "Ctrl+," ) << int(Qt::CTRL) << int(Qt::Key_Comma) << MacCtrl + ","; -#endif QTest::newRow( "Alt+Left" ) << int(Qt::ALT) << int(Qt::Key_Left) << MacAlt + macSymbolForQtKey(Qt::Key_Left); QTest::newRow( "Alt+Shift+Left" ) << int(Qt::ALT | Qt::SHIFT) << int(Qt::Key_Left) << MacAlt + MacShift + macSymbolForQtKey(Qt::Key_Left); QTest::newRow( "Ctrl" ) << int(Qt::CTRL) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << MacCtrl + "\x0c5"; @@ -385,10 +381,8 @@ void tst_QKeySequence::toString_data() QTest::newRow("Shift") << QString("Shift+\x0c5") << QString("Shift+\x0c5") << QString("Shift+\x0c5"); QTest::newRow("Meta") << QString("Meta+\x0c5") << QString("Meta+\x0c5") << QString("Meta+\x0c5"); QTest::newRow("Ctrl+Plus") << QString("Ctrl++") << QString("Ctrl++") << QString("Ctrl++"); -#if QT_VERSION > 0x040100 QTest::newRow("Ctrl+,") << QString("Ctrl+,") << QString("Ctrl+,") << QString("Ctrl+,"); QTest::newRow("Ctrl+,,Ctrl+,") << QString("Ctrl+,,Ctrl+,") << QString("Ctrl+,, Ctrl+,") << QString("Ctrl+,, Ctrl+,"); -#endif QTest::newRow("MultiKey") << QString("Alt+X, Ctrl+Y, Z") << QString("Alt+X, Ctrl+Y, Z") << QString("Alt+X, Ctrl+Y, Z"); @@ -406,10 +400,8 @@ void tst_QKeySequence::toString_data() QTest::newRow("Shift") << MacShift + "\x0c5" << QString("Shift+\x0c5") << MacShift + "\x0c5"; QTest::newRow("Meta") << MacMeta + "\x0c5" << QString("Meta+\x0c5") << MacMeta + "\x0c5"; QTest::newRow("Ctrl+Plus") << MacCtrl + "+" << QString("Ctrl++") << MacCtrl + "+"; -#if QT_VERSION > 0x040100 QTest::newRow("Ctrl+,") << MacCtrl + "," << QString("Ctrl+,") << MacCtrl + ","; QTest::newRow("Ctrl+,,Ctrl+,") << MacCtrl + ",, " + MacCtrl + "," << QString("Ctrl+,, Ctrl+,") << MacCtrl + ",, " + MacCtrl + ","; -#endif QTest::newRow("MultiKey") << MacAlt + "X, " + MacCtrl + "Y, Z" << QString("Alt+X, Ctrl+Y, Z") << MacAlt + "X, " + MacCtrl + "Y, Z"; QTest::newRow("Invalid") << QString("Ctrly") << QString("") << QString(""); diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index 1783a3d..4580236 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -263,10 +263,8 @@ void tst_QLabel::setTextFormat() testWidget->setTextFormat( Qt::RichText ); QVERIFY( testWidget->textFormat() == Qt::RichText ); -#if QT_VERSION >= 0x030100 testWidget->setTextFormat( Qt::LogText ); QVERIFY( testWidget->textFormat() == Qt::LogText ); -#endif testWidget->setTextFormat( Qt::AutoText ); QVERIFY( testWidget->textFormat() == Qt::AutoText ); diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp index dea0c54e..3e7e3f3 100644 --- a/tests/auto/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/qlibrary/tst_qlibrary.cpp @@ -187,7 +187,7 @@ void tst_QLibrary::version() QFETCH( int, loadversion ); QFETCH( int, resultversion ); -#if QT_VERSION >= 0x040200 && !defined(Q_OS_AIX) && !defined(Q_OS_WIN) +#if !defined(Q_OS_AIX) && !defined(Q_OS_WIN) QString currDir = QDir::currentPath(); QLibrary library( currDir + QLatin1Char('/') + lib, loadversion ); bool ok = library.load(); @@ -218,7 +218,6 @@ void tst_QLibrary::load_data() QTest::newRow("ok (libmylib ver. 1)") << currDir + "/libmylib" <<(bool)true; #endif -#if QT_VERSION >= 0x040103 # if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) QTest::newRow( "ok01 (with suffix)" ) << currDir + "/mylib.dll" << (bool)true; QTest::newRow( "ok02 (with non-standard suffix)" ) << currDir + "/mylib.dl2" << (bool)true; @@ -228,7 +227,6 @@ void tst_QLibrary::load_data() QTest::newRow( "ok02 (with non-standard suffix)" ) << currDir + "/libmylib.so2" << (bool)true; QTest::newRow( "ok03 (with non-standard suffix)" ) << currDir + "/system.trolltech.test.mylib.so" << (bool)true; # endif // Q_OS_UNIX -#endif // QT_VERSION } void tst_QLibrary::load() @@ -438,7 +436,7 @@ void tst_QLibrary::loadHints_data() QTest::addColumn<bool>("result"); QLibrary::LoadHints lh; -#if QT_VERSION >= 0x040300 && defined(Q_OS_AIX) +#if defined(Q_OS_AIX) if (QFile::exists("/usr/lib/libGL.a") || QFile::exists("/usr/X11R6/lib/libGL.a")) { # if QT_POINTER_SIZE == 4 QTest::newRow( "ok03 (Archive member)" ) << "libGL.a(shr.o)" << int(QLibrary::LoadArchiveMemberHint) << (bool)TRUE; @@ -446,9 +444,8 @@ void tst_QLibrary::loadHints_data() QTest::newRow( "ok03 (Archive member)" ) << "libGL.a(shr_64.o)" << int(QLibrary::LoadArchiveMemberHint) << (bool)TRUE; #endif } -#endif // QT_VERSION +#endif -#if QT_VERSION >= 0x040103 QString currDir = QDir::currentPath(); lh |= QLibrary::ResolveAllSymbolsHint; # if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) @@ -460,8 +457,6 @@ void tst_QLibrary::loadHints_data() QTest::newRow( "ok02 (with non-standard suffix)" ) << currDir + "/libmylib.so2" << int(lh) << (bool)TRUE; QTest::newRow( "ok03 (with many dots)" ) << currDir + "/system.trolltech.test.mylib.so" << int(lh) << (bool)TRUE; # endif // Q_OS_UNIX -#endif // QT_VERSION - } void tst_QLibrary::loadHints() diff --git a/tests/auto/qline/tst_qline.cpp b/tests/auto/qline/tst_qline.cpp index 932ec8e..ab0bd9b 100644 --- a/tests/auto/qline/tst_qline.cpp +++ b/tests/auto/qline/tst_qline.cpp @@ -201,8 +201,8 @@ void tst_QLine::testIntersection_data() b = b.translated(1, 1); QTest::newRow(qPrintable(QString::fromLatin1("rotation-%0").arg(i))) - << a.x1() << a.y1() << a.x2() << a.y2() - << b.x1() << b.y1() << b.x2() << b.y2() + << (double)a.x1() << (double)a.y1() << (double)a.x2() << (double)a.y2() + << (double)b.x1() << (double)b.y1() << (double)b.x2() << (double)b.y2() << int(QLineF::BoundedIntersection) << 1.0 << 1.0; @@ -232,8 +232,8 @@ void tst_QLine::testIntersection() QCOMPARE(int(itype), type); if (type != QLineF::NoIntersection) { - QCOMPARE(ip.x(), qreal(ix)); - QCOMPARE(ip.y(), qreal(iy)); + QVERIFY(qAbs(ip.x() - ix) < epsilon); + QVERIFY(qAbs(ip.y() - iy) < epsilon); } } diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 87e966f..34a64c8 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -1465,14 +1465,10 @@ void tst_QLineEdit::textMask_data() void tst_QLineEdit::textMask() { -#if (QT_VERSION-0 >= 0x030303) QFETCH( QString, insertString ); testWidget->setInputMask( "#" ); testWidget->setText( insertString ); QCOMPARE( testWidget->text(), insertString ); -#else - QSKIP( "This test function tests a problem with masks that was fixed in 3.3", SkipAll); -#endif } void tst_QLineEdit::setText() diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 5cada02..2e7f412 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -104,6 +104,7 @@ private slots: void emptyItemSize(); void task203585_selectAll(); void task228566_infiniteRelayout(); + void task248430_crashWith0SizedItem(); }; // Testing get/set functions @@ -1517,6 +1518,15 @@ void tst_QListView::task228566_infiniteRelayout() QCOMPARE(spy.count(), 0); } +void tst_QListView::task248430_crashWith0SizedItem() +{ + QListView view; + view.setViewMode(QListView::IconMode); + QStringListModel model(QStringList() << QLatin1String("item1") << QString()); + view.setModel(&model); + view.show(); + QTest::qWait(100); +} QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index 5e3e334..b8f7c22 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -591,6 +591,17 @@ void tst_QLocale::long_long_conversion_data() QTest::newRow("de_DE 12345.67") << QString("de_DE") << "12345.67"<< false << (qlonglong) 0; QTest::newRow("de_DE 123456.7") << QString("de_DE") << "123456.7"<< false << (qlonglong) 0; QTest::newRow("de_DE 1.234.567") << QString("de_DE")<< "1.234.567"<< true << (qlonglong) 1234567; + QTest::newRow("de_DE 1.234.567 ldspcs") << QString("de_DE")<< " 1.234.567" << true << (qlonglong) 1234567; + QTest::newRow("de_DE 1.234.567 trspcs") << QString("de_DE")<< "1.234.567 "<< true << (qlonglong) 1234567; + QTest::newRow("de_DE 1.234.567 ldtrspcs") << QString("de_DE")<< " 1.234.567 "<< true << (qlonglong) 1234567; + + // test that space is also accepted whenever QLocale::groupSeparator() == 0xa0 (which looks like space). + QTest::newRow("nb_NO 123 groupsep") << QString("nb_NO")<< QString("1")+QChar(0xa0)+QString("234") << true << (qlonglong) 1234; + QTest::newRow("nb_NO 123 groupsep_space") << QString("nb_NO")<< QString("1")+QChar(0x20)+QString("234") << true << (qlonglong) 1234; + + QTest::newRow("nb_NO 123 ldspcs") << QString("nb_NO")<< " 123" << true << (qlonglong) 123; + QTest::newRow("nb_NO 123 trspcs") << QString("nb_NO")<< "123 "<< true << (qlonglong) 123; + QTest::newRow("nb_NO 123 ldtrspcs") << QString("nb_NO")<< " 123 "<< true << (qlonglong) 123; QTest::newRow("C 1234") << QString("C") << " 1234" << true << (qlonglong) 1234; QTest::newRow("C 1234 ") << QString("C") << "1234 " << true << (qlonglong) 1234; diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index 4529bd5..b16a62a 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -1039,11 +1039,6 @@ void tst_QMainWindow::toolBarArea() QMainWindow mw; QToolBar tb(&mw); -#if QT_VERSION <= 0x040103 - // this would assert in previous versions - QCOMPARE(mw.toolBarArea(&tb), Qt::ToolBarArea(0)); -#endif - for (int j = 0; j < areaCount; ++j) { Qt::ToolBarArea otherArea = areas[j]; @@ -1205,11 +1200,6 @@ void tst_QMainWindow::dockWidgetArea() QMainWindow mw; QDockWidget dw(&mw); -#if QT_VERSION <= 0x040103 - // this would assert in previous versions - QCOMPARE(mw.dockWidgetArea(&dw), Qt::DockWidgetArea(0)); -#endif - for (int j = 0; j < areaCount; ++j) { Qt::DockWidgetArea otherArea = areas[i]; diff --git a/tests/auto/qmake/qmake.pro b/tests/auto/qmake/qmake.pro index 59cc2be..8cae6be 100644 --- a/tests/auto/qmake/qmake.pro +++ b/tests/auto/qmake/qmake.pro @@ -2,8 +2,6 @@ load(qttest_p4) HEADERS += testcompiler.h SOURCES += tst_qmake.cpp testcompiler.cpp -contains(QT_CONFIG, qt3support): QT += qt3support - cross_compile: DEFINES += QMAKE_CROSS_COMPILED diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp index b1f9955..122a2b8 100644 --- a/tests/auto/qmake/testcompiler.cpp +++ b/tests/auto/qmake/testcompiler.cpp @@ -39,49 +39,37 @@ ** ****************************************************************************/ - #include "testcompiler.h" -#include <stdlib.h> -#include <qapplication.h> - -#ifdef QT3_SUPPORT - -#include <q3process.h> -#include <qtimer.h> -#ifdef Q_OS_WIN32 -# include <windows.h> -#endif -#include <QtTest/QtTest> +#include <QProcess> +#include <QDir> -#undef SHOW_QDEBUG -#undef SHOW_COMPLETENESS - -QString targetName( BuildType buildMode, const QString& target, const QString& version ) +static QString targetName( BuildType buildMode, const QString& target, const QString& version ) { + Q_UNUSED(version); QString targetName = target; #if defined (Q_OS_WIN32) switch (buildMode) { case Exe: // app - targetName.append(".exe"); - break; + targetName.append(".exe"); + break; case Dll: // dll - if (version != "") { - QStringList ver = QStringList::split(".", version); - targetName.append(ver.first()); - } + if (version != "") { + QStringList ver = QStringList::split(".", version); + targetName.append(ver.first()); + } targetName.append(".dll"); - break; + break; case Lib: // lib #ifdef Q_CC_GNU targetName.prepend("lib"); targetName.append(".a"); #else - targetName.append(".lib"); + targetName.append(".lib"); #endif - break; + break; case Plain: // no conversion break; @@ -90,16 +78,16 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v switch (buildMode) { case Exe: // app - targetName += ".app/Contents/MacOS/" + target.section('/', -1); - break; + targetName += ".app/Contents/MacOS/" + target.section('/', -1); + break; case Dll: // dll - targetName.prepend("lib"); + targetName.prepend("lib"); targetName.append("." + version + ".dylib"); - break; + break; case Lib: // lib - targetName.prepend("lib"); - targetName.append(".a"); - break; + targetName.prepend("lib"); + targetName.append(".a"); + break; case Plain: // no conversion break; @@ -108,9 +96,9 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v switch (buildMode) { case Exe: // app - break; + break; case Dll: // dll - targetName.prepend("lib"); + targetName.prepend("lib"); #if defined (Q_OS_HPUX) && !defined (__ia64) targetName.append(".sl"); #elif defined (Q_OS_AIX) @@ -118,11 +106,11 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v #else targetName.append(".so"); #endif - break; + break; case Lib: // lib - targetName.prepend("lib"); - targetName.append(".a"); - break; + targetName.prepend("lib"); + targetName.append(".a"); + break; case Plain: // no conversion break; @@ -131,223 +119,119 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v return targetName; } - - TestCompiler::TestCompiler() { - exit_ok = FALSE; - childProc = 0; - setBaseCommands( "", "", FALSE ); + setBaseCommands( "", "" ); } TestCompiler::~TestCompiler() { - if (childProc) - delete childProc; } -bool TestCompiler::runChild( bool showOutput, QStringList argList, QStringList *envList ) +bool TestCompiler::runCommand( QString cmdline ) { - //qDebug() << "executing" << argList; - exit_ok = FALSE; - if (childProc) - delete childProc; + testOutput_.append("Running command: " + cmdline); - child_show = showOutput; - if ( showOutput ) { + QProcess child; + if (!environment_.empty()) + child.setEnvironment(QProcess::systemEnvironment() + environment_); - QString S = argList.join(" "); - addMakeResult( S ); + child.start(cmdline); + if (!child.waitForStarted(-1)) { + testOutput_.append( "Unable to start child process." ); + return false; } - childProc = new Q3Process(argList, this, argList.join(" ").latin1()); - Q_ASSERT(childProc); - - connect(childProc,SIGNAL(readyReadStdout()),this,SLOT(childHasData())); - connect(childProc,SIGNAL(processExited()),this,SLOT(childReady())); - - if (!childProc->start( envList )) { - - addMakeResult( "Error executing '" + argList[0] + "'." ); - childReady(); - return FALSE; - } - - while (childProc != 0 && childProc->isRunning()) { - qApp->processEvents(); + bool failed = false; + child.setReadChannel(QProcess::StandardError); + while (QProcess::Running == child.state()) { + if (child.waitForReadyRead(1000)) { + QString output = child.readAllStandardError(); + testOutput_.append(output); + + output.prepend('\n'); + if (output.contains("\nProject MESSAGE: FAILED")) + failed = true; + } } - childReady(); + child.waitForFinished(-1); - return exit_ok; + return failed + ? false + : (child.exitStatus() == QProcess::NormalExit) + && (child.exitCode() == 0); } -void TestCompiler::childReady() +void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd ) { - if (childProc != 0) { - childHasData(); - - QString S; - int pos; - while (childProc->canReadLineStderr()) { - S = childProc->readLineStderr(); - do { - pos = S.find("\t"); - if (pos >= 0) { - S.remove(pos,1); - S.insert(pos," "); - } - } while (pos >= 0); - - if (child_show) - addMakeResult( S ); - } - - exit_ok = childProc->normalExit() && childProc->exitStatus() == 0; - delete childProc; - } - childProc = 0; + makeCmd_ = makeCmd; + qmakeCmd_ = qmakeCmd; } -void TestCompiler::childHasData() +void TestCompiler::resetEnvironment() { - QString S; - int pos; - while (childProc->canReadLineStderr()) { - - S = childProc->readLineStderr(); - do { - pos = S.find("\t"); - if (pos >= 0) { - S.remove(pos,1); - S.insert(pos," "); - } - - } while (pos >= 0); - - if ( S.startsWith("Project MESSAGE: FAILED") ) - QTest::qFail( S, __FILE__, __LINE__ ); - else if ( S.startsWith("Project MESSAGE: SKIPPED") ) - QTest::qSkip( S, QTest::SkipSingle, __FILE__, __LINE__ ); - else if (child_show) - addMakeResult( S ); - } + environment_.clear(); } -void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd, bool qwsMode ) +void TestCompiler::addToEnvironment( QString varAssignment ) { - qws_mode = qwsMode; - make_cmd = makeCmd; - - // not sure if i need this, but it doesn't hurt - if (make_cmd.startsWith("\"")) - make_cmd = make_cmd.remove(0,1); - if (make_cmd.endsWith("\"")) - make_cmd = make_cmd.remove(make_cmd.length()-1,1); - - qmake_cmd = qmakeCmd; - // also not sure if i need this, but it doesn't hurt... - if(qmake_cmd.length() >= 2 && (qmake_cmd.at(0) == '"' || qmake_cmd.at(0) == '\'') && qmake_cmd.at(qmake_cmd.length()-1) == qmake_cmd.at(0)) - qmake_cmd = qmake_cmd.mid(1, qmake_cmd.length()-2); -} - -bool TestCompiler::cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt ) -{ - QDir D(workPath); - if (!D.exists()) { - - addMakeResult( "Directory '" + workPath + "' doesn't exist" ); - return FALSE; - } - - D.setCurrent(workPath); - // must delete at least the executable file to be able to easily and safely - // verify that the compilation was a success. - D.remove( destPath + "/" + exeName + exeExt ); - D.remove( workPath + "/Makefile"); - QFileInfo Fi( workPath + "/Makefile"); - if (Fi.exists()) { - - // Run make clean - QStringList args; - args = QStringList::split( " ", make_cmd ); - args.append("clean"); - - return runChild( FALSE, args, 0 ); - } - - return TRUE; + environment_.push_back(varAssignment); } bool TestCompiler::makeClean( const QString &workPath ) { QDir D; if (!D.exists(workPath)) { - - addMakeResult( "Directory '" + workPath + "' doesn't exist" ); - return FALSE; + testOutput_.append( "Directory '" + workPath + "' doesn't exist" ); + return false; } D.setCurrent(workPath); QFileInfo Fi( workPath + "/Makefile"); - if (Fi.exists()) { - - // Run make clean - QStringList args; - args = QStringList::split( " ", make_cmd ); - args.append("clean"); + if (Fi.exists()) + // Run make clean + return runCommand( makeCmd_ + " clean" ); - return runChild( FALSE, args, 0 ); - } - - return TRUE; + return true; } bool TestCompiler::makeDistClean( const QString &workPath ) { QDir D; if (!D.exists(workPath)) { - addMakeResult( "Directory '" + workPath + "' doesn't exist" ); - return FALSE; + testOutput_.append( "Directory '" + workPath + "' doesn't exist" ); + return false; } D.setCurrent(workPath); QFileInfo Fi( workPath + "/Makefile"); - if (Fi.exists()) { - // Run make distclean - QStringList args; - args = QStringList::split( " ", make_cmd ); - args.append("distclean"); - - return runChild( FALSE, args, 0 ); - } + if (Fi.exists()) + // Run make distclean + return runCommand( makeCmd_ + " distclean" ); - return TRUE; + return true; } bool TestCompiler::qmake( const QString &workDir, const QString &proName, const QString &buildDir ) { - // Now start qmake and generate the makefile - - QDir D( workDir ); - // Make sure we start in the right directory + QDir D; D.setCurrent( workDir ); if (D.exists("Makefile")) - D.remove("Makefile"); + D.remove("Makefile"); - QStringList args; - args = QStringList::split( " ", qmake_cmd ); + QString projectFile = proName; + QString makeFile = buildDir; + if (!projectFile.endsWith(".pro")) + projectFile += ".pro"; + if (!makeFile.isEmpty() && !makeFile.endsWith('/')) + makeFile += '/'; + makeFile += "Makefile"; - QString project_fname = workDir + "/" + proName + ".pro"; - QString makefile_fname = (buildDir.isNull()?QString():(buildDir + "/")) + "Makefile"; - - args.append( project_fname ); - args.append( "-o" ); - args.append( makefile_fname ); - - return runChild( TRUE, args, 0 ); + // Now start qmake and generate the makefile + return runCommand( qmakeCmd_ + " " + projectFile + " -o " + makeFile ); } bool TestCompiler::make( const QString &workPath, const QString &target ) @@ -355,20 +239,13 @@ bool TestCompiler::make( const QString &workPath, const QString &target ) QDir D; D.setCurrent( workPath ); - QStringList args; - args = QStringList::split( " ", make_cmd ); - if ( make_cmd.lower().find("nmake") >= 0) - args.append("/NOLOGO"); - if ( !target.isNull() ) - args.append(target); - - bool ok = runChild( TRUE, args, 0 ); + QString cmdline = makeCmd_; + if ( cmdline.contains("nmake", Qt::CaseInsensitive) ) + cmdline.append(" /NOLOGO"); + if ( !target.isEmpty() ) + cmdline += " " + target; - if (!ok) { - QTest::qFail( COMPILE_ERROR, __FILE__, __LINE__ ); - } - - return ok; + return runCommand( cmdline ); } bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version ) @@ -377,20 +254,12 @@ bool TestCompiler::exists( const QString &destDir, const QString &exeName, Build return f.exists(); } -void TestCompiler::addMakeResult( const QString &result ) -{ - make_result.append( result ); -} - bool TestCompiler::removeMakefile( const QString &workPath ) { QDir D; D.setCurrent( workPath ); if ( D.exists( "Makefile" ) ) - return D.remove( "Makefile" ); + return D.remove( "Makefile" ); else - return TRUE; + return true; } - -#endif //QT3_SUPPORT - diff --git a/tests/auto/qmake/testcompiler.h b/tests/auto/qmake/testcompiler.h index 597d440..41e5177 100644 --- a/tests/auto/qmake/testcompiler.h +++ b/tests/auto/qmake/testcompiler.h @@ -41,33 +41,22 @@ #ifndef TESTCOMPILER_H #define TESTCOMPILER_H - -#ifdef QT3_SUPPORT - -#include <qobject.h> -#include <qstringlist.h> - -QT_FORWARD_DECLARE_CLASS(Q3Process) - -#define COMPILE_ERROR "Compile error" -#define COMPILE_SUCCESS "Compile successfull" -#define COMPILE_NOT_AVAIL "Binary not available for testing" -#define SELF_TEST "self-test" +#include <QObject> +#include <QStringList> enum BuildType { Exe, Dll, Lib, Plain }; class TestCompiler : public QObject { -Q_OBJECT + Q_OBJECT public: TestCompiler(); virtual ~TestCompiler(); - void setBaseCommands( QString makeCmd, QString qmakeCmd, bool qwsMode ); - - // builds a complete project, e.g. qmake, make clean, make and exists. - bool buildProject( const QString &project, BuildType buildType, const QString &targetName, const QString &destPath, const QString &version ); + void setBaseCommands( QString makeCmd, QString qmakeCmd ); + void resetEnvironment(); + void addToEnvironment( QString varAssignment ); // executes a make clean in the specified workPath bool makeClean( const QString &workPath ); @@ -77,34 +66,20 @@ public: bool qmake( const QString &workDir, const QString &proName, const QString &buildDir = QString() ); // executes a make in the specified workPath, with an optional target (eg. install) bool make( const QString &workPath, const QString &target = QString() ); - // executes a make clean and then deletes the makefile in workpath + deletes the executable - // in destPath. - bool cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt ); // checks if the executable exists in destDir bool exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version ); // removes the makefile bool removeMakefile( const QString &workPath ); private: - QString make_cmd; - QString qmake_cmd; - - Q3Process *childProc; - QStringList env_list; + bool runCommand( QString cmdLine ); - bool child_show; - bool qws_mode; - bool exit_ok; - -private: - bool runChild( bool showOutput, QStringList argList, QStringList *envList ); - void addMakeResult( const QString &result ); - QStringList make_result; + QString makeCmd_; + QString qmakeCmd_; + QStringList environment_; -private slots: - void childReady(); - void childHasData(); + // need to make this available somewhere + QStringList testOutput_; }; -#endif // QT3_SUPPORT #endif // TESTCOMPILER_H diff --git a/tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro b/tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro new file mode 100644 index 0000000..644a817 --- /dev/null +++ b/tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp + +QWERTY_BUNDLE.version = Bogus.78 +QWERTY_BUNDLE.files = some-file "existing file" "non-existing file" +QWERTY_BUNDLE.path = QwertyData + +QMAKE_BUNDLE_DATA = QWERTY_BUNDLE diff --git a/util/scripts/mac-binary/install/xcode/.build_separate b/tests/auto/qmake/testdata/bundle-spaces/existing file index e69de29..e69de29 100644 --- a/util/scripts/mac-binary/install/xcode/.build_separate +++ b/tests/auto/qmake/testdata/bundle-spaces/existing file diff --git a/tests/auto/qmake/testdata/bundle-spaces/main.cpp b/tests/auto/qmake/testdata/bundle-spaces/main.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/auto/qmake/testdata/bundle-spaces/main.cpp diff --git a/tests/auto/qdir/testdir/dir/Makefile b/tests/auto/qmake/testdata/bundle-spaces/some-file index 9975dba..9975dba 100644 --- a/tests/auto/qdir/testdir/dir/Makefile +++ b/tests/auto/qmake/testdata/bundle-spaces/some-file diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/qmake/testdata/functions/functions.pro index 5ee5f51..9ed92f96 100644 --- a/tests/auto/qmake/testdata/functions/functions.pro +++ b/tests/auto/qmake/testdata/functions/functions.pro @@ -51,15 +51,11 @@ include( infiletest.pro ) message( "FAILED: include function: $$DEFINES" ) } -lessThan(QT_VERSION, 40200) { - message( "SKIPPED: replace function only in 4.2" ) -} else { - #replace - VERSION=1.0.0 - VERSION_replaced=$$replace(VERSION,\.,_) - !isEqual(VERSION_replaced, 1_0_0) { - message( "FAILED: replace function: $$VERSION_replaced" ) - } +#replace +VERSION=1.0.0 +VERSION_replaced=$$replace(VERSION,\.,_) +!isEqual(VERSION_replaced, 1_0_0) { + message( "FAILED: replace function: $$VERSION_replaced" ) } #test functions diff --git a/tests/auto/qmake/testdata/shadow_files_build/README b/tests/auto/qmake/testdata/shadow_files_build/README index 46017fc..15e48c0 100644 --- a/tests/auto/qmake/testdata/shadow_files_build/README +++ b/tests/auto/qmake/testdata/shadow_files_build/README @@ -1 +1 @@ -Here to ensure include_dir_build exists +Here to ensure shadow_files_build exists, used by the shadow_files test. diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp index 4840b42..70f1f3c 100644 --- a/tests/auto/qmake/tst_qmake.cpp +++ b/tests/auto/qmake/tst_qmake.cpp @@ -39,21 +39,13 @@ ** ****************************************************************************/ - -#include <QtTest/QtTest> - -#if !defined(QMAKE_CROSS_COMPILED) && defined(QT3_SUPPORT) - -#include <qdir.h> -#include <qprocess.h> - +#if !defined(QMAKE_CROSS_COMPILED) #include "testcompiler.h" -#include <stdlib.h> - -//TESTED_CLASS= -//TESTED_FILES=corelib/tools/qlocale.h corelib/tools/qlocale.cpp +#include <QObject> +#include <QDir> +#include <QtTest/QtTest> class tst_qmake : public QObject { @@ -63,12 +55,12 @@ public: tst_qmake(); virtual ~tst_qmake(); - public slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); + private slots: void simple_app(); void simple_lib(); @@ -90,6 +82,10 @@ private slots: void one_space(); void findMocs(); void findDeps(); +#ifndef Q_OS_WIN + // Test requires make + void bundle_spaces(); +#endif private: TestCompiler test_compiler; @@ -100,16 +96,16 @@ tst_qmake::tst_qmake() { QString cmd = QString("qmake \"QT_VERSION=%1\"").arg(QT_VERSION); #ifdef Q_CC_MSVC - test_compiler.setBaseCommands( "nmake", cmd, FALSE ); + test_compiler.setBaseCommands( "nmake", cmd ); #elif defined(Q_CC_MINGW) - test_compiler.setBaseCommands( "mingw32-make", cmd, FALSE ); + test_compiler.setBaseCommands( "mingw32-make", cmd ); #elif defined(Q_OS_WIN) && defined(Q_CC_GNU) - test_compiler.setBaseCommands( "mmmake", cmd, FALSE ); + test_compiler.setBaseCommands( "mmmake", cmd ); #else - test_compiler.setBaseCommands( "make", cmd, FALSE ); + test_compiler.setBaseCommands( "make", cmd ); #endif QDir dir; - base_path = dir.currentDirPath(); + base_path = dir.currentPath(); } tst_qmake::~tst_qmake() @@ -251,10 +247,10 @@ void tst_qmake::duplicateLibraryEntries() void tst_qmake::export_across_file_boundaries() { // This relies on features so we need to set the QMAKEFEATURES environment variable - putenv("QMAKEFEATURES=."); + test_compiler.addToEnvironment("QMAKEFEATURES=."); QString workDir = base_path + "/testdata/export_across_file_boundaries"; QVERIFY( test_compiler.qmake( workDir, "foo" )); - putenv("QMAKEFEATURES="); + test_compiler.resetEnvironment(); } void tst_qmake::include_dir() @@ -377,6 +373,54 @@ void tst_qmake::findDeps() QVERIFY( test_compiler.removeMakefile(workDir) ); } +struct TempFile + : QFile +{ + TempFile(QString filename) + : QFile(filename) + { + } + + ~TempFile() + { + if (this->exists()) + this->remove(); + } +}; + +#ifndef Q_OS_WIN +void tst_qmake::bundle_spaces() +{ + QString workDir = base_path + "/testdata/bundle-spaces"; + + // We set up alternate commands here, to make sure we're testing Mac + // Bundles and since this might be the wrong output we rely on dry-running + // make (-n). + + TestCompiler local_tc; + local_tc.setBaseCommands("make -n", "qmake -macx -spec macx-g++"); + + QVERIFY( local_tc.qmake(workDir, "bundle-spaces") ); + + TempFile non_existing_file(workDir + "/non-existing file"); + QVERIFY( !non_existing_file.exists() ); + + // Make fails: no rule to make "non-existing file" + QVERIFY( !local_tc.make(workDir) ); + + QVERIFY( non_existing_file.open(QIODevice::WriteOnly) ); + QVERIFY( non_existing_file.exists() ); + + // Aha! + QVERIFY( local_tc.make(workDir) ); + + // Cleanup + QVERIFY( non_existing_file.remove() ); + QVERIFY( !non_existing_file.exists() ); + QVERIFY( local_tc.removeMakefile(workDir) ); +} +#endif // Q_OS_WIN + QTEST_MAIN(tst_qmake) #include "tst_qmake.moc" diff --git a/tests/auto/qmap/tst_qmap.cpp b/tests/auto/qmap/tst_qmap.cpp index ce413c5..99efc80 100644 --- a/tests/auto/qmap/tst_qmap.cpp +++ b/tests/auto/qmap/tst_qmap.cpp @@ -728,37 +728,27 @@ void tst_QMap::iterators() void tst_QMap::keys_values_uniqueKeys() { QMap<QString, int> map; -#if QT_VERSION >= 0x040200 QVERIFY(map.uniqueKeys().isEmpty()); -#endif QVERIFY(map.keys().isEmpty()); QVERIFY(map.values().isEmpty()); map.insertMulti("alpha", 1); QVERIFY(map.keys() == (QList<QString>() << "alpha")); -#if QT_VERSION >= 0x040200 QVERIFY(map.uniqueKeys() == map.keys()); -#endif QVERIFY(map.values() == (QList<int>() << 1)); map.insertMulti("beta", -2); QVERIFY(map.keys() == (QList<QString>() << "alpha" << "beta")); -#if QT_VERSION >= 0x040200 QVERIFY(map.keys() == map.uniqueKeys()); -#endif QVERIFY(map.values() == (QList<int>() << 1 << -2)); map.insertMulti("alpha", 2); -#if QT_VERSION >= 0x040200 QVERIFY(map.uniqueKeys() == (QList<QString>() << "alpha" << "beta")); -#endif QVERIFY(map.keys() == (QList<QString>() << "alpha" << "alpha" << "beta")); QVERIFY(map.values() == (QList<int>() << 2 << 1 << -2)); map.insertMulti("beta", 4); -#if QT_VERSION >= 0x040200 QVERIFY(map.uniqueKeys() == (QList<QString>() << "alpha" << "beta")); -#endif QVERIFY(map.keys() == (QList<QString>() << "alpha" << "alpha" << "beta" << "beta")); QVERIFY(map.values() == (QList<int>() << 2 << 1 << 4 << -2)); } diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 7607838..a86b754 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -92,6 +92,7 @@ private slots: void activeSubMenuPosition(); void task242454_sizeHint(); void task176201_clear(); + void task250673_activeMutliColumnSubMenuPosition(); protected slots: void onActivated(QAction*); void onHighlighted(QAction*); @@ -678,6 +679,39 @@ void tst_QMenu::task176201_clear() QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center()); } +void tst_QMenu::task250673_activeMutliColumnSubMenuPosition() +{ + class MyMenu : public QMenu + { + public: + friend class tst_QMenu; + }; + + QMenu sub; + sub.addAction("Sub-Item1"); + QAction *subAction = sub.addAction("Sub-Item2"); + + MyMenu main; + main.addAction("Item 1"); + QAction *menuAction = main.addMenu(&sub); + main.popup(QPoint(200,200)); + + uint i = 2; + while (main.columnCount() < 2) { + main.addAction(QString("Item %1").arg(i)); + ++i; + Q_ASSERT(i<1000); + } + main.setActiveAction(menuAction); + sub.setActiveAction(subAction); + QVERIFY(main.isVisible()); + QCOMPARE(main.activeAction(), menuAction); + QVERIFY(sub.isVisible()); + QVERIFY(sub.pos().x() > main.pos().x()); + + const int subMenuOffset = main.style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, &main); + QVERIFY((sub.geometry().left() - subMenuOffset + 5) < main.geometry().right()); +} QTEST_MAIN(tst_QMenu) #include "tst_qmenu.moc" diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 277e15c..538e443 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -457,8 +457,8 @@ void tst_QMenuBar::accel() void tst_QMenuBar::accel_noQt3() { -#ifdef Q_WS_MAC - QSKIP("On Mac, native key events are needed to test menu action activation", SkipAll); +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("On Mac/WinCE, native key events are needed to test menu action activation", SkipAll); #endif // create a popup menu with menu items set the accelerators later... initSimpleMenubar_noQt3(); @@ -486,8 +486,8 @@ void tst_QMenuBar::activatedCount() void tst_QMenuBar::activatedCount_noQt3() { -#ifdef Q_WS_MAC - QSKIP("On Mac, native key events are needed to test menu action activation", SkipAll); +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("On Mac/WinCE, native key events are needed to test menu action activation", SkipAll); #endif // create a popup menu with menu items set the accelerators later... initSimpleMenubar_noQt3(); @@ -888,8 +888,8 @@ void tst_QMenuBar::insertItem_QString_QObject_noQt3() void tst_QMenuBar::check_accelKeys() { -#ifdef Q_WS_MAC - QSKIP("On Mac, native key events are needed to test menu action activation", SkipAll); +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("On Mac/WinCE, native key events are needed to test menu action activation", SkipAll); #endif #ifdef QT3_SUPPORT initComplexMenubar(); @@ -961,8 +961,8 @@ void tst_QMenuBar::check_accelKeys() void tst_QMenuBar::check_cursorKeys1() { -#ifdef Q_WS_MAC - QSKIP("Qt/Mac does not use the native popups/menubar", SkipAll); +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar", SkipAll); #endif #ifdef QT3_SUPPORT @@ -996,8 +996,8 @@ void tst_QMenuBar::check_cursorKeys1() void tst_QMenuBar::check_cursorKeys2() { -#ifdef Q_WS_MAC - QSKIP("Qt/Mac does not use the native popups/menubar", SkipAll); +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar", SkipAll); #endif #ifdef QT3_SUPPORT @@ -1030,8 +1030,8 @@ void tst_QMenuBar::check_cursorKeys2() */ void tst_QMenuBar::check_cursorKeys3() { -#ifdef Q_WS_MAC - QSKIP("Qt/Mac does not use the native popups/menubar", SkipAll); +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar", SkipAll); #endif #ifdef QT3_SUPPORT @@ -1186,8 +1186,8 @@ void tst_QMenuBar::check_escKey() void tst_QMenuBar::check_escKey_noQt3() { -#ifdef Q_WS_MAC - QSKIP("Qt/Mac does not use the native popups/menubar", SkipAll); +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar", SkipAll); #endif initComplexMenubar_noQt3(); @@ -1329,7 +1329,7 @@ void tst_QMenuBar::check_escKey_noQt3() void tst_QMenuBar::allowActiveAndDisabled() { -#ifndef Q_WS_MAC +#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM) mb->hide(); mb->clear(); @@ -1337,7 +1337,6 @@ tst_QMenuBar::allowActiveAndDisabled() // disabled menu items are added QMenu fileMenu("&File"); - QAction disabledAction() ; // Task 241043 : check that second menu is activated // if all items are disabled QAction *act = fileMenu.addAction("Disabled"); @@ -1394,8 +1393,8 @@ void tst_QMenuBar::check_altPress() void tst_QMenuBar::check_shortcutPress() { -#ifdef Q_WS_MAC - QSKIP("Qt/Mac does not use the native popups/menubar", SkipAll); +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM) + QSKIP("Qt/Mac,WinCE does not use the native popups/menubar", SkipAll); #endif #ifdef QT3_SUPPORT @@ -1430,7 +1429,7 @@ void tst_QMenuBar::check_menuPosition() #ifdef Q_WS_MAC QSKIP("Qt/Mac does not use the native popups/menubar", SkipAll); #endif -#ifdef Q_OS_WINCE +#ifdef Q_OS_WINCE_WM QSKIP("Qt/CE uses native menubar", SkipAll); #endif QMenu menu; diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index b3b7f33..3d04a0f 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -257,11 +257,7 @@ private slots: void on_child1_destroyed() { ++invokeCount2; } }; -#if QT_VERSION >= 0x040200 #define FUNCTION(x) "QMetaObject::" x ": " -#else -#define FUNCTION(x) "QMetaObject::" x "(): " -#endif void tst_QMetaObject::connectSlotsByName() { diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/qmetatype/tst_qmetatype.cpp index eccf7e6..d71f470 100644 --- a/tests/auto/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/qmetatype/tst_qmetatype.cpp @@ -127,7 +127,6 @@ protected: void tst_QMetaType::threadSafety() { -#if QT_VERSION >= 0x040100 MetaTypeTorturer t1; MetaTypeTorturer t2; MetaTypeTorturer t3; @@ -139,7 +138,6 @@ void tst_QMetaType::threadSafety() QVERIFY(t1.wait()); QVERIFY(t2.wait()); QVERIFY(t3.wait()); -#endif } namespace TestSpace diff --git a/tests/auto/qmovie/tst_qmovie.cpp b/tests/auto/qmovie/tst_qmovie.cpp index dd24f97..23b057b 100644 --- a/tests/auto/qmovie/tst_qmovie.cpp +++ b/tests/auto/qmovie/tst_qmovie.cpp @@ -71,9 +71,7 @@ private slots: void playMovie(); void jumpToFrame_data(); void jumpToFrame(); -#if QT_VERSION >= 0x040101 void changeMovieFile(); -#endif // QT_VERSION }; // Testing get/set functions @@ -201,7 +199,6 @@ void tst_QMovie::jumpToFrame() QVERIFY(movie.currentFrameNumber() == 0); } -#if QT_VERSION >= 0x040101 void tst_QMovie::changeMovieFile() { QMovie movie("animations/comicsecard.gif"); @@ -211,7 +208,5 @@ void tst_QMovie::changeMovieFile() QVERIFY(movie.currentFrameNumber() == -1); } -#endif // QT_VERSION - QTEST_MAIN(tst_QMovie) #include "tst_qmovie.moc" diff --git a/tests/auto/qmutexlocker/tst_qmutexlocker.cpp b/tests/auto/qmutexlocker/tst_qmutexlocker.cpp index cb5112d..cc3e144 100644 --- a/tests/auto/qmutexlocker/tst_qmutexlocker.cpp +++ b/tests/auto/qmutexlocker/tst_qmutexlocker.cpp @@ -194,9 +194,6 @@ void tst_QMutexLocker::unlockAndRelockTest() void tst_QMutexLocker::lockerStateTest() { -#if QT_VERSION < 0x040200 - QSKIP("QMutexLocker doesn't keep state in Qt < 4.2", SkipAll); -#else class LockerStateThread : public tst_QMutexLockerThread { public: @@ -233,7 +230,6 @@ void tst_QMutexLocker::lockerStateTest() delete thread; thread = 0; -#endif } QTEST_MAIN(tst_QMutexLocker) diff --git a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp index a28c49a..68ec414 100644 --- a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp +++ b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp @@ -42,8 +42,6 @@ #include <QtTest/QtTest> -#if QT_VERSION >= 0x040100 - #ifdef Q_OS_WIN #include <winsock2.h> #endif @@ -694,7 +692,3 @@ void tst_QNativeSocketEngine::receiveUrgentData() QTEST_MAIN(tst_QNativeSocketEngine) #include "tst_qnativesocketengine.moc" - -#else // QT_VERSION -QTEST_NOOP_MAIN -#endif diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp index 9010db4..36a4b45 100644 --- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp +++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp @@ -286,8 +286,263 @@ void tst_QNetworkCookie::parseSingleCookie_data() QTest::newRow("expiration3") << "a=b; expires=Wednesday, 09-Nov-1999 23:12:40 GMT " << cookie; QTest::newRow("expiration-utc") << "a=b;expires=Wednesday, 09-Nov-1999 23:12:40 UTC" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 0, 0), Qt::UTC)); + QTest::newRow("time-0") << "a=b;expires=14 Apr 89 03:20" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 12, 0), Qt::UTC)); + QTest::newRow("time-1") << "a=b;expires=14 Apr 89 03:20:12" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 12, 88), Qt::UTC)); + QTest::newRow("time-2") << "a=b;expires=14 Apr 89 03:20:12.88" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 12, 88), Qt::UTC)); + QTest::newRow("time-3") << "a=b;expires=14 Apr 89 03:20:12.88am" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(15, 20, 12, 88), Qt::UTC)); + QTest::newRow("time-4") << "a=b;expires=14 Apr 89 03:20:12.88pm" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 12, 88), Qt::UTC)); + QTest::newRow("time-5") << "a=b;expires=14 Apr 89 03:20:12.88 Am" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(15, 20, 12, 88), Qt::UTC)); + QTest::newRow("time-6") << "a=b;expires=14 Apr 89 03:20:12.88 PM" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(15, 20, 12, 88), Qt::UTC)); + QTest::newRow("time-7") << "a=b;expires=14 Apr 89 3:20:12.88 PM" << cookie; + + // normal months + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-1") << "a=b;expires=Jan 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 2, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-2") << "a=b;expires=Feb 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 3, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-3") << "a=b;expires=mar 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-4") << "a=b;expires=Apr 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 5, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-5") << "a=b;expires=May 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 6, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-6") << "a=b;expires=Jun 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 7, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-7") << "a=b;expires=Jul 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 8, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-8") << "a=b;expires=Aug 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 9, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-9") << "a=b;expires=Sep 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 10, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-10") << "a=b;expires=Oct 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 11, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-11") << "a=b;expires=Nov 1 89 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 12, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-12") << "a=b;expires=Dec 1 89 1:1" << cookie; + + // extra months + cookie.setExpirationDate(QDateTime(QDate(1989, 12, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-13") << "a=b;expires=December 1 89 1:1" << cookie; + QTest::newRow("months-14") << "a=b;expires=1 89 1:1 Dec" << cookie; + //cookie.setExpirationDate(QDateTime()); + //QTest::newRow("months-15") << "a=b;expires=1 89 1:1 De" << cookie; + cookie.setExpirationDate(QDateTime(QDate(2024, 2, 29), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-16") << "a=b;expires=2024 29 Feb 1:1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(2024, 2, 29), QTime(1, 1), Qt::UTC)); + QTest::newRow("months-17") << "a=b;expires=Fri, 29-Feb-2024 01:01:00 GMT" << cookie; + QTest::newRow("months-18") << "a=b;expires=2024 29 Feb 1:1 GMT" << cookie; + + // normal offsets + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-0") << "a=b;expires=Jan 1 89 8:0 PST" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-1") << "a=b;expires=Jan 1 89 8:0 PDT" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-2") << "a=b;expires=Jan 1 89 7:0 MST" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-3") << "a=b;expires=Jan 1 89 7:0 MDT" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-4") << "a=b;expires=Jan 1 89 6:0 CST" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-5") << "a=b;expires=Jan 1 89 6:0 CDT" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-6") << "a=b;expires=Jan 1 89 5:0 EST" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-7") << "a=b;expires=Jan 1 89 5:0 EDT" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-8") << "a=b;expires=Jan 1 89 4:0 AST" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-9") << "a=b;expires=Jan 1 89 3:0 NST" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-10") << "a=b;expires=Jan 1 89 0:0 GMT" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-11") << "a=b;expires=Jan 1 89 0:0 BST" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 2), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-12") << "a=b;expires=Jan 1 89 23:0 MET" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 2), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-13") << "a=b;expires=Jan 1 89 22:0 EET" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 2), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-14") << "a=b;expires=Jan 1 89 15:0 JST" << cookie; + + // extra offsets + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 2), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-14") << "a=b;expires=Jan 1 89 15:0 JST+1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 0), Qt::UTC)); + QTest::newRow("zoneoffset-15") << "a=b;expires=Jan 1 89 0:0 GMT+1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-15b") << "a=b;expires=Jan 1 89 1:0 GMT-1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 0), Qt::UTC)); + QTest::newRow("zoneoffset-16") << "a=b;expires=Jan 1 89 0:0 GMT+01" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 5), Qt::UTC)); + QTest::newRow("zoneoffset-17") << "a=b;expires=Jan 1 89 0:0 GMT+0105" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-18") << "a=b;expires=Jan 1 89 0:0 GMT+015" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-19") << "a=b;expires=Jan 1 89 0:0 GM" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-19b") << "a=b;expires=Jan 1 89 0:0 GMT" << cookie; + + // offsets from gmt + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 0), Qt::UTC)); + QTest::newRow("zoneoffset-20") << "a=b;expires=Jan 1 89 0:0 +1" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 0), Qt::UTC)); + QTest::newRow("zoneoffset-21") << "a=b;expires=Jan 1 89 0:0 +01" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 1), Qt::UTC)); + QTest::newRow("zoneoffset-22") << "a=b;expires=Jan 1 89 0:0 +0101" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("zoneoffset-23") << "a=b;expires=Jan 1 89 1:0 -1" << cookie; + + // Y2k + cookie.setExpirationDate(QDateTime(QDate(2000, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("year-0") << "a=b;expires=Jan 1 00 0:0" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1970, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("year-1") << "a=b;expires=Jan 1 70 0:0" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1971, 1, 1), QTime(0, 0), Qt::UTC)); + QTest::newRow("year-2") << "a=b;expires=Jan 1 71 0:0" << cookie; + + // Day, month, year + cookie.setExpirationDate(QDateTime(QDate(2013, 1, 2), QTime(0, 0), Qt::UTC)); + QTest::newRow("date-0") << "a=b;expires=Jan 2 13 0:0" << cookie; + QTest::newRow("date-1") << "a=b;expires=1-2-13 0:0" << cookie; + QTest::newRow("date-2") << "a=b;expires=1/2/13 0:0" << cookie; + QTest::newRow("date-3") << "a=b;expires=Jan 2 13 0:0" << cookie; + QTest::newRow("date-4") << "a=b;expires=Jan 2, 13 0:0" << cookie; + QTest::newRow("date-5") << "a=b;expires=1-2-13 0:0" << cookie; + QTest::newRow("date-6") << "a=b;expires=1/2/13 0:0" << cookie; + + // Known Year, determine month and day + cookie.setExpirationDate(QDateTime(QDate(1995, 1, 13), QTime(0, 0), Qt::UTC)); + QTest::newRow("knownyear-0") << "a=b;expires=13/1/95 0:0" << cookie; + QTest::newRow("knownyear-1") << "a=b;expires=95/13/1 0:0" << cookie; + QTest::newRow("knownyear-2") << "a=b;expires=1995/1/13 0:0" << cookie; + QTest::newRow("knownyear-3") << "a=b;expires=1995/13/1 0:0" << cookie; + cookie.setExpirationDate(QDateTime(QDate(1995, 1, 2), QTime(0, 0), Qt::UTC)); + QTest::newRow("knownyear-4") << "a=b;expires=1/2/95 0:0" << cookie; + QTest::newRow("knownyear-5") << "a=b;expires=95/1/2 0:0" << cookie; + + // Known Year, Known day, determining month + cookie.setExpirationDate(QDateTime(QDate(1995, 1, 13), QTime(0, 0), Qt::UTC)); + QTest::newRow("knownYD-0") << "a=b;expires=13/1/95 0:0" << cookie; + QTest::newRow("knownYD-1") << "a=b;expires=1/13/95 0:0" << cookie; + QTest::newRow("knownYD-2") << "a=b;expires=95/13/1 0:0" << cookie; + QTest::newRow("knownYD-3") << "a=b;expires=95/1/13 0:0" << cookie; + + // Month comes before Year + cookie.setExpirationDate(QDateTime(QDate(2021, 03, 26), QTime(0, 0), Qt::UTC)); + QTest::newRow("month-0") << "a=b;expires=26/03/21 0:0" << cookie; + cookie.setExpirationDate(QDateTime(QDate(2015, 12, 30), QTime(16, 25, 0, 0), Qt::UTC)); + QTest::newRow("month-1") << "a=b;expires=wed 16:25pm December 2015 30" << cookie; + cookie.setExpirationDate(QDateTime(QDate(2031, 11, 11), QTime(16, 25, 0, 0), Qt::UTC)); + QTest::newRow("month-2") << "a=b;expires=16:25 11 31 11" << cookie; + + // The very ambiguous cases + // Matching Firefox's behavior of guessing month, day, year in those cases + cookie.setExpirationDate(QDateTime(QDate(2013, 10, 2), QTime(0, 0), Qt::UTC)); + QTest::newRow("ambiguousd-0") << "a=b;expires=10/2/13 0:0" << cookie; + cookie.setExpirationDate(QDateTime(QDate(2013, 2, 10), QTime(0, 0), Qt::UTC)); + QTest::newRow("ambiguousd-1") << "a=b;expires=2/10/13 0:0" << cookie; + cookie.setExpirationDate(QDateTime(QDate(2010, 2, 3), QTime(0, 0), Qt::UTC)); + QTest::newRow("ambiguousd-2") << "a=b;expires=2/3/10 0:0" << cookie; + + // FYI If you try these in Firefox it wont set a cookie for the following two string + // because 03 is turned into the year at which point it is expired + cookie.setExpirationDate(QDateTime(QDate(2003, 2, 10), QTime(0, 0), Qt::UTC)); + QTest::newRow("ambiguousd-3") << "a=b;expires=2/10/3 0:0" << cookie; + cookie.setExpirationDate(QDateTime(QDate(2003, 10, 2), QTime(0, 0), Qt::UTC)); + QTest::newRow("ambiguousd-4") << "a=b;expires=10/2/3 0:0" << cookie; + + // These are the cookies that firefox's source says it can parse + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 0, 0), Qt::UTC)); + QTest::newRow("firefox-0") << "a=b;expires=14 Apr 89 03:20" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 0, 0), Qt::UTC)); + QTest::newRow("firefox-1") << "a=b;expires=14 Apr 89 03:20 GMT" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1989, 3, 17), QTime(4, 1, 33, 0), Qt::UTC)); + QTest::newRow("firefox-2") << "a=b;expires=Fri, 17 Mar 89 4:01:33" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1989, 3, 17), QTime(4, 1, 0, 0), Qt::UTC)); + QTest::newRow("firefox-3") << "a=b;expires=Fri, 17 Mar 89 4:01 GMT" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 16), QTime(16-8, 12, 0, 0), Qt::UTC)); + QTest::newRow("firefox-4") << "a=b;expires=Mon Jan 16 16:12 PDT 1989" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1989, 1, 16), QTime(17, 42, 0, 0), Qt::UTC)); + QTest::newRow("firefox-5") << "a=b;expires=Mon Jan 16 16:12 +0130 1989" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1992, 5, 6), QTime(16-9, 41, 0, 0), Qt::UTC)); + QTest::newRow("firefox-6") << "a=b;expires=6 May 1992 16:41-JST (Wednesday)" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1993, 8, 22), QTime(10, 59, 12, 82), Qt::UTC)); + QTest::newRow("firefox-7") << "a=b;expires=22-AUG-1993 10:59:12.82" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1993, 8, 22), QTime(22, 59, 0, 0), Qt::UTC)); + QTest::newRow("firefox-8") << "a=b;expires=22-AUG-1993 10:59pm" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1993, 8, 22), QTime(12, 59, 0, 0), Qt::UTC)); + QTest::newRow("firefox-9") << "a=b;expires=22-AUG-1993 12:59am" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1993, 8, 22), QTime(12, 59, 0, 0), Qt::UTC)); + QTest::newRow("firefox-10") << "a=b;expires=22-AUG-1993 12:59 PM" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1995, 8, 4), QTime(15, 54, 0, 0), Qt::UTC)); + QTest::newRow("firefox-11") << "a=b;expires=Friday, August 04, 1995 3:54 PM" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1995, 6, 21), QTime(16, 24, 34, 0), Qt::UTC)); + QTest::newRow("firefox-12") << "a=b;expires=06/21/95 04:24:34 PM" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1995, 6, 20), QTime(21, 7, 0, 0), Qt::UTC)); + QTest::newRow("firefox-13") << "a=b;expires=20/06/95 21:07" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(1995, 6, 8), QTime(19-5, 32, 48, 0), Qt::UTC)); + QTest::newRow("firefox-14") << "a=b;expires=95-06-08 19:32:48 EDT" << cookie; + + // Edge cases caught by fuzzing + // These are about the default cause creates dates that don't exits + cookie.setExpirationDate(QDateTime(QDate(2030, 2, 25), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-0") << "a=b; expires=30 -000002 1:1 25;" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(2031, 11, 20), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-1") << "a=b; expires=31 11 20 1:1;" << cookie; + + // April only has 30 days + cookie.setExpirationDate(QDateTime(QDate(2031, 4, 30), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-2") << "a=b; expires=31 30 4 1:1" << cookie; + + // 9 must be the month so 31 can't be the day + cookie.setExpirationDate(QDateTime(QDate(2031, 9, 21), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-3") << "a=b; expires=31 21 9 1:1" << cookie; + + // Year is known, then fallback to defaults of filling in month and day + cookie.setExpirationDate(QDateTime(QDate(2031, 11, 1), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-4") << "a=b; expires=31 11 01 1:1" << cookie; + + // 2 must be the month so 30 can't be the day + cookie.setExpirationDate(QDateTime(QDate(2030, 2, 20), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-5") << "a=b; expires=30 02 20 1:1" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(2021, 12, 22), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-6") << "a=b; expires=2021 12 22 1:1" << cookie; + + cookie.setExpirationDate(QDateTime(QDate(2029, 2, 23), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-7") << "a=b; expires=29 23 Feb 1:1" << cookie; + + // 11 and 6 don't have 31 days + cookie.setExpirationDate(QDateTime(QDate(2031, 11, 06), QTime(1, 1, 0, 0), Qt::UTC)); + QTest::newRow("fuzz-8") << "a=b; expires=31 11 06 1:1" << cookie; + // two-digit years: // from 70 until 99, we assume 20th century + cookie.setExpirationDate(QDateTime(QDate(1999, 11, 9), QTime(23, 12, 40), Qt::UTC)); QTest::newRow("expiration-2digit1") << "a=b; expires=Wednesday, 09-Nov-99 23:12:40 GMT " << cookie; cookie.setExpirationDate(QDateTime(QDate(1970, 1, 1), QTime(23, 12, 40), Qt::UTC)); QTest::newRow("expiration-2digit2") << "a=b; expires=Thursday, 01-Jan-70 23:12:40 GMT " << cookie; @@ -315,6 +570,9 @@ void tst_QNetworkCookie::parseSingleCookie_data() cookie.setExpirationDate(QDateTime(QDate(9999, 12, 31), QTime(23, 59, 59), Qt::UTC)); QTest::newRow("network2") << "__siteid=1; expires=Fri, 31-Dec-9999 23:59:59 GMT; path=/" << cookie; + cookie = QNetworkCookie("YM.LC", "v=2&m=9993_262838_159_1558_1063_0_5649_4012_3776161073,9426_260205_549_1295_1336_0_5141_4738_3922731647,6733_258196_952_1364_643_0_3560_-1_0,3677_237633_1294_1294_19267_0_3244_29483_4102206176,1315_235149_1693_1541_941_0_3224_1691_1861378060,1858_214311_2100_1298_19538_0_2873_30900_716411652,6258_212007_2506_1285_1017_0_2868_3606_4288540264,3743_207884_2895_1362_2759_0_2545_7114_3388520216,2654_205253_3257_1297_1332_0_2504_4682_3048534803,1891_184881_3660_1291_19079_0_978_29178_2592538685&f=1&n=20&s=date&o=down&e=1196548712&b=Inbox&u=removed"); + cookie.setPath("/"); + cookie.setDomain("mail.yahoo.com"); QTest::newRow("network3") << "YM.LC=v=2&m=9993_262838_159_1558_1063_0_5649_4012_3776161073,9426_260205_549_1295_1336_0_5141_4738_3922731647,6733_258196_952_1364_643_0_3560_-1_0,3677_237633_1294_1294_19267_0_3244_29483_4102206176,1315_235149_1693_1541_941_0_3224_1691_1861378060,1858_214311_2100_1298_19538_0_2873_30900_716411652,6258_212007_2506_1285_1017_0_2868_3606_4288540264,3743_207884_2895_1362_2759_0_2545_7114_3388520216,2654_205253_3257_1297_1332_0_2504_4682_3048534803,1891_184881_3660_1291_19079_0_978_29178_2592538685&f=1&n=20&s=date&o=down&e=1196548712&b=Inbox&u=removed; path=/; domain=mail.yahoo.com" << cookie; cookie = QNetworkCookie("__ac", "c2hhdXNtYW46U2FTYW80Wm8%3D"); @@ -330,13 +588,22 @@ void tst_QNetworkCookie::parseSingleCookie() QList<QNetworkCookie> result = QNetworkCookie::parseCookies(cookieString.toLatin1()); - QEXPECT_FAIL("network2", "QDateTime parsing problem: the date is beyond year 8000", Abort); - QEXPECT_FAIL("network3", "Cookie value contains commas, violating the HTTP spec", Abort); + //QEXPECT_FAIL("network2", "QDateTime parsing problem: the date is beyond year 8000", Abort); QCOMPARE(result.count(), 1); + QEXPECT_FAIL("network3", "Cookie value contains commas, violating the HTTP spec", Abort); QCOMPARE(result.at(0), expectedCookie); result = QNetworkCookie::parseCookies(result.at(0).toRawForm()); QCOMPARE(result.count(), 1); + + // Drop any millisecond information, if there's any + QDateTime dt = expectedCookie.expirationDate(); + if (dt.isValid()) { + QTime t = dt.time(); + dt.setTime(t.addMSecs(-t.msec())); + expectedCookie.setExpirationDate(dt); + } + QCOMPARE(result.at(0), expectedCookie); } @@ -358,9 +625,7 @@ void tst_QNetworkCookie::parseMultipleCookies_data() // reason: malformed NAME=VALUE pair QTest::newRow("invalid-05") << "foo" << list; QTest::newRow("invalid-06") << "=b" << list; - QTest::newRow("invalid-08") << "a=b,foo" << list; QTest::newRow("invalid-09") << "foo,a=b" << list; - QTest::newRow("invalid-10") << "a=b,=b" << list; QTest::newRow("invalid-11") << ";path=/" << list; // reason: malformed expiration date string @@ -369,8 +634,6 @@ void tst_QNetworkCookie::parseMultipleCookies_data() QTest::newRow("invalid-14") << "a=b;expires=foobar, abc" << list; QTest::newRow("invalid-15") << "a=b;expires=foobar, dd-mmm-yyyy hh:mm:ss GMT; path=/" << list; QTest::newRow("invalid-16") << "a=b;expires=foobar, 32-Caz-1999 24:01:60 GMT; path=/" << list; - QTest::newRow("invalid-17") << "a=b,c=d;expires=" << list; - QTest::newRow("invalid-18") << "a=b, c=d; expires=foobar, 32-Caz-1999 24:01:60 GMT; path=/" << list; QNetworkCookie cookie; cookie.setName("a"); @@ -417,6 +680,26 @@ void tst_QNetworkCookie::parseMultipleCookies_data() list << cookie; QTest::newRow("network1") << "id=51706646077999719 bb=\"K14144t\"_AAQ\"ototrK_A_ttot44AQ4KwoRQtoto| adv=; Domain=.bluestreak.com; expires=Tuesday 05-Dec-2017 09:11:07 GMT; path=/;" << list; + QNetworkCookie cookieA; + cookieA.setName("a"); + cookieA.setValue("b"); + + QNetworkCookie cookieB; + cookieB.setName("c"); + cookieB.setValue("d"); + + // NewLine + cookieA.setExpirationDate(QDateTime(QDate(2009, 3, 10), QTime(7, 0, 0, 0), Qt::UTC)); + cookieB.setExpirationDate(QDateTime(QDate(2009, 3, 20), QTime(7, 0, 0, 0), Qt::UTC)); + list = QList<QNetworkCookie>() << cookieA << cookieB; + QTest::newRow("real-0") << "a=b; expires=Tue Mar 10 07:00:00 2009 GMT\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list; + QTest::newRow("real-1") << "a=b; expires=Tue Mar 10 07:00:00 2009 GMT\n\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list; + QTest::newRow("real-2") << "a=b; expires=Mar 10 07:00:00 2009 GMT, Tue\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list; + + // Match firefox's behavior + cookieA.setPath("/foo"); + list = QList<QNetworkCookie>() << cookieA << cookieB; + QTest::newRow("real-3") << "a=b; expires=Mar 10 07:00:00 2009 GMT, Tue; path=/foo\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list; } void tst_QNetworkCookie::parseMultipleCookies() diff --git a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp index 6e5afd2..a246b04 100644 --- a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp @@ -42,10 +42,6 @@ #include <QtTest/QtTest> -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include <qcoreapplication.h> #include <qnetworkinterface.h> #include <qtcpsocket.h> @@ -210,5 +206,3 @@ void tst_QNetworkInterface::copyInvalidInterface() QTEST_MAIN(tst_QNetworkInterface) #include "tst_qnetworkinterface.moc" - -#endif diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 503118a..104b788 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2236,9 +2236,6 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket_data() void tst_QNetworkReply::ioPutToFileFromLocalSocket() { -#if defined(Q_OS_WINCE) && QT_VERSION < 0x040500 - QSKIP("No local sockets on Windows CE for Qt 4.4", SkipAll); -#else QString socketname = "networkreplytest"; QLocalServer server; if (!server.listen(socketname)) { @@ -2276,7 +2273,6 @@ void tst_QNetworkReply::ioPutToFileFromLocalSocket() QCOMPARE(file.size(), qint64(data.size())); QByteArray contents = file.readAll(); QCOMPARE(contents, data); -#endif } void tst_QNetworkReply::ioPutToFileFromProcess_data() diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 096f1c5..fb46073 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -264,13 +264,9 @@ void tst_QObject::disconnect() QCOMPARE( r1->called(1), FALSE ); r1->reset(); -#if QT_VERSION >= 0x030100 QCOMPARE( ret, TRUE ); -#endif ret = QObject::disconnect( s, SIGNAL( signal1() ), r1, SLOT( slot1() ) ); -#if QT_VERSION >= 0x030100 QCOMPARE( ret, FALSE ); -#endif // disconnect all signals from s from all slots from r1 QObject::disconnect( s, 0, r1, 0 ); @@ -702,12 +698,10 @@ void tst_QObject::connectDisconnectNotify() QCOMPARE( s->org_signal, s->nw_signal ); QCOMPARE( s->org_signal.toLatin1(), QMetaObject::normalizedSignature(a_signal.toLatin1().constData()) ); -#if QT_VERSION > 0x040101 // Reconnect connect( (SenderObject*)s, a_signal.toLatin1(), (ReceiverObject*)r, a_slot.toLatin1() ); // Test disconnectNotify for a complete disconnect ((SenderObject*)s)->disconnect((ReceiverObject*)r); -#endif delete s; delete r; diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 5a15683..8b43f9b 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -203,6 +203,10 @@ private slots: void drawImage_task217400_data(); void drawImage_task217400(); void drawRect_task215378(); + void drawRect_task247505(); + + void drawImage_data(); + void drawImage(); void clippedImage(); @@ -2569,23 +2573,6 @@ void tst_QPainter::setOpacity() p.fillRect(imageRect, QColor(127, 127, 127)); p.end(); -#if defined(Q_WS_QWS) && (QT_VERSION < 0x040500) - // embedded has an optimized implementation in 4.4 - if ((dest.format() == QImage::Format_ARGB8555_Premultiplied || - dest.format() == QImage::Format_RGB555 || - dest.format() == QImage::Format_RGB666 || - dest.format() == QImage::Format_RGB888 || - dest.format() == QImage::Format_ARGB8565_Premultiplied) && - src.format() != QImage::Format_RGB32) - { - QColor c1 = expected.pixel(1, 1); - QColor c2 = dest.pixel(1, 1); - QVERIFY(qAbs(c1.red() - c2.red()) < 2); - QVERIFY(qAbs(c1.green() - c2.green()) < 2); - QVERIFY(qAbs(c1.blue() - c2.blue()) < 2); - QVERIFY(qAbs(c1.alpha() - c2.alpha()) < 2); - } else -#endif QCOMPARE(dest, expected); } @@ -3586,6 +3573,97 @@ void tst_QPainter::drawRect_task215378() QVERIFY(img.pixel(0, 0) != img.pixel(1, 1)); } +void tst_QPainter::drawRect_task247505() +{ + QImage a(10, 10, QImage::Format_ARGB32_Premultiplied); + a.fill(0); + QImage b = a; + + QPainter p(&a); + p.setPen(Qt::NoPen); + p.setBrush(Qt::black); + p.drawRect(QRectF(10, 0, -10, 10)); + p.end(); + p.begin(&b); + p.setPen(Qt::NoPen); + p.setBrush(Qt::black); + p.drawRect(QRectF(0, 0, 10, 10)); + p.end(); + + QCOMPARE(a, b); +} + +void tst_QPainter::drawImage_data() +{ + QTest::addColumn<int>("x"); + QTest::addColumn<int>("y"); + QTest::addColumn<int>("w"); + QTest::addColumn<int>("h"); + QTest::addColumn<QImage::Format>("srcFormat"); + QTest::addColumn<QImage::Format>("dstFormat"); + + for (int srcFormat = QImage::Format_Mono; srcFormat < QImage::NImageFormats; ++srcFormat) { + for (int dstFormat = QImage::Format_Mono; dstFormat < QImage::NImageFormats; ++dstFormat) { + if (dstFormat == QImage::Format_Indexed8) + continue; + for (int odd_x = 0; odd_x <= 1; ++odd_x) { + for (int odd_width = 0; odd_width <= 1; ++odd_width) { + QString description = + QString("srcFormat %1, dstFormat %2, odd x: %3, odd width: %4") + .arg(srcFormat).arg(dstFormat).arg(odd_x).arg(odd_width); + + QTest::newRow(qPrintable(description)) << (10 + odd_x) << 10 << (20 + odd_width) << 20 + << QImage::Format(srcFormat) + << QImage::Format(dstFormat); + } + } + } + } +} + +bool verifyImage(const QImage &img, int x, int y, int w, int h, uint background) +{ + int imgWidth = img.width(); + int imgHeight = img.height(); + for (int i = 0; i < imgHeight; ++i) { + for (int j = 0; j < imgWidth; ++j) { + uint pixel = img.pixel(j, i); + bool outside = j < x || j >= (x + w) || i < y || i >= (y + h); + if (outside != (pixel == background)) { + //printf("%d %d, expected %x, got %x, outside: %d\n", x, y, background, pixel, outside); + return false; + } + } + } + + return true; +} + +void tst_QPainter::drawImage() +{ + QFETCH(int, x); + QFETCH(int, y); + QFETCH(int, w); + QFETCH(int, h); + QFETCH(QImage::Format, srcFormat); + QFETCH(QImage::Format, dstFormat); + + QImage dst(40, 40, QImage::Format_RGB32); + dst.fill(0xffffffff); + + dst = dst.convertToFormat(dstFormat); + uint background = dst.pixel(0, 0); + + QImage src(w, h, QImage::Format_RGB32); + src.fill(0xff000000); + src = src.convertToFormat(srcFormat); + + QPainter p(&dst); + p.drawImage(x, y, src); + p.end(); + + QVERIFY(verifyImage(dst, x, y, w, h, background)); +} void tst_QPainter::imageCoordinateLimit() { diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp index cff84e9..3d77f5e 100644 --- a/tests/auto/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp @@ -84,11 +84,9 @@ private slots: void testOperatorEquals_fuzzy(); void testOperatorDatastream(); -#if QT_VERSION >= 0x040200 void testArcMoveTo_data(); void testArcMoveTo(); void setElementPositionAt(); -#endif void testOnPath_data(); void testOnPath(); @@ -819,7 +817,6 @@ void tst_QPainterPath::closing() } } -#if QT_VERSION >= 0x040200 void tst_QPainterPath::testArcMoveTo_data() { QTest::addColumn<QRectF>("rect"); @@ -1170,8 +1167,6 @@ void tst_QPainterPath::connectPathDuplicatePoint() QCOMPARE(c, a); } -#endif - QTEST_APPLESS_MAIN(tst_QPainterPath) #include "tst_qpainterpath.moc" diff --git a/tests/auto/qpicture/tst_qpicture.cpp b/tests/auto/qpicture/tst_qpicture.cpp index 43559e5..954be23 100644 --- a/tests/auto/qpicture/tst_qpicture.cpp +++ b/tests/auto/qpicture/tst_qpicture.cpp @@ -121,12 +121,10 @@ void tst_QPicture::boundingRect() // default value QVERIFY( !p1.boundingRect().isValid() ); -#if QT_VERSION >= 0x030100 QRect r1( 20, 30, 5, 15 ); p1.setBoundingRect( r1 ); QCOMPARE( p1.boundingRect(), r1 ); p1.setBoundingRect(QRect()); -#endif QPainter pt( &p1 ); pt.drawLine( 10, 20, 110, 80 ); diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 2b337da..ba117d8 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -103,6 +103,7 @@ private slots: void grabWidget(); void grabWindow(); void isNull(); + void task_246446(); #ifdef Q_WS_QWS void convertFromImageNoDetach(); @@ -1015,5 +1016,20 @@ void tst_QPixmap::fromData() QCOMPARE(img.pixel(0, 1), QRgb(0xff000000)); } +void tst_QPixmap::task_246446() +{ + // This crashed without the bugfix in 246446 + QPixmap pm(10, 10); + pm.fill(Qt::transparent); // force 32-bit depth + QBitmap bm; + pm.setMask(bm); + { + QPixmap pm2(pm); + } + QVERIFY(pm.width() == 10); + QVERIFY(pm.mask().isNull()); +} + + QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index 0febb87..a598bfc 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -121,9 +121,6 @@ void tst_QPrinter::getSetCheck() obj1.setCollateCopies(false); QCOMPARE(false, obj1.collateCopies()); obj1.setCollateCopies(true); -#if !defined(Q_OS_UNIX) && QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Apparently only the Unix (ps) printer supports collate at the moment", Continue); -#endif QCOMPARE(true, obj1.collateCopies()); obj1.setColorMode(QPrinter::GrayScale); @@ -185,9 +182,6 @@ void tst_QPrinter::getSetCheck() obj1.setFontEmbeddingEnabled(false); QCOMPARE(false, obj1.fontEmbeddingEnabled()); obj1.setFontEmbeddingEnabled(true); -#if !defined(Q_OS_UNIX) && QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Apparently only the Unix (ps) printer supports font embedding at the moment", Continue); -#endif QCOMPARE(true, obj1.fontEmbeddingEnabled()); // PageSize QPrinter::pageSize() @@ -255,20 +249,13 @@ void tst_QPrinter::cleanup() void tst_QPrinter::testPageSetupDialog() { -#if QT_VERSION < 0x040102 - QSKIP("QPrinter::OutputFormat doesn't exist in Qt 4.0.x and test crashes on < 4.1.2"); -#else - // Make sure this doesn't crash at least { QPrinter printer; QPageSetupDialog dialog(&printer); } -#endif } - - void tst_QPrinter::testPageSize() { #if defined (Q_WS_WIN) @@ -332,10 +319,6 @@ void tst_QPrinter::testPageRectAndPaperRect_data() void tst_QPrinter::testPageRectAndPaperRect() { -#if QT_VERSION <= 0x040100 - QEXPECT_FAIL("", "Fixed in Qt 4.1.1", Continue); -#endif - QFETCH(bool, withPainter); QFETCH(int, orientation); QFETCH(int, resolution); @@ -529,9 +512,6 @@ void tst_QPrinter::testMulitpleSets() QPrinter::PageSize printerPageSize = QPrinter::PageSize(pageSize); QPrinter printer(mode); printer.setFullPage(true); -#if QT_VERSION < 0x040103 - QEXPECT_FAIL("", "Fixed in Qt 4.1.3", SkipAll); -#endif int paperWidth, paperHeight; //const int Tolerance = 2; diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index f0dae5d..801cce8 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -139,6 +139,8 @@ private slots: void switchReadChannels(); void setWorkingDirectory(); void startFinishStartFinish(); + void invalidProgramString_data(); + void invalidProgramString(); // keep these at the end, since they use lots of processes and sometimes // caused obscure failures to occur in tests that followed them (esp. on the Mac) @@ -263,11 +265,9 @@ void tst_QProcess::simpleStart() //----------------------------------------------------------------------------- void tst_QProcess::startDetached() { -#if QT_VERSION >= 0x040200 QProcess proc; QVERIFY(proc.startDetached("testProcessNormal/testProcessNormal", QStringList() << "arg1" << "arg2")); -#endif QCOMPARE(QProcess::startDetached("nonexistingexe"), false); } @@ -2000,5 +2000,29 @@ void tst_QProcess::startFinishStartFinish() } } +//----------------------------------------------------------------------------- +void tst_QProcess::invalidProgramString_data() +{ + QTest::addColumn<QString>("programString"); + QTest::newRow("null string") << QString(); + QTest::newRow("empty string") << QString(""); + QTest::newRow("only blank string") << QString(" "); +} + +void tst_QProcess::invalidProgramString() +{ + QFETCH(QString, programString); + QProcess process; + + qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError"); + QSignalSpy spy(&process, SIGNAL(error(QProcess::ProcessError))); + + process.start(programString); + QCOMPARE(process.error(), QProcess::FailedToStart); + QCOMPARE(spy.count(), 1); + + QVERIFY(!QProcess::startDetached(programString)); +} + QTEST_MAIN(tst_QProcess) #include "tst_qprocess.moc" diff --git a/tests/auto/qpushbutton/tst_qpushbutton.cpp b/tests/auto/qpushbutton/tst_qpushbutton.cpp index 34dd313..27dec9d 100644 --- a/tests/auto/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/qpushbutton/tst_qpushbutton.cpp @@ -206,11 +206,7 @@ void tst_QPushButton::setAutoRepeat() QVERIFY( !testWidget->isCheckable() ); // verify autorepeat is off by default. -#if QT_VERSION < 0x040000 - QButton tmp( 0 ); -#else QPushButton tmp( 0 ); -#endif tmp.setObjectName("tmp"); QVERIFY( !tmp.autoRepeat() ); diff --git a/tests/auto/qreadlocker/tst_qreadlocker.cpp b/tests/auto/qreadlocker/tst_qreadlocker.cpp index c650ff5..a37f93c 100644 --- a/tests/auto/qreadlocker/tst_qreadlocker.cpp +++ b/tests/auto/qreadlocker/tst_qreadlocker.cpp @@ -189,9 +189,6 @@ void tst_QReadLocker::unlockAndRelockTest() void tst_QReadLocker::lockerStateTest() { -#if QT_VERSION < 0x040200 - QSKIP("QReadLocker doesn't keep state in Qt < 4.2", SkipAll); -#else class LockerStateThread : public tst_QReadLockerThread { public: @@ -228,7 +225,6 @@ void tst_QReadLocker::lockerStateTest() delete thread; thread = 0; -#endif } QTEST_MAIN(tst_QReadLocker) diff --git a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp index 3cb57dd..5b2a9a9 100644 --- a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp +++ b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp @@ -943,10 +943,10 @@ void tst_QReadWriteLock::uncontendedLocks() } } - printf("during %d millisecs:\n", millisecs); - printf("counted to %u\n", count); - printf("%u uncontended read locks/unlocks\n", read); - printf("%u uncontended write locks/unlocks\n", write); + qDebug("during %d millisecs:", millisecs); + qDebug("counted to %u", count); + qDebug("%u uncontended read locks/unlocks", read); + qDebug("%u uncontended write locks/unlocks", write); } enum { RecursiveLockCount = 10 }; diff --git a/tests/auto/qrect/tst_qrect.cpp b/tests/auto/qrect/tst_qrect.cpp index ed605a3..7e8d9c3 100644 --- a/tests/auto/qrect/tst_qrect.cpp +++ b/tests/auto/qrect/tst_qrect.cpp @@ -432,14 +432,12 @@ void tst_QRect::normalized_data() QTest::newRow( "NegativePointQRect" ) << getQRectCase( NegativePointQRect ) << QRect( -10, -10, 5, 5 ); QTest::newRow( "NullQRect" ) << getQRectCase( NullQRect ) << getQRectCase( NullQRect ); QTest::newRow( "EmptyQRect" ) << getQRectCase( EmptyQRect ) << getQRectCase( EmptyQRect ); -#if QT_VERSION > 0x040001 QTest::newRow( "Task80908") << QRect(100, 200, 100, 0) << QRect(100, 200, 100, 0); // Since "NegativeSizeQRect passes, I expect both of these to pass too. // This passes, since height() returns -1 before normalization QTest::newRow( "Task85023") << QRect(QPoint(100,201), QPoint(199,199)) << QRect(QPoint(100,199), QPoint(199,201)); // This, on the other hand height() returns 0 before normalization. QTest::newRow( "Task85023.1") << QRect(QPoint(100,200), QPoint(199,199)) << QRect(QPoint(100,199), QPoint(199,200)); -#endif QTest::newRow( "Task188109" ) << QRect(QPoint(263, 113), QPoint(136, 112)) << QRect(QPoint(136, 113), QPoint(263, 112)); } @@ -1733,14 +1731,12 @@ void tst_QRect::newSetTopLeft_data() void tst_QRect::newSetTopLeft() { -#if QT_VERSION >= 0x030100 QFETCH( QRect, r ); QFETCH( QPoint, topLeft ); QFETCH( QRect, nr ); r.setTopLeft( topLeft ); QCOMPARE( r, nr ); -#endif } void tst_QRect::newSetBottomRight_data() @@ -1961,7 +1957,6 @@ void tst_QRect::newSetBottomRight_data() void tst_QRect::newSetBottomRight() { -#if QT_VERSION >= 0x030100 QFETCH( QRect, r ); QFETCH( QPoint, bottomRight ); QFETCH( QRect, nr ); @@ -1969,7 +1964,6 @@ void tst_QRect::newSetBottomRight() r.setBottomRight( bottomRight ); QCOMPARE( r, nr ); -#endif } void tst_QRect::newSetTopRight_data() @@ -2190,7 +2184,6 @@ void tst_QRect::newSetTopRight_data() void tst_QRect::newSetTopRight() { -#if QT_VERSION >= 0x030100 QFETCH( QRect, r ); QFETCH( QPoint, topRight ); QFETCH( QRect, nr ); @@ -2198,7 +2191,6 @@ void tst_QRect::newSetTopRight() r.setTopRight( topRight ); QCOMPARE( r, nr ); -#endif } void tst_QRect::newSetBottomLeft_data() @@ -2419,7 +2411,6 @@ void tst_QRect::newSetBottomLeft_data() void tst_QRect::newSetBottomLeft() { -#if QT_VERSION >= 0x030100 QFETCH( QRect, r ); QFETCH( QPoint, bottomLeft ); QFETCH( QRect, nr ); @@ -2427,7 +2418,6 @@ void tst_QRect::newSetBottomLeft() r.setBottomLeft( bottomLeft ); QCOMPARE( r, nr ); -#endif } void tst_QRect::topLeft_data() @@ -2787,7 +2777,6 @@ void tst_QRect::newMoveLeft_data() void tst_QRect::newMoveLeft() { -#if QT_VERSION >= 0x030100 QFETCH( QRect, r ); QFETCH( int, left ); QFETCH( QRect, nr ); @@ -2795,7 +2784,6 @@ void tst_QRect::newMoveLeft() r.moveLeft( left ); QCOMPARE( r, nr ); -#endif } void tst_QRect::newMoveTop_data() @@ -2958,7 +2946,6 @@ void tst_QRect::newMoveTop_data() void tst_QRect::newMoveTop() { -#if QT_VERSION >= 0x030100 QFETCH( QRect, r ); QFETCH( int, top ); QFETCH( QRect, nr ); @@ -2966,7 +2953,6 @@ void tst_QRect::newMoveTop() r.moveTop( top ); QCOMPARE( r, nr ); -#endif } void tst_QRect::newMoveRight_data() @@ -3114,7 +3100,6 @@ void tst_QRect::newMoveRight_data() void tst_QRect::newMoveRight() { -#if QT_VERSION >= 0x030100 QFETCH( QRect, r ); QFETCH( int, right ); QFETCH( QRect, nr ); @@ -3122,7 +3107,6 @@ void tst_QRect::newMoveRight() r.moveRight( right ); QCOMPARE( r, nr ); -#endif } void tst_QRect::newMoveBottom_data() @@ -3270,7 +3254,6 @@ void tst_QRect::newMoveBottom_data() void tst_QRect::newMoveBottom() { -#if QT_VERSION >= 0x030100 QFETCH( QRect, r ); QFETCH( int, bottom ); QFETCH( QRect, nr ); @@ -3278,7 +3261,6 @@ void tst_QRect::newMoveBottom() r.moveBottom( bottom ); QCOMPARE( r, nr ); -#endif } void tst_QRect::newMoveTopLeft_data() @@ -3468,7 +3450,6 @@ void tst_QRect::newMoveTopLeft_data() void tst_QRect::newMoveTopLeft() { -#if QT_VERSION >= 0x030100 QFETCH(QRect,r); QFETCH(QPoint,topLeft); QFETCH(QRect,nr); @@ -3476,7 +3457,6 @@ void tst_QRect::newMoveTopLeft() r.moveTopLeft(topLeft); QCOMPARE(r,nr); -#endif } void tst_QRect::newMoveBottomRight_data() @@ -3666,7 +3646,6 @@ void tst_QRect::newMoveBottomRight_data() void tst_QRect::newMoveBottomRight() { -#if QT_VERSION >= 0x030100 QFETCH(QRect,r); QFETCH(QPoint,bottomRight); QFETCH(QRect,nr); @@ -3674,11 +3653,9 @@ void tst_QRect::newMoveBottomRight() r.moveBottomRight(bottomRight); QCOMPARE(r,nr); -#endif } - void tst_QRect::translate_data() { QTest::addColumn<QRect>("r"); @@ -3720,10 +3697,8 @@ void tst_QRect::translate() } - void tst_QRect::moveTop() { -#if QT_VERSION >= 0x030100 { QRect r( 10, 10, 100, 100 ); r.moveTop( 3 ); @@ -3742,12 +3717,10 @@ void tst_QRect::moveTop() r.moveTop( -22 ); QCOMPARE( r, QRectF(10, -22, 100, 100) ); } -#endif } void tst_QRect::moveBottom() { -#if QT_VERSION >= 0x030100 { QRect r( 10, -22, 100, 100 ); r.moveBottom( 104 ); @@ -3758,12 +3731,10 @@ void tst_QRect::moveBottom() r.moveBottom( 104 ); QCOMPARE( r, QRectF(10, 4, 100, 100) ); } -#endif } void tst_QRect::moveLeft() { -#if QT_VERSION >= 0x030100 { QRect r( 10, 5, 100, 100 ); r.moveLeft( 11 ); @@ -3774,12 +3745,10 @@ void tst_QRect::moveLeft() r.moveLeft( 11 ); QCOMPARE( r, QRectF(11, 5, 100, 100) ); } -#endif } void tst_QRect::moveRight() { -#if QT_VERSION >= 0x030100 { QRect r( 11, 5, 100, 100 ); r.moveRight( 106 ); @@ -3790,7 +3759,6 @@ void tst_QRect::moveRight() r.moveRight( 106 ); QCOMPARE( r, QRectF(6, 5, 100, 100) ); } -#endif } void tst_QRect::moveTopLeft() @@ -3851,7 +3819,6 @@ void tst_QRect::moveBottomRight() void tst_QRect::setTopLeft() { -#if QT_VERSION >= 0x030100 { QRect r( 20, 10, 200, 100 ); r.setTopLeft( QPoint(5, 7) ); @@ -3862,12 +3829,10 @@ void tst_QRect::setTopLeft() r.setTopLeft( QPoint(5, 7) ); QCOMPARE( r, QRectF(5, 7, 215, 103) ); } -#endif } void tst_QRect::setTopRight() { -#if QT_VERSION >= 0x030100 { QRect r( 20, 10, 200, 100 ); r.setTopRight( QPoint(225, 7) ); @@ -3878,12 +3843,10 @@ void tst_QRect::setTopRight() r.setTopRight( QPoint(225, 7) ); QCOMPARE( r, QRectF(20, 7, 205, 103) ); } -#endif } void tst_QRect::setBottomLeft() { -#if QT_VERSION >= 0x030100 { QRect r( 20, 10, 200, 100 ); r.setBottomLeft( QPoint(5, 117) ); @@ -3894,12 +3857,10 @@ void tst_QRect::setBottomLeft() r.setBottomLeft( QPoint(5, 117) ); QCOMPARE( r, QRectF(5, 10, 215, 107) ); } -#endif } void tst_QRect::setBottomRight() { -#if QT_VERSION >= 0x030100 { QRect r( 20, 10, 200, 100 ); r.setBottomRight( QPoint(225, 117) ); @@ -3910,7 +3871,6 @@ void tst_QRect::setBottomRight() r.setBottomRight( QPoint(225, 117) ); QCOMPARE( r, QRectF(20, 10, 205, 107) ); } -#endif } void tst_QRect::operator_amp() diff --git a/tests/auto/qregexp/tst_qregexp.cpp b/tests/auto/qregexp/tst_qregexp.cpp index 2968a8e..999166e 100644 --- a/tests/auto/qregexp/tst_qregexp.cpp +++ b/tests/auto/qregexp/tst_qregexp.cpp @@ -557,7 +557,6 @@ void tst_QRegExp::setMinimal() void tst_QRegExp::exactMatch() { -#if QT_VERSION >= 0x030100 QRegExp rx_d( "\\d" ); QRegExp rx_s( "\\s" ); QRegExp rx_w( "\\w" ); @@ -570,9 +569,7 @@ void tst_QRegExp::exactMatch() bool is_d = ( ch.category() == QChar::Number_DecimalDigit ); bool is_s = ch.isSpace(); bool is_w = ( ch.isLetterOrNumber() -#if QT_VERSION >= 0x040200 || ch.isMark() -#endif || ch == '_' ); QVERIFY( rx_d.exactMatch(QString(ch)) == is_d ); @@ -582,7 +579,6 @@ void tst_QRegExp::exactMatch() QVERIFY( rx_S.exactMatch(QString(ch)) != is_s ); QVERIFY( rx_W.exactMatch(QString(ch)) != is_w ); } -#endif } void tst_QRegExp::capturedTexts() @@ -593,13 +589,11 @@ void tst_QRegExp::capturedTexts() QCOMPARE(rx1.cap(0), QString("aaa")); QCOMPARE(rx1.cap(1), QString("aaa")); -#if QT_VERSION >= 0x040200 QRegExp rx2("a*(a*)", Qt::CaseSensitive, QRegExp::RegExp2); rx2.exactMatch("aaa"); QCOMPARE(rx2.matchedLength(), 3); QCOMPARE(rx2.cap(0), QString("aaa")); QCOMPARE(rx2.cap(1), QString("")); -#endif QRegExp rx3("(?:a|aa)(a*)", Qt::CaseSensitive, QRegExp::RegExp); rx3.exactMatch("aaa"); @@ -607,13 +601,11 @@ void tst_QRegExp::capturedTexts() QCOMPARE(rx3.cap(0), QString("aaa")); QCOMPARE(rx3.cap(1), QString("aa")); -#if QT_VERSION >= 0x040200 QRegExp rx4("(?:a|aa)(a*)", Qt::CaseSensitive, QRegExp::RegExp2); rx4.exactMatch("aaa"); QCOMPARE(rx4.matchedLength(), 3); QCOMPARE(rx4.cap(0), QString("aaa")); QCOMPARE(rx4.cap(1), QString("a")); -#endif QRegExp rx5("(a)*(a*)", Qt::CaseSensitive, QRegExp::RegExp); rx5.exactMatch("aaa"); @@ -622,14 +614,12 @@ void tst_QRegExp::capturedTexts() QCOMPARE(rx5.cap(1), QString("a")); QCOMPARE(rx5.cap(2), QString("aa")); -#if QT_VERSION >= 0x040200 QRegExp rx6("(a)*(a*)", Qt::CaseSensitive, QRegExp::RegExp2); rx6.exactMatch("aaa"); QCOMPARE(rx6.matchedLength(), 3); QCOMPARE(rx6.cap(0), QString("aaa")); QCOMPARE(rx6.cap(1), QString("a")); QCOMPARE(rx6.cap(2), QString("")); -#endif QRegExp rx7("([A-Za-z_])([A-Za-z_0-9]*)"); rx7.setCaseSensitivity(Qt::CaseSensitive); @@ -689,7 +679,6 @@ void tst_QRegExp::indexIn() } } -#if QT_VERSION >= 0x040200 // same as above, but with RegExp2 { QRegExp rx( regexpStr, Qt::CaseSensitive, QRegExp::RegExp2 ); @@ -707,7 +696,6 @@ void tst_QRegExp::indexIn() QCOMPARE( mycaps[i], caps[i] ); } } -#endif } void tst_QRegExp::lastIndexIn() @@ -746,7 +734,6 @@ void tst_QRegExp::lastIndexIn() } } -#if QT_VERSION >= 0x040200 { QRegExp rx( regexpStr, Qt::CaseSensitive, QRegExp::RegExp2 ); QVERIFY( rx.isValid() ); @@ -766,7 +753,6 @@ void tst_QRegExp::lastIndexIn() } } } -#endif } void tst_QRegExp::matchedLength() @@ -1161,10 +1147,8 @@ void tst_QRegExp::prepareEngineOptimization() QRegExp rx4("foo", Qt::CaseInsensitive, QRegExp::RegExp); QVERIFY(rx4.isValid()); -#if QT_VERSION >= 0x040200 QRegExp rx5("foo", Qt::CaseInsensitive, QRegExp::RegExp2); QVERIFY(rx5.isValid()); -#endif QRegExp rx6("foo", Qt::CaseInsensitive, QRegExp::FixedString); QVERIFY(rx6.isValid()); @@ -1175,10 +1159,8 @@ void tst_QRegExp::prepareEngineOptimization() QRegExp rx8("][", Qt::CaseInsensitive, QRegExp::RegExp); QVERIFY(!rx8.isValid()); -#if QT_VERSION >= 0x040200 QRegExp rx9("][", Qt::CaseInsensitive, QRegExp::RegExp2); QVERIFY(!rx9.isValid()); -#endif QRegExp rx10("][", Qt::CaseInsensitive, QRegExp::Wildcard); QVERIFY(!rx10.isValid()); diff --git a/tests/auto/qregion/tst_qregion.cpp b/tests/auto/qregion/tst_qregion.cpp index 8ec4c28..eba07f2 100644 --- a/tests/auto/qregion/tst_qregion.cpp +++ b/tests/auto/qregion/tst_qregion.cpp @@ -145,12 +145,7 @@ void tst_QRegion::rects() { QRect rect( 10, -20, 30, 40 ); QRegion region( rect ); -#if QT_VERSION < 0x040000 - QCOMPARE( region.rects().count(), (uint)1 ); -#else QCOMPARE( region.rects().count(), 1 ); -#endif - QCOMPARE( region.rects()[0], rect ); } { @@ -200,11 +195,7 @@ void tst_QRegion::setRects() QRegion region; QRect rect( 10, -20, 30, 40 ); region.setRects( &rect, 1 ); -#if QT_VERSION < 0x040000 - QCOMPARE( region.rects().count(), (uint)1 ); -#else QCOMPARE( region.rects().count(), 1 ); -#endif QCOMPARE( region.rects()[0], rect ); } } @@ -374,9 +365,7 @@ void tst_QRegion::bitmapRegion() QVERIFY( region.contains( QPoint( 0, 10 ) ) ); // Mid-left QVERIFY( region.contains( QPoint( 10, 0 ) ) ); // Mid-top -#if ( QT_VERSION >= 0x030100 ) QVERIFY( region.contains( QPoint( 19, 10 ) ) ); // Mid-right -#endif QVERIFY( region.contains( QPoint( 10, 19 ) ) ); // Mid-bottom } } @@ -627,11 +616,9 @@ void tst_QRegion::operator_minus_data() QTest::addColumn<QRegion>("subtract"); QTest::addColumn<QRegion>("expected"); -#if !defined(Q_WS_X11) || QT_VERSION >= 0x040300 QTest::newRow("empty 0") << QRegion() << QRegion() << QRegion(); QTest::newRow("empty 1") << QRegion() << QRegion(QRect(10, 10, 10, 10)) << QRegion(); -#endif QTest::newRow("empty 2") << QRegion(QRect(10, 10, 10, 10)) << QRegion() << QRegion(QRect(10, 10, 10, 10)); diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 9995b46..5339fb4 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1187,6 +1187,16 @@ static void fooFromScriptValue(const QScriptValue &value, Foo &foo) foo.y = value.property("y").toInt32(); } +static QScriptValue fooToScriptValueV2(QScriptEngine *eng, const Foo &foo) +{ + return QScriptValue(eng, foo.x); +} + +static void fooFromScriptValueV2(const QScriptValue &value, Foo &foo) +{ + foo.x = value.toInt32(); +} + Q_DECLARE_METATYPE(QLinkedList<QString>) Q_DECLARE_METATYPE(QList<Foo>) Q_DECLARE_METATYPE(QVector<QChar>) @@ -1427,6 +1437,24 @@ void tst_QScriptEngine::valueConversion() QVERIFY(val.isVariant()); QCOMPARE(val.toVariant(), var); } + + // task 248802 + qScriptRegisterMetaType<Foo>(&eng, fooToScriptValueV2, fooFromScriptValueV2); + { + QScriptValue num(&eng, 123); + Foo foo = qScriptValueToValue<Foo>(num); + QCOMPARE(foo.x, 123); + } + { + QScriptValue num(123); + Foo foo = qScriptValueToValue<Foo>(num); + QCOMPARE(foo.x, -1); + } + { + QScriptValue str(&eng, "123"); + Foo foo = qScriptValueToValue<Foo>(str); + QCOMPARE(foo.x, 123); + } } static QScriptValue __import__(QScriptContext *ctx, QScriptEngine *eng) diff --git a/tests/auto/qset/tst_qset.cpp b/tests/auto/qset/tst_qset.cpp index 7afcd84..5601656 100644 --- a/tests/auto/qset/tst_qset.cpp +++ b/tests/auto/qset/tst_qset.cpp @@ -619,9 +619,6 @@ void tst_QSet::stlIterator() void tst_QSet::stlMutableIterator() { -#if QT_VERSION < 0x040200 - QSKIP("Needs Qt >= 4.2", SkipAll); -#else QSet<QString> set1; for (int i = 0; i < 25000; ++i) set1.insert(QString::number(i)); @@ -679,7 +676,6 @@ void tst_QSet::stlMutableIterator() #endif QVERIFY(*i == "foo"); } -#endif } void tst_QSet::javaIterator() @@ -768,9 +764,6 @@ void tst_QSet::javaIterator() void tst_QSet::javaMutableIterator() { -#if QT_VERSION < 0x040200 - QSKIP("Needs Qt >= 4.2", SkipAll); -#else QSet<QString> set1; for (int k = 0; k < 25000; ++k) set1.insert(QString::number(k)); @@ -856,7 +849,6 @@ void tst_QSet::javaMutableIterator() QVERIFY(set2.isEmpty()); QVERIFY(set3.isEmpty()); } -#endif } void tst_QSet::makeSureTheComfortFunctionsCompile() diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp index 9524eb3..c478c63 100644 --- a/tests/auto/qsettings/tst_qsettings.cpp +++ b/tests/auto/qsettings/tst_qsettings.cpp @@ -240,7 +240,6 @@ static QString settingsPath(const char *path = "") return QDir::toNativeSeparators(tempPath + "/tst_QSettings/" + QLatin1String(path)); } -#if QT_VERSION >= 0x040100 static bool readCustom1File(QIODevice &device, QSettings::SettingsMap &map) { QDataStream in(&device); @@ -297,7 +296,6 @@ static bool writeCustom3File(QIODevice &device, const QSettings::SettingsMap &ma out << "OK"; return true; } -#endif static void populateWithFormats() { @@ -305,15 +303,12 @@ static void populateWithFormats() QTest::newRow("native") << QSettings::NativeFormat; QTest::newRow("ini") << QSettings::IniFormat; -#if QT_VERSION >= 0x040100 QTest::newRow("custom1") << QSettings::CustomFormat1; QTest::newRow("custom2") << QSettings::CustomFormat2; -#endif } tst_QSettings::tst_QSettings() { -#if QT_VERSION >= 0x040100 QSettings::Format custom1 = QSettings::registerFormat("custom1", readCustom1File, writeCustom1File); QSettings::Format custom2 = QSettings::registerFormat("custom2", readCustom2File, writeCustom2File #ifndef QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER @@ -322,7 +317,6 @@ tst_QSettings::tst_QSettings() ); QVERIFY(custom1 == QSettings::CustomFormat1); QVERIFY(custom2 == QSettings::CustomFormat2); -#endif } void tst_QSettings::init() @@ -1138,9 +1132,9 @@ void tst_QSettings::testVariantTypes() l4 << QVariant(m2) << QVariant(l2) << QVariant(l3); testVal("key13", l4, QVariantList, List); - // With Qt 4.2 we store key sequences as strings instead of binary variant blob, for improved + // We store key sequences as strings instead of binary variant blob, for improved // readability in the resulting format. - if (format >= QSettings::InvalidFormat || QT_VERSION < 0x040200) { + if (format >= QSettings::InvalidFormat) { testVal("keysequence", QKeySequence(Qt::ControlModifier + Qt::Key_F1), QKeySequence, KeySequence); } else { testVal("keysequence", QKeySequence(Qt::ControlModifier + Qt::Key_F1), QString, String); @@ -2637,14 +2631,12 @@ void tst_QSettings::testCaseSensitivity() case QSettings::IniFormat: cs = false; break; -#if QT_VERSION >= 0x040100 case QSettings::CustomFormat1: cs = true; break; case QSettings::CustomFormat2: cs = false; break; -#endif default: ; } @@ -3543,7 +3535,6 @@ void tst_QSettings::allKeys() } } -#if QT_VERSION >= 0x040100 void tst_QSettings::registerFormat() { QSettings settings1(QSettings::IniFormat, QSettings::UserScope, "software.org", "KillerAPP"); @@ -3641,7 +3632,6 @@ void tst_QSettings::setPath() TEST_PATH(i == 0, "custom2", CustomFormat2, SystemScope, "iota") } } -#endif void tst_QSettings::setDefaultFormat() { diff --git a/tests/auto/qsizef/tst_qsizef.cpp b/tests/auto/qsizef/tst_qsizef.cpp index 7668491..c1a827b 100644 --- a/tests/auto/qsizef/tst_qsizef.cpp +++ b/tests/auto/qsizef/tst_qsizef.cpp @@ -72,29 +72,6 @@ private slots: void transpose(); }; -#if QT_VERSION < 0x040100 -namespace QTest -{ - // Qt < 4.1 didn't do fuzzy comparisons - template<> - inline bool compare(QSizeF const &t1, QSizeF const &t2, const char *file, int line) - { - char msg[1024]; - msg[0] = '\0'; - bool isOk = true; - if ((qAbs(t1.width() - t2.width()) > 0.000000000001) || (qAbs(t1.height() - t2.height()) > 0.000000000001)) { - qt_snprintf(msg, 1024, "Compared values of type QSizeF are not the same (fuzzy compare).\n" - " Actual : w: %lf h: %lf \n" - " Expected: w: %lf h: %lf", t1.width(), t1.height(), t2.width(), t2.height()); - isOk = false; - } else { - qt_snprintf(msg, 1024, "QCOMPARE('%lf %lf', QSizeF)", t1.width(), t1.height()); - } - return compare_helper(isOk, msg, file, line); - } -} -#endif - tst_QSizeF::tst_QSizeF() { } diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 9f92c37..18aa5fc 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -129,6 +129,10 @@ private slots: void task236755_hiddenColumns(); void task247867_insertRowsSort(); + void task248868_staticSorting(); + void task248868_dynamicSorting(); + void task250023_fetchMore(); + void task251296_hiddenChildren(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -1505,9 +1509,6 @@ void tst_QSortFilterProxyModel::insertAfterSelect() QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, p); QVERIFY(view.selectionModel()->selectedIndexes().size() > 0); model.insertRows(5, 1, QModelIndex()); -#if QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Selections are not kept in versions < 4.2", Abort); -#endif QVERIFY(view.selectionModel()->selectedIndexes().size() > 0); // Should still have a selection } @@ -1529,9 +1530,6 @@ void tst_QSortFilterProxyModel::removeAfterSelect() QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, p); QVERIFY(view.selectionModel()->selectedIndexes().size() > 0); model.removeRows(5, 1, QModelIndex()); -#if QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Selections are not kept in versions < 4.2", Abort); -#endif QVERIFY(view.selectionModel()->selectedIndexes().size() > 0); // Should still have a selection } @@ -2479,5 +2477,246 @@ void tst_QSortFilterProxyModel::task247867_insertRowsSort() QCOMPARE(proxyModel.sortColumn(), 0); } +void tst_QSortFilterProxyModel::task248868_staticSorting() +{ + QStandardItemModel model(0, 1); + QSortFilterProxyModel proxy; + proxy.setSourceModel(&model); + proxy.setDynamicSortFilter(false); + QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" "); + + // prepare model + QStandardItem *root = model.invisibleRootItem (); + QList<QStandardItem *> items; + for (int i = 0; i < initial.count(); ++i) { + items.append(new QStandardItem(initial.at(i))); + } + root->insertRows(0, items); + QCOMPARE(model.rowCount(QModelIndex()), initial.count()); + QCOMPARE(model.columnCount(QModelIndex()), 1); + + // make sure the proxy is unsorted + QCOMPARE(proxy.columnCount(QModelIndex()), 1); + QCOMPARE(proxy.rowCount(QModelIndex()), initial.count()); + for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy.index(row, 0, QModelIndex()); + QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initial.at(row)); + } + + // sort + proxy.sort(0); + + QStringList expected = initial; + expected.sort(); + // make sure the proxy is sorted + for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy.index(row, 0, QModelIndex()); + QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row)); + } + + //update one item. + model.setItem(0, 0, new QStandardItem("girafe")); + + // make sure the proxy is updated but not sorted + expected.replaceInStrings("bateau", "girafe"); + for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy.index(row, 0, QModelIndex()); + QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row)); + } + + // sort again + proxy.sort(0); + expected.sort(); + + // make sure the proxy is sorted + for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy.index(row, 0, QModelIndex()); + QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row)); + } + +} + +void tst_QSortFilterProxyModel::task248868_dynamicSorting() +{ + QStringListModel model1; + const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" "); + model1.setStringList(initial); + QSortFilterProxyModel proxy1; + proxy1.sort(0); + proxy1.setSourceModel(&model1); + + QCOMPARE(proxy1.columnCount(QModelIndex()), 1); + //the model should not be sorted because sorting has not been set to dynamic yet. + QCOMPARE(proxy1.rowCount(QModelIndex()), initial.count()); + for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy1.index(row, 0, QModelIndex()); + QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), initial.at(row)); + } + + proxy1.setDynamicSortFilter(true); + + //now the model should be sorted. + QStringList expected = initial; + expected.sort(); + for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy1.index(row, 0, QModelIndex()); + QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), expected.at(row)); + } + + QStringList initial2 = initial; + initial2.replaceInStrings("bateau", "girafe"); + model1.setStringList(initial2); //this will cause a reset + + QStringList expected2 = initial2; + expected2.sort(); + + //now the model should still be sorted. + for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy1.index(row, 0, QModelIndex()); + QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), expected2.at(row)); + } + + QStringListModel model2(initial); + proxy1.setSourceModel(&model2); + + //the model should again be sorted + for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy1.index(row, 0, QModelIndex()); + QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), expected.at(row)); + } +} + +class QtTestModel: public QAbstractItemModel +{ + public: + QtTestModel(int _rows, int _cols, QObject *parent = 0): QAbstractItemModel(parent), + rows(_rows), cols(_cols), wrongIndex(false) { } + + bool canFetchMore(const QModelIndex &idx) const { + return !fetched.contains(idx); + } + + void fetchMore(const QModelIndex &idx) { + if (fetched.contains(idx)) + return; + beginInsertRows(idx, 0, rows-1); + fetched.insert(idx); + endInsertRows(); + } + + bool hasChildren(const QModelIndex & = QModelIndex()) const { + return true; + } + + int rowCount(const QModelIndex& parent = QModelIndex()) const { + return fetched.contains(parent) ? rows : 0; + } + int columnCount(const QModelIndex& parent = QModelIndex()) const { + return cols; + } + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const + { + if (row < 0 || column < 0 || column >= cols || row >= rows) { + return QModelIndex(); + } + QModelIndex i = createIndex(row, column, int(parent.internalId() + 1)); + parentHash[i] = parent; + return i; + } + + QModelIndex parent(const QModelIndex &index) const + { + if (!parentHash.contains(index)) + return QModelIndex(); + return parentHash[index]; + } + + QVariant data(const QModelIndex &idx, int role) const + { + if (!idx.isValid()) + return QVariant(); + + if (role == Qt::DisplayRole) { + if (idx.row() < 0 || idx.column() < 0 || idx.column() >= cols || idx.row() >= rows) { + wrongIndex = true; + qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), + idx.internalPointer()); + } + return QString("[%1,%2]").arg(idx.row()).arg(idx.column()); + } + return QVariant(); + } + + QSet<QModelIndex> fetched; + int rows, cols; + mutable bool wrongIndex; + mutable QMap<QModelIndex,QModelIndex> parentHash; +}; + +void tst_QSortFilterProxyModel::task250023_fetchMore() +{ + QtTestModel model(10,10); + QSortFilterProxyModel proxy; + proxy.setSourceModel(&model); + QVERIFY(proxy.canFetchMore(QModelIndex())); + QVERIFY(proxy.hasChildren()); + while (proxy.canFetchMore(QModelIndex())) + proxy.fetchMore(QModelIndex()); + QCOMPARE(proxy.rowCount(), 10); + QCOMPARE(proxy.columnCount(), 10); + + QModelIndex idx = proxy.index(1,1); + QVERIFY(idx.isValid()); + QVERIFY(proxy.canFetchMore(idx)); + QVERIFY(proxy.hasChildren(idx)); + while (proxy.canFetchMore(idx)) + proxy.fetchMore(idx); + QCOMPARE(proxy.rowCount(idx), 10); + QCOMPARE(proxy.columnCount(idx), 10); +} + +void tst_QSortFilterProxyModel::task251296_hiddenChildren() +{ + QStandardItemModel model; + QSortFilterProxyModel proxy; + proxy.setSourceModel(&model); + proxy.setDynamicSortFilter(true); + + QStandardItem *itemA = new QStandardItem("A VISIBLE"); + model.appendRow(itemA); + QStandardItem *itemB = new QStandardItem("B VISIBLE"); + itemA->appendRow(itemB); + QStandardItem *itemC = new QStandardItem("C"); + itemA->appendRow(itemC); + proxy.setFilterRegExp("VISIBLE"); + + QCOMPARE(proxy.rowCount(QModelIndex()) , 1); + QPersistentModelIndex indexA = proxy.index(0,0); + QCOMPARE(proxy.data(indexA).toString(), QString::fromLatin1("A VISIBLE")); + + QCOMPARE(proxy.rowCount(indexA) , 1); + QPersistentModelIndex indexB = proxy.index(0, 0, indexA); + QCOMPARE(proxy.data(indexB).toString(), QString::fromLatin1("B VISIBLE")); + + itemA->setText("A"); + QCOMPARE(proxy.rowCount(QModelIndex()), 0); + QVERIFY(!indexA.isValid()); + QVERIFY(!indexB.isValid()); + + itemB->setText("B"); + itemA->setText("A VISIBLE"); + itemC->setText("C VISIBLE"); + + QCOMPARE(proxy.rowCount(QModelIndex()), 1); + indexA = proxy.index(0,0); + QCOMPARE(proxy.data(indexA).toString(), QString::fromLatin1("A VISIBLE")); + + QCOMPARE(proxy.rowCount(indexA) , 1); + QModelIndex indexC = proxy.index(0, 0, indexA); + QCOMPARE(proxy.data(indexC).toString(), QString::fromLatin1("C VISIBLE")); +} + + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index b529b7e..611077f 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -105,10 +105,7 @@ inline static QString qTableName( const QString& prefix, QSqlDriver* driver = 0 inline static bool testWhiteSpaceNames( const QString &name ) { - return name.startsWith( "QPSQL" ) - || name.startsWith( "QODBC" ) - || name.startsWith( "QSQLITE" ) - || name.startsWith( "QMYSQL" ); + return name != QLatin1String("QTDS7"); } inline static QString toHex( const QString& binary ) @@ -203,7 +200,7 @@ public: { // addDb( "QOCI8", "//horsehead.nokia.troll.no:1521/pony.troll.no", "scott", "tiger" ); // Oracle 9i on horsehead // addDb( "QOCI8", "//horsehead.nokia.troll.no:1521/ustest.troll.no", "scott", "tiger", "" ); // Oracle 9i on horsehead -// addDb( "QOCI8", "ICE", "scott", "tiger", "" ); // Oracle 8 on iceblink +// addDb( "QOCI8", "//iceblink.nokia.troll.no:1521/ice.troll.no", "scott", "tiger", "" ); // Oracle 8 on iceblink (not currently working) // addDb( "QOCI", "//silence.nokia.troll.no:1521/testdb", "scott", "tiger" ); // Oracle 10g on silence // addDb( "QOCI", "//oracle10g-nokia.trolltech.com.au:1521/XE", "scott", "tiger" ); // Oracle 10gexpress on xen @@ -220,7 +217,7 @@ public: // addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3309, "CLIENT_COMPRESS=1;CLIENT_SSL=1" ); // MySQL 5.0.18 Linux // addDb( "QMYSQL3", "testdb", "troll", "trond", "iceblink.nokia.troll.no" ); // MySQL 5.0.13 Windows // addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql4-nokia.trolltech.com.au" ); // MySQL 4.1.22-2.el4 linux -// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql5-nokia.trolltech.com.au" ); // MySQL 5.0.45-7.el5 linux +// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql5-nokia.trolltech.com.au" ); // MySQL 5.0.45-7.el5 linux // addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no" ); // V7.2 NOT SUPPORTED! // addDb( "QPSQL7", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 5434 ); // V7.2 NOT SUPPORTED! Multi-byte @@ -231,7 +228,7 @@ public: // addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres74-nokia.trolltech.com.au" ); // Version 7.4.19-1.el4_6.1 // addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres81-nokia.trolltech.com.au" ); // Version 8.1.11-1.el5_1.1 -// addDb( "QDB2", "testdb", "troll", "trond", "silence" ); // DB2 v9.1 on silence +// addDb( "QDB2", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // DB2 v9.1 on silence // yes - interbase really wants the physical path on the host machine. // addDb( "QIBASE", "/opt/interbase/qttest.gdb", "SYSDBA", "masterkey", "horsehead.nokia.troll.no" ); @@ -240,17 +237,16 @@ public: // addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "firebird1-nokia.trolltech.com.au" ); // Firebird 1.5.5 // addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "firebird2-nokia.trolltech.com.au" ); // Firebird 2.1.1 -// Anders' local Firebird and InterBase test databases -// addDb("QIBASE", "localhost:c:\\Firebird\\Firebird_2_0\\TESTDB.FDB", "SYSDBA", "masterkey", ""); // FireBird 2.0 -// addDb("QIBASE", "localhost:c:\\Borland\\InterBase\\TESTDB_UTF8.IB", "SYSDBA", "masterkey", ""); // InterBase 2007 Developer - // use in-memory database to prevent local files -// addDb("QSQLITE", ":memory:"); - addDb( "QSQLITE", QDir::toNativeSeparators(QDir::tempPath()+"/foo.db") ); + addDb("QSQLITE", ":memory:"); +// addDb( "QSQLITE", QDir::toNativeSeparators(QDir::tempPath()+"/foo.db") ); // addDb( "QSQLITE2", QDir::toNativeSeparators(QDir::tempPath()+"/foo2.db") ); // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=iceblink.nokia.troll.no\\ICEBLINK", "troll", "trond", "" ); // addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.nokia.troll.no\\SQLEXPRESS", "troll", "trond", "" ); +// addDb( "QODBC", "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" ); + } void open() @@ -312,20 +308,24 @@ public: // drop a table only if it exists to prevent warnings static void safeDropTables( QSqlDatabase db, const QStringList& tableNames ) { - int wasDropped = true; + bool wasDropped; QSqlQuery q( db ); QStringList dbtables=db.tables(); foreach(QString tableName, tableNames) { + wasDropped = true; + QString table=tableName; + if ( db.driver()->isIdentifierEscaped(table, QSqlDriver::TableName)) + table = db.driver()->stripDelimiters(table, QSqlDriver::TableName); - if ( dbtables.contains( tableName, Qt::CaseSensitive ) ) - wasDropped = q.exec( "drop table " + db.driver()->escapeIdentifier( tableName, QSqlDriver::TableName ) ); - else if ( dbtables.contains( tableName, Qt::CaseInsensitive ) ) - wasDropped = q.exec( "drop table " + tableName ); + if ( dbtables.contains( table, Qt::CaseSensitive ) ) + wasDropped = q.exec( "drop table " + tableName); + else if ( dbtables.contains( table, Qt::CaseInsensitive ) ) + wasDropped = q.exec( "drop table " + tableName); if ( !wasDropped ) - qWarning() << "unable to drop table" << tableName << ':' << q.lastError().text(); + qWarning() << dbToString(db) << "unable to drop table" << tableName << ':' << q.lastError().text() << "tables:" << dbtables; } } @@ -401,7 +401,7 @@ public: static QByteArray printError( const QSqlError& err, const QSqlDatabase& db ) { - return QString( db.driverName() + ": '" + err.driverText() + "' || '" + err.databaseText() + "'" ).toLocal8Bit(); + return QString( dbToString(db) + ": '" + err.driverText() + "' || '" + err.databaseText() + "'" ).toLocal8Bit(); } static bool isSqlServer( QSqlDatabase db ) diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 7396dd5..8dede12 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -93,28 +93,28 @@ private slots: void addDatabase(); //database specific tests - void recordMySQL_data(); + void recordMySQL_data() { generic_data("QMYSQL"); } void recordMySQL(); - void recordPSQL_data(); + void recordPSQL_data() { generic_data("QPSQL"); } void recordPSQL(); - void recordOCI_data(); + void recordOCI_data() { generic_data("QOCI"); } void recordOCI(); - void recordTDS_data(); + void recordTDS_data() { generic_data("QTDS"); } void recordTDS(); - void recordDB2_data(); + void recordDB2_data() { generic_data("QDB2"); } void recordDB2(); - void recordSQLite_data(); + void recordSQLite_data() { generic_data("QSQLITE"); } void recordSQLite(); - void recordAccess_data(); + void recordAccess_data() { generic_data("QODBC"); } void recordAccess(); - void recordSQLServer_data(); + void recordSQLServer_data() { generic_data("QODBC"); } void recordSQLServer(); - void recordIBase_data(); + void recordIBase_data() {generic_data("QIBASE"); } void recordIBase(); - void eventNotificationIBase_data() { generic_data(); } + void eventNotificationIBase_data() { generic_data("QIBASE"); } void eventNotificationIBase(); - void eventNotificationPSQL_data() { generic_data(); } + void eventNotificationPSQL_data() { generic_data("QPSQL"); } void eventNotificationPSQL(); //database specific 64 bit integer test @@ -141,59 +141,65 @@ private slots: void precisionPolicy_data() { generic_data(); } void precisionPolicy(); - void db2_valueCacheUpdate_data() { generic_data(); } + void db2_valueCacheUpdate_data() { generic_data("QDB2"); } void db2_valueCacheUpdate(); - void psql_schemas_data(); + void psql_schemas_data() { generic_data("QPSQL"); } void psql_schemas(); - void psql_escapedIdentifiers_data(){ psql_schemas_data(); } + void psql_escapedIdentifiers_data() { generic_data("QPSQL"); } void psql_escapedIdentifiers(); - void psql_escapeBytea_data() { generic_data(); } + void psql_escapeBytea_data() { generic_data("QPSQL"); } void psql_escapeBytea(); + void bug_249059_data() { generic_data("QPSQL"); } + void bug_249059(); void mysqlOdbc_unsignedIntegers_data() { generic_data(); } void mysqlOdbc_unsignedIntegers(); - void mysql_multiselect_data() { generic_data(); } + void mysql_multiselect_data() { generic_data("QMYSQL"); } void mysql_multiselect(); // For task 144331 void accessOdbc_strings_data() { generic_data(); } void accessOdbc_strings(); - void ibase_numericFields_data() { generic_data(); } + void ibase_numericFields_data() { generic_data("QIBASE"); } void ibase_numericFields(); // For task 125053 - void ibase_fetchBlobs_data() { generic_data(); } + void ibase_fetchBlobs_data() { generic_data("QIBASE"); } void ibase_fetchBlobs(); // For task 143471 - void ibase_useCustomCharset_data() { generic_data(); } + void ibase_useCustomCharset_data() { generic_data("QIBASE"); } void ibase_useCustomCharset(); // For task 134608 - void ibase_procWithoutReturnValues_data() { generic_data(); } // For task 165423 + void ibase_procWithoutReturnValues_data() { generic_data("QIBASE"); } // For task 165423 void ibase_procWithoutReturnValues(); - void ibase_procWithReturnValues_data() { generic_data(); } // For task 177530 + void ibase_procWithReturnValues_data() { generic_data("QIBASE"); } // For task 177530 void ibase_procWithReturnValues(); - void odbc_reopenDatabase_data() { generic_data(); } + void odbc_reopenDatabase_data() { generic_data("QODBC"); } void odbc_reopenDatabase(); - void odbc_uniqueidentifier_data() { generic_data(); } + void odbc_uniqueidentifier_data() { generic_data("QODBC"); } void odbc_uniqueidentifier(); // For task 141822 - void odbc_uintfield_data() { generic_data(); } + void odbc_uintfield_data() { generic_data("QODBC"); } void odbc_uintfield(); - void odbc_bindBoolean_data() { generic_data(); } + void odbc_bindBoolean_data() { generic_data("QODBC"); } void odbc_bindBoolean(); - void oci_serverDetach_data() { generic_data(); } + void oci_serverDetach_data() { generic_data("QOCI"); } void oci_serverDetach(); // For task 154518 - void oci_xmltypeSupport_data() { generic_data(); } + void oci_xmltypeSupport_data() { generic_data("QOCI"); } void oci_xmltypeSupport(); - void oci_fieldLength_data() { generic_data(); } + void oci_fieldLength_data() { generic_data("QOCI"); } void oci_fieldLength(); - void sqlite_bindAndFetchUInt_data() { generic_data(); } + void sqlite_bindAndFetchUInt_data() { generic_data("QSQLITE3"); } void sqlite_bindAndFetchUInt(); + void sqlStatementUseIsNull_189093_data() { generic_data(); } + void sqlStatementUseIsNull_189093(); + + private: void createTestTables(QSqlDatabase db); void dropTestTables(QSqlDatabase db); void populateTestTables(QSqlDatabase db); - void generic_data(); + void generic_data(const QString &engine=QString()); #ifdef QT3_SUPPORT void testRecordInfo(const FieldDef fieldDefs[], const Q3SqlRecordInfo& inf); @@ -307,7 +313,7 @@ void tst_QSqlDatabase::createTestTables(QSqlDatabase db) + db.driver()->escapeIdentifier(qTableName("qtest") + " test", QSqlDriver::TableName) + '(' + db.driver()->escapeIdentifier(QLatin1String("test test"), QSqlDriver::FieldName) - + " int primary key)"; + + " int not null primary key)"; QVERIFY_SQL(q, exec(qry)); } } @@ -337,7 +343,8 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) << qTableName("qtestBindBool") << qTableName("qtest_sqlguid") << qTableName("uint_table") - << qTableName("uint_test"); + << qTableName("uint_test") + << qTableName("bug_249059"); QSqlQuery q(0, db); if (db.driverName().startsWith("QPSQL")) @@ -360,6 +367,7 @@ void tst_QSqlDatabase::populateTestTables(QSqlDatabase db) QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (1, 'VarChar1', 'Char1', 2.2)")); QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (2, 'VarChar2', 'Char2', 3.3)")); QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (3, 'VarChar3', 'Char3', 4.4)")); + QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (4, 'VarChar4', NULL, NULL)")); } void tst_QSqlDatabase::initTestCase() @@ -394,70 +402,14 @@ void tst_QSqlDatabase::cleanup() { } -void tst_QSqlDatabase::recordOCI_data() -{ - if (dbs.fillTestTable("QOCI") == 0) - QSKIP("No Oracle database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::recordPSQL_data() -{ - if (dbs.fillTestTable("QPSQL") == 0) - QSKIP("No PostgreSQL database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::recordMySQL_data() -{ - if (dbs.fillTestTable("QMYSQL") == 0) - QSKIP("No MySQL database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::recordTDS_data() -{ - if (dbs.fillTestTable("QTDS") == 0) - QSKIP("No TDS database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::recordDB2_data() -{ - if (dbs.fillTestTable("QDB2") == 0) - QSKIP("No DB2 database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::recordSQLite_data() -{ - if (dbs.fillTestTable("QSQLITE") == 0) - QSKIP("No SQLite database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::recordAccess_data() -{ - if (dbs.fillTestTable("QODBC") == 0) - QSKIP("No ODBC database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::recordSQLServer_data() -{ - if (dbs.fillTestTable("QODBC") == 0) - QSKIP("No ODBC database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::recordIBase_data() -{ - if (dbs.fillTestTable("QIBASE") == 0) - QSKIP("No Interbase database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::psql_schemas_data() -{ - if (dbs.fillTestTable("QPSQL") == 0) - QSKIP("No Postgres database drivers are available in this Qt configuration", SkipAll); -} - -void tst_QSqlDatabase::generic_data() +void tst_QSqlDatabase::generic_data(const QString& engine) { - if (dbs.fillTestTable() == 0) - QSKIP("No database drivers are available in this Qt configuration", SkipAll); + if ( dbs.fillTestTable(engine) == 0 ) { + if(engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); + } } void tst_QSqlDatabase::addDatabase() @@ -606,12 +558,18 @@ void tst_QSqlDatabase::whitespaceInIdentifiers() QSqlRecord rec = db.record(tableName); QCOMPARE(rec.count(), 1); QCOMPARE(rec.fieldName(0), QString("test test")); - QCOMPARE(rec.field(0).type(), QVariant::Int); + if(db.driverName().startsWith("QOCI")) + QCOMPARE(rec.field(0).type(), QVariant::String); + else + QCOMPARE(rec.field(0).type(), QVariant::Int); QSqlIndex idx = db.primaryIndex(tableName); QCOMPARE(idx.count(), 1); QCOMPARE(idx.fieldName(0), QString("test test")); - QCOMPARE(idx.field(0).type(), QVariant::Int); + if(db.driverName().startsWith("QOCI")) + QCOMPARE(idx.field(0).type(), QVariant::String); + else + QCOMPARE(idx.field(0).type(), QVariant::Int); } else { QSKIP("DBMS does not support whitespaces in identifiers", SkipSingle); } @@ -879,7 +837,6 @@ void tst_QSqlDatabase::recordTDS() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QTDS"); static const FieldDef fieldDefs[] = { FieldDef("tinyint", QVariant::Int, 255), @@ -928,7 +885,6 @@ void tst_QSqlDatabase::recordOCI() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QOCI"); // runtime check for Oracle version since V8 doesn't support TIMESTAMPs if (tst_Databases::getOraVersion(db) >= 9) { @@ -955,7 +911,6 @@ void tst_QSqlDatabase::recordOCI() } const FieldDef fieldDefs[] = { -// FieldDef("integer", QVariant::Int, 2147483647), FieldDef("char(20)", QVariant::String, QString("blah1")), FieldDef("varchar(20)", QVariant::String, QString("blah2")), FieldDef("nchar(20)", QVariant::String, QString("blah3")), @@ -1005,7 +960,6 @@ void tst_QSqlDatabase::recordPSQL() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QPSQL"); FieldDef byteadef; if (db.driver()->hasFeature(QSqlDriver::BLOB)) @@ -1090,13 +1044,13 @@ void tst_QSqlDatabase::recordMySQL() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QMYSQL"); FieldDef bin10, varbin10; int major = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt(); int minor = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 1, 1 ).toInt(); int revision = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 2, 2 ).toInt(); +#ifdef QT3_SUPPORT /* The below is broken in mysql below 5.0.15 see http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html specifically: Before MySQL 5.0.15, the pad value is space. Values are right-padded @@ -1106,6 +1060,7 @@ void tst_QSqlDatabase::recordMySQL() bin10 = FieldDef("binary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abc "))); varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abcv "))); } +#endif static QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0)); static const FieldDef fieldDefs[] = { @@ -1169,7 +1124,6 @@ void tst_QSqlDatabase::recordDB2() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QDB2"); static const FieldDef fieldDefs[] = { FieldDef("char(20)", QVariant::String, QString("Blah1")), @@ -1215,7 +1169,6 @@ void tst_QSqlDatabase::recordIBase() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QIBASE"); static const FieldDef fieldDefs[] = { FieldDef("char(20)", QVariant::String, QString("Blah1"), false), @@ -1246,7 +1199,6 @@ void tst_QSqlDatabase::recordSQLite() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QSQLITE"); static const FieldDef fieldDefs[] = { // The affinity of these fields are TEXT so SQLite should give us strings, not ints or doubles. @@ -1589,7 +1541,6 @@ void tst_QSqlDatabase::psql_escapeBytea() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QPSQL"); const char dta[4] = {'\x71', '\x14', '\x32', '\x81'}; QByteArray ba(dta, 4); @@ -1616,6 +1567,38 @@ void tst_QSqlDatabase::psql_escapeBytea() QCOMPARE(i, 4); } +void tst_QSqlDatabase::bug_249059() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery q(db); + QString tableName = qTableName("bug_249059"); + QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (dt timestamp, t time)").arg(tableName))); + + QSqlQuery iq(db); + QVERIFY_SQL(iq, prepare(QString("INSERT INTO %1 VALUES (?, ?)").arg(tableName))); + iq.bindValue(0, QVariant(QString("2001-09-09 04:05:06.789 -5:00"))); + iq.bindValue(1, QVariant(QString("04:05:06.789 -5:00"))); + QVERIFY_SQL(iq, exec()); + iq.bindValue(0, QVariant(QString("2001-09-09 04:05:06.789 +5:00"))); + iq.bindValue(1, QVariant(QString("04:05:06.789 +5:00"))); + QVERIFY_SQL(iq, exec()); + + QVERIFY_SQL(q, exec(QString("SELECT dt, t FROM %1").arg(tableName))); + QVERIFY_SQL(q, next()); + QDateTime dt1=q.value(0).toDateTime(); + QTime t1=q.value(1).toTime(); + QVERIFY_SQL(q, next()); + QDateTime dt2=q.value(0).toDateTime(); + QTime t2=q.value(1).toTime(); + + // These will fail when timezone support is added, when that's the case, set the second record to 14:05:06.789 and it should work correctly + QCOMPARE(dt1, dt2); + QCOMPARE(t1, t2); +} + // This test should be rewritten to work with Oracle as well - or the Oracle driver // should be fixed to make this test pass (handle overflows) void tst_QSqlDatabase::precisionPolicy() @@ -1762,7 +1745,6 @@ void tst_QSqlDatabase::ibase_numericFields() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QIBASE"); QSqlQuery q(db); QString tableName = qTableName("numericfields"); @@ -1836,7 +1818,6 @@ void tst_QSqlDatabase::ibase_fetchBlobs() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QIBASE"); QString tableName = qTableName("qtest_ibaseblobs"); QSqlQuery q(db); @@ -1869,7 +1850,6 @@ void tst_QSqlDatabase::ibase_procWithoutReturnValues() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QIBASE"); QSqlQuery q(db); QString procName = qTableName("qtest_proc1"); @@ -1950,11 +1930,6 @@ void tst_QSqlDatabase::odbc_reopenDatabase() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - if (!tst_Databases::isSqlServer(db)) { - QSKIP("SQL Server (ODBC) specific test", SkipSingle); - return; - } - QSqlQuery q(db); QVERIFY_SQL(q, exec("SELECT * from " + qTableName("qtest"))); QVERIFY_SQL(q, next()); @@ -1969,7 +1944,6 @@ void tst_QSqlDatabase::odbc_bindBoolean() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QODBC"); QSqlQuery q(db); QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("qtestBindBool") + "(id int, boolvalue bit)")); @@ -1998,7 +1972,6 @@ void tst_QSqlDatabase::mysql_multiselect() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QMYSQL"); QSqlQuery q(db); QVERIFY_SQL(q, exec("select version()")); @@ -2020,7 +1993,6 @@ void tst_QSqlDatabase::ibase_useCustomCharset() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QIBASE"); QString nonlatin1string("��"); db.close(); @@ -2044,18 +2016,19 @@ void tst_QSqlDatabase::oci_serverDetach() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QOCI"); - for (int i = 0; i < 200; i++) { + for (int i = 0; i < 2; i++) { db.close(); if (db.open()) { QSqlQuery query(db); query.exec("SELECT 1 FROM DUAL"); db.close(); } else { - QFAIL(qPrintable("Can't open database: " + db.lastError().text())); + QFAIL(tst_Databases::printError(db.lastError(), db)); } } + if(!db.open()) + qFatal(tst_Databases::printError(db.lastError(), db)); } void tst_QSqlDatabase::oci_xmltypeSupport() @@ -2063,7 +2036,6 @@ void tst_QSqlDatabase::oci_xmltypeSupport() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QOCI"); QString tableName = qTableName("qtest_xmltype"); QString xml("<?xml version=\"1.0\"?><TABLE_NAME>MY_TABLE</TABLE_NAME>"); @@ -2092,7 +2064,6 @@ void tst_QSqlDatabase::oci_fieldLength() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QOCI"); QString tableName = qTableName("qtest"); QSqlQuery q(db); @@ -2157,7 +2128,6 @@ void tst_QSqlDatabase::odbc_uintfield() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QODBC"); QString tableName = qTableName("uint_table"); unsigned int val = 4294967295U; @@ -2219,7 +2189,6 @@ void tst_QSqlDatabase::eventNotificationIBase() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QIBASE"); QString procedureName = qTableName("posteventProc"); QSqlDriver *driver=db.driver(); @@ -2249,7 +2218,6 @@ void tst_QSqlDatabase::eventNotificationPSQL() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QPSQL"); QSqlQuery query(db); QString procedureName = qTableName("posteventProc"); @@ -2270,7 +2238,6 @@ void tst_QSqlDatabase::sqlite_bindAndFetchUInt() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QSQLITE3"); QSqlQuery q(db); QString tableName = qTableName("uint_test"); @@ -2292,7 +2259,6 @@ void tst_QSqlDatabase::db2_valueCacheUpdate() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QDB2"); QString tableName = qTableName("qtest"); QSqlQuery q(db); @@ -2308,5 +2274,28 @@ void tst_QSqlDatabase::db2_valueCacheUpdate() QCOMPARE(c1.toString(), q.value(0).toString()); } +void tst_QSqlDatabase::sqlStatementUseIsNull_189093() +{ + // NULL = NULL is unknow, the sqlStatment must use IS NULL + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + // select a record with NULL value + QSqlQuery q(QString::null, db); + QVERIFY_SQL(q, exec("select * from " + qTableName("qtest") + " where id = 4")); + QVERIFY_SQL(q, next()); + + QSqlDriver *driver = db.driver(); + QVERIFY(driver); + + QString preparedStatment = driver->sqlStatement(QSqlDriver::WhereStatement, QString("qtest"), q.record(), true); + QCOMPARE(preparedStatment.count("IS NULL", Qt::CaseInsensitive), 2); + + QString statment = driver->sqlStatement(QSqlDriver::WhereStatement, QString("qtest"), q.record(), false); + QCOMPARE(statment.count("IS NULL", Qt::CaseInsensitive), 2); +} + + QTEST_MAIN(tst_QSqlDatabase) #include "tst_qsqldatabase.moc" diff --git a/tests/auto/qsqldriver/qsqldriver.pro b/tests/auto/qsqldriver/qsqldriver.pro new file mode 100644 index 0000000..0024841 --- /dev/null +++ b/tests/auto/qsqldriver/qsqldriver.pro @@ -0,0 +1,16 @@ +load(qttest_p4) +SOURCES += tst_qsqldriver.cpp + +QT += sql + +wince*: { + plugFiles.sources = ../../../plugins/sqldrivers + plugFiles.path = . + DEPLOYMENT += plugFiles +} else { + win32-g++ { + LIBS += -lws2_32 + } else:win32 { + LIBS += ws2_32.lib + } +} diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp new file mode 100644 index 0000000..bbd7483 --- /dev/null +++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp @@ -0,0 +1,218 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtTest/QtTest> +#include <QtSql/QtSql> + +#include "../qsqldatabase/tst_databases.h" + + + +//TESTED_CLASS= +//TESTED_FILES= + +class tst_QSqlDriver : public QObject +{ + Q_OBJECT + +public: + void recreateTestTables(QSqlDatabase); + + tst_Databases dbs; + +public slots: + void initTestCase_data(); + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void record(); + void primaryIndex(); +}; + + +void tst_QSqlDriver::initTestCase_data() +{ + dbs.open(); + if (dbs.fillTestTable() == 0) { + qWarning("NO DATABASES"); + QSKIP("No database drivers are available in this Qt configuration", SkipAll); + } +} + +void tst_QSqlDriver::recreateTestTables(QSqlDatabase db) +{ + QSqlQuery q(db); + + QStringList tableNames; + tableNames << qTableName( "relTEST1" ); + tst_Databases::safeDropTables( db, tableNames ); + + QVERIFY_SQL( q, exec("create table " + qTableName("relTEST1") + + " (id int not null primary key, name varchar(20), title_key int, another_title_key int)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("relTEST1") + " values(1, 'harry', 1, 2)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("relTEST1") + " values(2, 'trond', 2, 1)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("relTEST1") + " values(3, 'vohi', 1, 2)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("relTEST1") + " values(4, 'boris', 2, 2)")); +} + +void tst_QSqlDriver::initTestCase() +{ + foreach (const QString &dbname, dbs.dbNames) + recreateTestTables(QSqlDatabase::database(dbname)); +} + +void tst_QSqlDriver::cleanupTestCase() +{ + QStringList tableNames; + tableNames << qTableName( "relTEST1" ); + foreach (const QString &dbName, dbs.dbNames) { + QSqlDatabase db = QSqlDatabase::database(dbName); + tst_Databases::safeDropTables( db, tableNames ); + } + dbs.close(); +} + +void tst_QSqlDriver::init() +{ +} + +void tst_QSqlDriver::cleanup() +{ +} + +void tst_QSqlDriver::record() +{ + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QString tablename = qTableName("relTEST1"); + QStringList fields; + fields << "id" << "name" << "title_key" << "another_title_key"; + + //check we can get records using an unquoted mixed case table name + QSqlRecord rec = db.driver()->record(tablename); + QCOMPARE(rec.count(), 4); + + if (db.driverName().startsWith("QIBASE")|| db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) + for(int i = 0; i < fields.count(); ++i) + fields[i] = fields[i].toUpper(); + + for (int i = 0; i < fields.count(); ++i) + QCOMPARE(rec.fieldName(i), fields[i]); + + if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) + tablename = tablename.toUpper(); + else if (db.driverName().startsWith("QPSQL")) + tablename = tablename.toLower(); + + //check we can get records using a properly quoted table name + rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName)); + QCOMPARE(rec.count(), 4); + + for (int i = 0; i < fields.count(); ++i) + QCOMPARE(rec.fieldName(i), fields[i]); + + if( db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) + tablename = tablename.toLower(); + else if (db.driverName().startsWith("QPSQL")) + tablename = tablename.toUpper(); + + //check that we can't get records using incorrect tablename casing that's been quoted + rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName)); + if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) + QCOMPARE(rec.count(), 4); //mysql, sqlite and tds will match + else + QCOMPARE(rec.count(), 0); + +} + +void tst_QSqlDriver::primaryIndex() +{ + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QString tablename = qTableName("relTEST1"); + //check that we can get primary index using unquoted mixed case table name + QSqlIndex index = db.driver()->primaryIndex(tablename); + QCOMPARE(index.count(), 1); + + if( db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) + QCOMPARE(index.fieldName(0), QString::fromLatin1("ID")); + else + QCOMPARE(index.fieldName(0), QString::fromLatin1("id")); + + + //check that we can get the primary index using a quoted tablename + if( db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) + tablename = tablename.toUpper(); + else if (db.driverName().startsWith("QPSQL")) + tablename = tablename.toLower(); + + index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName)); + QCOMPARE(index.count(), 1); + if( db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) + QCOMPARE(index.fieldName(0), QString::fromLatin1("ID")); + else + QCOMPARE(index.fieldName(0), QString::fromLatin1("id")); + + + + //check that we can not get the primary index using a quoted but incorrect table name casing + if( db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) + tablename = tablename.toLower(); + else if (db.driverName().startsWith("QPSQL")) + tablename = tablename.toUpper(); + + index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName)); + if (db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS")) + QCOMPARE(index.count(), 1); //mysql will always find the table name regardless of casing + else + QCOMPARE(index.count(), 0); +} + +QTEST_MAIN(tst_QSqlDriver) +#include "tst_qsqldriver.moc" diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 019b111..074f16f 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ - #include <QtTest/QtTest> #include <QtSql/QtSql> @@ -94,7 +93,7 @@ private slots: void transaction(); void record_data() { generic_data(); } void record(); - void record_sqlite_data() { generic_data(); } + void record_sqlite_data() { generic_data("QSQLITE"); } void record_sqlite(); void finish_data() { generic_data(); } void finish(); @@ -108,13 +107,13 @@ private slots: void forwardOnly(); // bug specific tests - void bitField_data(); + void bitField_data() {generic_data("QTDS"); } void bitField(); - void nullBlob_data(); + void nullBlob_data() { generic_data("QOCI"); } void nullBlob(); void blob_data() { generic_data(); } void blob(); - void rawField_data(); + void rawField_data() { generic_data("QOCI"); } void rawField(); void precision_data() { generic_data(); } void precision(); @@ -130,22 +129,20 @@ private slots: void char1SelectUnicode(); void synonyms_data() { generic_data(); } void synonyms(); - void oraOutValues_data(); + void oraOutValues_data() { generic_data("QOCI"); } void oraOutValues(); - void mysqlOutValues_data(); + void mysqlOutValues_data() { generic_data("QMYSQL"); } void mysqlOutValues(); - void oraClob_data() { oraOutValues_data(); } + void oraClob_data() { generic_data("QOCI"); } void oraClob(); - void oraLong_data() { oraOutValues_data(); } + void oraLong_data() { generic_data("QOCI"); } void oraLong(); - void outValuesDB2_data(); + void outValuesDB2_data() { generic_data("QDB2"); } void outValuesDB2(); - void storedProceduresIBase_data(); + void storedProceduresIBase_data() {generic_data("QIBASE"); } void storedProceduresIBase(); - void oraRowId_data(); + void oraRowId_data() { generic_data("QOCI"); } void oraRowId(); - void oraXmlType_data(); - void oraXmlType(); void prepare_bind_exec_data() { generic_data(); } void prepare_bind_exec(); void prepared_select_data() { generic_data(); } @@ -178,13 +175,17 @@ private slots: void emptyTableNavigate(); #ifdef NOT_READY_YET - void bug217003_data() { generic_data(); } - void bug217003(); + void task_217003_data() { generic_data(); } + void task_217003(); #endif + void task_250026_data() { generic_data("QODBC"); } + void task_250026(); + + private: // returns all database connections - void generic_data(); + void generic_data(const QString &engine=QString()); void dropTestTables( QSqlDatabase db ); void createTestTables( QSqlDatabase db ); void populateTestTables( QSqlDatabase db ); @@ -250,34 +251,14 @@ void tst_QSqlQuery::cleanup() } } -void tst_QSqlQuery::bitField_data() -{ - if ( dbs.fillTestTable( "QTDS" ) == 0 ) - QSKIP( "No TDS database drivers are available in this Qt configuration", SkipAll ); -} - -void tst_QSqlQuery::nullBlob_data() -{ - if ( dbs.fillTestTable( "QOCI" ) == 0 ) - QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll ); -} - -void tst_QSqlQuery::oraXmlType_data() -{ - if ( dbs.fillTestTable( "QOCI" ) == 0 ) - QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll ); -} - -void tst_QSqlQuery::rawField_data() +void tst_QSqlQuery::generic_data(const QString& engine) { - if ( dbs.fillTestTable( "QOCI" ) == 0 ) - QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll ); -} - -void tst_QSqlQuery::generic_data() -{ - if ( dbs.fillTestTable() == 0 ) - QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + if ( dbs.fillTestTable(engine) == 0 ) { + if(engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); + } } void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) @@ -305,7 +286,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) << qTableName( "blobstest" ) << qTableName( "oraRowId" ); - if ( db.driverName() == "QSQLITE" ) + if ( db.driverName().startsWith("QSQLITE") ) tablenames << qTableName( "record_sqlite" ); if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QOCI" ) ) @@ -316,6 +297,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) #ifdef NOT_READY_YET tablenames << qTableName( "Planet" ); #endif + tablenames << qTableName( "task_250026" ); tst_Databases::safeDropTables( db, tablenames ); } @@ -430,12 +412,6 @@ void tst_QSqlQuery::char1SelectUnicode() QSKIP( "Database not unicode capable", SkipSingle ); } -void tst_QSqlQuery::oraRowId_data() -{ - if ( dbs.fillTestTable( "QOCI" ) == 0 ) - QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll ); -} - void tst_QSqlQuery::oraRowId() { QFETCH( QString, dbName ); @@ -470,28 +446,6 @@ void tst_QSqlQuery::oraRowId() QCOMPARE( q.value( 0 ).toString(), QString( "b" ) ); } -void tst_QSqlQuery::oraXmlType() -{ - QFETCH( QString, dbName ); - QSqlDatabase db = QSqlDatabase::database( dbName ); - CHECK_DATABASE( db ); - - QString xmlStr = "<foo>" + QString().fill( 'a', 5000 ) + "</foo>"; - - QSqlQuery q( db ); - - QVERIFY_SQL( q, exec( "create table " + qTableName( "qxmltest" ) + " (col1 SYS.XMLTYPE)" ) ); - QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qxmltest" ) + " values (?)" ) ); - q.addBindValue( xmlStr, QSql::Binary ); - QVERIFY_SQL( q, exec() ); -} - -void tst_QSqlQuery::mysqlOutValues_data() -{ - if ( dbs.fillTestTable( "QMYSQL" ) == 0 ) - QSKIP( "No MySQL database drivers are available in this Qt configuration", SkipAll ); -} - void tst_QSqlQuery::mysqlOutValues() { QFETCH( QString, dbName ); @@ -542,12 +496,6 @@ void tst_QSqlQuery::mysqlOutValues() QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) ); } -void tst_QSqlQuery::oraOutValues_data() -{ - if ( dbs.fillTestTable( "QOCI" ) == 0 ) - QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll ); -} - void tst_QSqlQuery::oraOutValues() { QFETCH( QString, dbName ); @@ -657,8 +605,8 @@ void tst_QSqlQuery::oraClob() QVERIFY_SQL( q, exec( "create table " + qTableName( "clobby" ) + "(id int primary key, cl clob, bl blob)" ) ); QVERIFY_SQL( q, prepare( "insert into " + qTableName( "clobby" ) + " (id, cl, bl) values(?, ?, ?)" ) ); q.addBindValue( 1 ); - q.addBindValue( "bubu", QSql::Binary ); - q.addBindValue( "bubu", QSql::Binary ); + q.addBindValue( "bubu" ); + q.addBindValue( QByteArray("bubu") ); QVERIFY_SQL( q, exec() ); QVERIFY_SQL( q, exec( "select bl, cl from " + qTableName( "clobby" ) + " where id = 1" ) ); @@ -670,7 +618,7 @@ void tst_QSqlQuery::oraClob() QVERIFY_SQL( q, prepare( "insert into " + qTableName( "clobby" ) + " (id, cl, bl) values(?, ?, ?)" ) ); q.addBindValue( 2 ); q.addBindValue( "lala", QSql::Binary ); - q.addBindValue( "lala", QSql::Binary ); + q.addBindValue( QByteArray("lala"), QSql::Binary ); QVERIFY_SQL( q, exec() ); QVERIFY_SQL( q, exec( "select bl, cl from " + qTableName( "clobby" ) + " where id = 2" ) ); @@ -684,21 +632,15 @@ void tst_QSqlQuery::oraClob() QVERIFY_SQL( q, prepare( "insert into " + qTableName( "clobby" ) + " (id, cl, bl) values(?, ?, ?)" ) ); q.addBindValue( 3 ); q.addBindValue( loong, QSql::Binary ); - q.addBindValue( loong, QSql::Binary ); + q.addBindValue( loong.toLatin1(), QSql::Binary ); QVERIFY_SQL( q, exec() ); QVERIFY_SQL( q, exec( "select bl, cl from " + qTableName( "clobby" ) + " where id = 3" ) ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toString().count(), loong.count() ); QVERIFY( q.value( 0 ).toString() == loong ); - QCOMPARE( q.value( 1 ).toString().count(), loong.count() ); - QVERIFY( q.value( 1 ).toString() == loong ); -} - -void tst_QSqlQuery::storedProceduresIBase_data() -{ - if ( dbs.fillTestTable( "QIBASE" ) == 0 ) - QSKIP( "No Interbase database drivers are available in this Qt configuration", SkipAll ); + QCOMPARE( q.value( 1 ).toByteArray().count(), loong.toLatin1().count() ); + QVERIFY( q.value( 1 ).toByteArray() == loong.toLatin1() ); } void tst_QSqlQuery::storedProceduresIBase() @@ -706,7 +648,6 @@ void tst_QSqlQuery::storedProceduresIBase() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - DBMS_SPECIFIC( db, "QIBASE" ); QSqlQuery q( db ); q.exec( "drop procedure " + qTableName( "TESTPROC" ) ); @@ -738,12 +679,6 @@ void tst_QSqlQuery::storedProceduresIBase() q.exec( "drop procedure " + qTableName( "TestProc" ) ); } -void tst_QSqlQuery::outValuesDB2_data() -{ - if ( dbs.fillTestTable( "QDB2" ) == 0 ) - QSKIP( "No DB2 database drivers are available in this Qt configuration", SkipAll ); -} - void tst_QSqlQuery::outValuesDB2() { QFETCH( QString, dbName ); @@ -1380,7 +1315,6 @@ void tst_QSqlQuery::nullBlob() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - DBMS_SPECIFIC( db, "QOCI" ); QSqlQuery q( db ); QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_nullblob" ) + " (id int primary key, bb blob)" ) ); @@ -1410,7 +1344,6 @@ void tst_QSqlQuery::rawField() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - DBMS_SPECIFIC( db, "QOCI" ); QSqlQuery q( db ); q.setForwardOnly( true ); @@ -2082,7 +2015,7 @@ void tst_QSqlQuery::oraArrayBind() QVariantList list; - list << QString( "boris" ) << QString( "and" ) << QString( "harald" ) << QString( "both" ) << QString( "hate" ) << QString( "oracle" ); + list << QString( "lorem" ) << QString( "ipsum" ) << QString( "dolor" ) << QString( "sit" ) << QString( "amet" ); QVERIFY_SQL( q, prepare( "BEGIN " "ora_array_test.set_table(?); " @@ -2098,7 +2031,7 @@ void tst_QSqlQuery::oraArrayBind() list.clear(); - list << QString( 64,' ' ) << QString( 64,' ' ) << QString( 64,' ' ) << QString( 64,' ' ) << QString( 64,' ' ) << QString( 64,' ' ); + list << QString( 64,' ' ) << QString( 64,' ' ) << QString( 64,' ' ) << QString( 64,' ' ) << QString( 64,' ' ); q.bindValue( 0, list, QSql::Out ); @@ -2106,17 +2039,15 @@ void tst_QSqlQuery::oraArrayBind() QVariantList out_list = q.boundValue( 0 ).toList(); - QCOMPARE( out_list.at( 0 ).toString(), QString( "boris" ) ); - - QCOMPARE( out_list.at( 1 ).toString(), QString( "and" ) ); + QCOMPARE( out_list.at( 0 ).toString(), QString( "lorem" ) ); - QCOMPARE( out_list.at( 2 ).toString(), QString( "harald" ) ); + QCOMPARE( out_list.at( 1 ).toString(), QString( "ipsum" ) ); - QCOMPARE( out_list.at( 3 ).toString(), QString( "both" ) ); + QCOMPARE( out_list.at( 2 ).toString(), QString( "dolor" ) ); - QCOMPARE( out_list.at( 4 ).toString(), QString( "hate" ) ); + QCOMPARE( out_list.at( 3 ).toString(), QString( "sit" ) ); - QCOMPARE( out_list.at( 5 ).toString(), QString( "oracle" ) ); + QCOMPARE( out_list.at( 4 ).toString(), QString( "amet" ) ); QVERIFY_SQL( q, exec( "DROP PACKAGE ora_array_test" ) ); } @@ -2130,7 +2061,6 @@ void tst_QSqlQuery::record_sqlite() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - DBMS_SPECIFIC( db, "QSQLITE" ); QSqlQuery q( db ); @@ -2158,7 +2088,6 @@ void tst_QSqlQuery::oraLong() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - DBMS_SPECIFIC( db, "QOCI" ); QSqlQuery q( db ); @@ -2182,11 +2111,10 @@ void tst_QSqlQuery::execErrorRecovery() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - DBMS_SPECIFIC( db, "QSQLITE" ); QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_exerr" ) + " (id int primary key)" ) ); + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_exerr" ) + " (id int not null primary key)" ) ); QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_exerr" ) + " values (?)" ) ); q.addBindValue( 1 ); @@ -2396,7 +2324,10 @@ void tst_QSqlQuery::sqlite_finish() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - DBMS_SPECIFIC( db, "QSQLITE" ); + if (db.driverName() != QLatin1String("QSQLITE")) { + QSKIP("Sqlite3 specific test", SkipSingle); + return; + } if ( db.databaseName().startsWith( ':' ) ) QSKIP( "This test requires a database on the filesystem, not in-memory", SkipAll ); @@ -2723,7 +2654,7 @@ void tst_QSqlQuery::emptyTableNavigate() } #ifdef NOT_READY_YET -void tst_QSqlQuery::bug217003() +void tst_QSqlQuery::task_217003() { QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); @@ -2751,5 +2682,34 @@ void tst_QSqlQuery::bug217003() } #endif +void tst_QSqlQuery::task_250026() +{ + QString data258, data1026; + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + QSqlQuery q( db ); + + QString tableName = qTableName( "task_250026" ); + + if ( !q.exec( "create table " + tableName + " (longfield varchar(1100))" ) ) { + qDebug() << "Error" << q.lastError(); + QSKIP( "Db doesn't support \"1100\" as a size for fields", SkipSingle ); + } + + data258.fill( 'A', 258 ); + data1026.fill( 'A', 1026 ); + QVERIFY_SQL( q, prepare( "insert into " + tableName + "(longfield) VALUES (:longfield)" ) ); + q.bindValue( "longfield", data258 ); + QVERIFY_SQL( q, exec() ); + q.bindValue( "longfield", data1026 ); + QVERIFY_SQL( q, exec() ); + QVERIFY_SQL( q, exec( "select * from " + tableName ) ); + QVERIFY_SQL( q, next() ); + QCOMPARE( q.value( 0 ).toString().length(), data258.length() ); + QVERIFY_SQL( q, next() ); + QCOMPARE( q.value( 0 ).toString().length(), data1026.length() ); +} + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp index 6736a44..88b5770 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -95,7 +95,7 @@ private slots: void setQueryWithNoRowsInResultSet(); private: - void generic_data(); + void generic_data(const QString &engine=QString()); void dropTestTables(QSqlDatabase db); void createTestTables(QSqlDatabase db); void populateTestTables(QSqlDatabase db); @@ -182,7 +182,7 @@ void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db) QVERIFY_SQL(q, exec(QString("insert into " + qTableName("test3") + " values(0)"))); QVERIFY_SQL(q, prepare("insert into "+qTableName("test3")+"(id) select id + ? from "+qTableName("test3tmp"))); for (int i=1; i<260; i*=2) { - QVERIFY_SQL(q2, exec("delete from "+qTableName("test3tmp"))); + q2.exec("delete from "+qTableName("test3tmp")); QVERIFY_SQL(q2, exec("insert into "+qTableName("test3tmp")+"(id) select id from "+qTableName("test3"))); q.bindValue(0, i); QVERIFY_SQL(q, exec()); @@ -191,7 +191,7 @@ void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db) QVERIFY_SQL(q, exec(QString("insert into " + qTableName("many") + "(id, name) values (0, \'harry\')"))); QVERIFY_SQL(q, prepare("insert into "+qTableName("many")+"(id, name) select id + ?, name from "+qTableName("manytmp"))); for (int i=1; i < 2048; i*=2) { - QVERIFY_SQL(q2, exec("delete from "+qTableName("manytmp"))); + q2.exec("delete from "+qTableName("manytmp")); QVERIFY_SQL(q2, exec("insert into "+qTableName("manytmp")+"(id, name) select id, name from "+qTableName("many"))); q.bindValue(0, i); QVERIFY_SQL(q, exec()); @@ -202,10 +202,14 @@ void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db) tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp") << qTableName("test3tmp")); } -void tst_QSqlQueryModel::generic_data() +void tst_QSqlQueryModel::generic_data(const QString& engine) { - if (dbs.fillTestTable() == 0) - QSKIP("No database drivers are available in this Qt configuration", SkipAll); + if ( dbs.fillTestTable(engine) == 0 ) { + if(engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); + } } void tst_QSqlQueryModel::init() @@ -368,7 +372,7 @@ void tst_QSqlQueryModel::insertColumn() QCOMPARE(model.indexInQuery(model.index(0, 5)).column(), -1); QCOMPARE(model.indexInQuery(model.index(0, 6)).column(), -1); - bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI"); + bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(model.record().field(0).name(), QString()); QCOMPARE(model.record().field(1).name(), isToUpper ? QString("ID") : QString("id")); QCOMPARE(model.record().field(2).name(), QString()); @@ -389,7 +393,7 @@ void tst_QSqlQueryModel::record() QSqlRecord rec = model.record(); - bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI"); + bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(rec.count(), 3); QCOMPARE(rec.fieldName(0), isToUpper ? QString("ID") : QString("id")); @@ -433,7 +437,7 @@ void tst_QSqlQueryModel::setHeaderData() model.setQuery(QSqlQuery("select * from " + qTableName("test"), db)); - bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI"); + bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), isToUpper ? QString("ID") : QString("id")); QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), isToUpper ? QString("NAME") : QString("name")); QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar")); diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index 76785c3..bb2cddd 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -82,6 +82,10 @@ private slots: void insertRecordDuplicateFieldNames(); void invalidData(); void relationModel(); + void casing(); + void escapedRelations(); + void escapedTableName(); + void whiteSpaceInIdentifiers(); }; @@ -103,7 +107,9 @@ void tst_QSqlRelationalTableModel::recreateTestTables(QSqlDatabase db) << qTableName( "reltest2" ) << qTableName( "reltest3" ) << qTableName( "reltest4" ) - << qTableName( "reltest5" ); + << qTableName( "reltest5" ) + << db.driver()->escapeIdentifier(qTableName( "rel test6" ), QSqlDriver::TableName) + << db.driver()->escapeIdentifier(qTableName( "rel test7" ), QSqlDriver::TableName); tst_Databases::safeDropTables( db, tableNames ); QVERIFY_SQL( q, exec("create table " + qTableName("reltest1") + @@ -128,6 +134,19 @@ void tst_QSqlRelationalTableModel::recreateTestTables(QSqlDatabase db) QVERIFY_SQL( q, exec("create table " + qTableName("reltest5") + " (title varchar(20) not null primary key, abbrev varchar(20))")); QVERIFY_SQL( q, exec("insert into " + qTableName("reltest5") + " values('herr', 'Hr')")); QVERIFY_SQL( q, exec("insert into " + qTableName("reltest5") + " values('mister', 'Mr')")); + + if (testWhiteSpaceNames(db.driverName())) { + QString reltest6 = db.driver()->escapeIdentifier(qTableName("rel test6"), QSqlDriver::TableName); + QVERIFY_SQL( q, exec("create table " + reltest6 + " (id int not null primary key, " + db.driver()->escapeIdentifier("city key", QSqlDriver::FieldName) + + " int, " + db.driver()->escapeIdentifier("extra field", QSqlDriver::FieldName) + " int)")); + QVERIFY_SQL( q, exec("insert into " + reltest6 + " values(1, 1,9)")); + QVERIFY_SQL( q, exec("insert into " + reltest6 + " values(2, 2,8)")); + + QString reltest7 = db.driver()->escapeIdentifier(qTableName("rel test7"), QSqlDriver::TableName); + QVERIFY_SQL( q, exec("create table " + reltest7 + " (" + db.driver()->escapeIdentifier("city id", QSqlDriver::TableName) + " int not null primary key, " + db.driver()->escapeIdentifier("city name", QSqlDriver::FieldName) + " varchar(20))")); + QVERIFY_SQL( q, exec("insert into " + reltest7 + " values(1, 'New York')")); + QVERIFY_SQL( q, exec("insert into " + reltest7 + " values(2, 'Washington')")); + } } void tst_QSqlRelationalTableModel::initTestCase() @@ -142,10 +161,14 @@ void tst_QSqlRelationalTableModel::cleanupTestCase() tableNames << qTableName( "reltest1" ) << qTableName( "reltest2" ) << qTableName( "reltest3" ) - << qTableName( "reltest4" ); + << qTableName( "reltest4" ) + << qTableName( "reltest5" ); foreach (const QString &dbName, dbs.dbNames) { QSqlDatabase db = QSqlDatabase::database(dbName); - tst_Databases::safeDropTables( db, tableNames ); + QStringList tables = tableNames; + tables << db.driver()->escapeIdentifier(qTableName( "rel test6" ), QSqlDriver::TableName) + << db.driver()->escapeIdentifier(qTableName( "rel test7" ), QSqlDriver::TableName); + tst_Databases::safeDropTables( db, tables ); } dbs.close(); } @@ -273,7 +296,12 @@ void tst_QSqlRelationalTableModel::setData() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + + //sybase doesn't allow tables with the same alias used twice as col names + //so don't set up an identical relation when using the tds driver + if (!db.driverName().startsWith("QTDS")) + model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -284,7 +312,10 @@ void tst_QSqlRelationalTableModel::setData() QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi2")); QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(0, 3)).toString(), QString("herr")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(0, 3)).toString(), QString("herr")); + else + QCOMPARE(model.data(model.index(0, 3)).toInt(), 1); QVERIFY_SQL(model, submitAll()); } @@ -299,10 +330,15 @@ void tst_QSqlRelationalTableModel::setData() QCOMPARE(model.data(model.index(0, 3)).toInt(), 1); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + if (!db.driverName().startsWith("QTDS")) + model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(0, 3)).toString(), QString("herr")); + + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(0, 3)).toString(), QString("herr")); + else + QCOMPARE(model.data(model.index(0, 3)).toInt(), 1); } //check setting of data when the relational key is a non-integer type @@ -336,7 +372,8 @@ void tst_QSqlRelationalTableModel::multipleRelation() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(3, QSqlRelation(qTableName("reltest4"), "id", "name")); + model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); @@ -344,7 +381,7 @@ void tst_QSqlRelationalTableModel::multipleRelation() QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(0, 3)).toString(), QString("mister")); + QCOMPARE(model.data(model.index(0, 3)).toString(), QString("Trondheim")); } void tst_QSqlRelationalTableModel::insertRecord() @@ -357,6 +394,7 @@ void tst_QSqlRelationalTableModel::insertRecord() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); QSqlRecord rec; @@ -398,6 +436,7 @@ void tst_QSqlRelationalTableModel::setRecord() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); QSqlRecord rec; @@ -450,13 +489,18 @@ void tst_QSqlRelationalTableModel::insertWithStrategies() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + + if (!db.driverName().startsWith("QTDS")) + model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(0,0)).toInt(), 1); QCOMPARE(model.data(model.index(0,1)).toString(), QString("harry")); QCOMPARE(model.data(model.index(0,2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(0,3)).toString(), QString("mister")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(0,3)).toString(), QString("mister")); + else + QCOMPARE(model.data(model.index(0,3)).toInt(), 2); model.insertRows(0, 1); model.setData(model.index(0, 0), 1011); @@ -467,12 +511,20 @@ void tst_QSqlRelationalTableModel::insertWithStrategies() QCOMPARE(model.data(model.index(0,0)).toInt(), 1011); QCOMPARE(model.data(model.index(0,1)).toString(), QString("test")); QCOMPARE(model.data(model.index(0,2)).toString(), QString("mister")); - QCOMPARE(model.data(model.index(0,3)).toString(), QString("herr")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(0,3)).toString(), QString("herr")); + else + QCOMPARE(model.data(model.index(0,3)).toInt(), 1); QCOMPARE(model.data(model.index(1,0)).toInt(), 1); QCOMPARE(model.data(model.index(1,1)).toString(), QString("harry")); QCOMPARE(model.data(model.index(1,2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(1,3)).toString(), QString("mister")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(1,3)).toString(), QString("mister")); + else + QCOMPARE(model.data(model.index(1,3)).toInt(), 2); + + QVERIFY_SQL(model, submitAll()); @@ -481,9 +533,16 @@ void tst_QSqlRelationalTableModel::insertWithStrategies() QCOMPARE(model.data(model.index(0,0)).toInt(), 1); QCOMPARE(model.data(model.index(0,1)).toString(), QString("harry")); QCOMPARE(model.data(model.index(0,2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(0,3)).toString(), QString("mister")); - model.setData(model.index(0,3),1); - QCOMPARE(model.data(model.index(0,3)).toString(), QString("herr")); + + if (!db.driverName().startsWith("QTDS")) { + QCOMPARE(model.data(model.index(0,3)).toString(), QString("mister")); + model.setData(model.index(0,3),1); + QCOMPARE(model.data(model.index(0,3)).toString(), QString("herr")); + } else { + QCOMPARE(model.data(model.index(0,3)).toInt(), 2); + model.setData(model.index(0,3),1); + QCOMPARE(model.data(model.index(0,3)).toInt(), 1); + } model.insertRows(0, 2); model.setData(model.index(0, 0), 1012); @@ -499,17 +558,27 @@ void tst_QSqlRelationalTableModel::insertWithStrategies() QCOMPARE(model.data(model.index(0,0)).toInt(),1012); QCOMPARE(model.data(model.index(0,1)).toString(), QString("george")); QCOMPARE(model.data(model.index(0,2)).toString(), QString("mister")); - QCOMPARE(model.data(model.index(0,3)).toString(), QString("mister")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(0,3)).toString(), QString("mister")); + else + QCOMPARE(model.data(model.index(0,3)).toInt(), 2); + QCOMPARE(model.data(model.index(1,0)).toInt(),1013); QCOMPARE(model.data(model.index(1,1)).toString(), QString("kramer")); QCOMPARE(model.data(model.index(1,2)).toString(), QString("mister")); - QCOMPARE(model.data(model.index(1,3)).toString(), QString("herr")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(1,3)).toString(), QString("herr")); + else + QCOMPARE(model.data(model.index(1,3)).toInt(), 1); QCOMPARE(model.data(model.index(2,0)).toInt(), 1); QCOMPARE(model.data(model.index(2,1)).toString(), QString("harry")); QCOMPARE(model.data(model.index(2,2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(2,3)).toString(), QString("herr")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(2,3)).toString(), QString("herr")); + else + QCOMPARE(model.data(model.index(2,3)).toInt(), 1); QVERIFY_SQL(model, submitAll()); } @@ -574,7 +643,8 @@ void tst_QSqlRelationalTableModel::sort() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + if (!db.driverName().startsWith("QTDS")) + model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); model.setSort(2, Qt::DescendingOrder); QVERIFY_SQL(model, select()); @@ -589,11 +659,19 @@ void tst_QSqlRelationalTableModel::sort() model.setSort(3, Qt::AscendingOrder); QVERIFY_SQL(model, select()); - QCOMPARE(model.rowCount(), 4); - QCOMPARE(model.data(model.index(0, 3)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(1, 3)).toString(), QString("mister")); - QCOMPARE(model.data(model.index(2, 3)).toString(), QString("mister")); - QCOMPARE(model.data(model.index(3, 3)).toString(), QString("mister")); + if (!db.driverName().startsWith("QTDS")) { + QCOMPARE(model.rowCount(), 4); + QCOMPARE(model.data(model.index(0, 3)).toString(), QString("herr")); + QCOMPARE(model.data(model.index(1, 3)).toString(), QString("mister")); + QCOMPARE(model.data(model.index(2, 3)).toString(), QString("mister")); + QCOMPARE(model.data(model.index(3, 3)).toString(), QString("mister")); + } else { + QCOMPARE(model.data(model.index(0, 3)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 3)).toInt(), 2); + QCOMPARE(model.data(model.index(2, 3)).toInt(), 2); + QCOMPARE(model.data(model.index(3, 3)).toInt(), 2); + } + } static void testRevert(QSqlRelationalTableModel &model) @@ -663,7 +741,7 @@ void tst_QSqlRelationalTableModel::revert() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(3, QSqlRelation(qTableName("reltest4"), "id", "name")); model.setSort(0, Qt::AscendingOrder); @@ -689,7 +767,9 @@ void tst_QSqlRelationalTableModel::clearDisplayValuesCache() model.setTable(qTableName("reltest1")); model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + + if (!db.driverName().startsWith("QTDS")) + model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); model.setSort(1, Qt::AscendingOrder); model.setEditStrategy(QSqlTableModel::OnManualSubmit); @@ -698,7 +778,10 @@ void tst_QSqlRelationalTableModel::clearDisplayValuesCache() QCOMPARE(model.data(model.index(3, 0)).toInt(), 3); QCOMPARE(model.data(model.index(3, 1)).toString(), QString("vohi")); QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(3, 3)).toString(), QString("mister")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(3, 3)).toString(), QString("mister")); + else + QCOMPARE(model.data(model.index(3, 3)).toInt(), 2 ); model.insertRow(model.rowCount()); QVERIFY(model.setData(model.index(4, 0), 5, Qt::EditRole)); @@ -710,11 +793,18 @@ void tst_QSqlRelationalTableModel::clearDisplayValuesCache() QCOMPARE(model.data(model.index(0, 0)).toInt(), 5); QCOMPARE(model.data(model.index(0, 1)).toString(), QString("anders")); QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(0, 3)).toString(), QString("herr")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(0, 3)).toString(), QString("herr")); + else + QCOMPARE(model.data(model.index(0, 3)).toInt(), 1); + QCOMPARE(model.data(model.index(4, 0)).toInt(), 3); QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); QCOMPARE(model.data(model.index(4, 2)).toString(), QString("herr")); - QCOMPARE(model.data(model.index(4, 3)).toString(), QString("mister")); + if (!db.driverName().startsWith("QTDS")) + QCOMPARE(model.data(model.index(4, 3)).toString(), QString("mister")); + else + QCOMPARE(model.data(model.index(4, 3)).toInt(), 2); } // For task 140782 and 176374: If the main table and the the related tables uses the same @@ -729,27 +819,38 @@ void tst_QSqlRelationalTableModel::insertRecordDuplicateFieldNames() QSqlRelationalTableModel model(0, db); model.setTable(qTableName("reltest3")); model.setEditStrategy(QSqlTableModel::OnManualSubmit); + model.setSort(0, Qt::AscendingOrder); // Duplication of "name", used in both reltest3 and reltest4. model.setRelation(2, QSqlRelation(qTableName("reltest4"), "id", "name")); QVERIFY_SQL(model, select()); - QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name"))).toString(), + if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { + QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name")).toUpper()).toString(), + QString("Trondheim")); + } else { + QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name"))).toString(), QString("Trondheim")); + } QSqlRecord rec = model.record(); rec.setValue(0, 3); rec.setValue(1, "Berge"); rec.setValue(2, 1); // Must insert the key value - QCOMPARE(rec.fieldName(0), QLatin1String("id")); - QCOMPARE(rec.fieldName(1), QLatin1String("name")); // This comes from main table + if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { + QCOMPARE(rec.fieldName(0), QLatin1String("ID")); + QCOMPARE(rec.fieldName(1), QLatin1String("NAME")); // This comes from main table + } else { + QCOMPARE(rec.fieldName(0), QLatin1String("id")); + QCOMPARE(rec.fieldName(1), QLatin1String("name")); + } // The duplicate field names is aliased because it's comes from the relation's display column. - if(!db.driverName().startsWith("QIBASE")) - QCOMPARE(rec.fieldName(2), qTableName("reltest4").append(QLatin1String("_name"))); - else + if(db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) QCOMPARE(rec.fieldName(2), (qTableName("reltest4").append(QLatin1String("_name"))).toUpper()); + else + QCOMPARE(rec.fieldName(2), qTableName("reltest4").append(QLatin1String("_name"))); QVERIFY(model.insertRecord(-1, rec)); QCOMPARE(model.data(model.index(2, 2)).toString(), QString("Oslo")); @@ -793,7 +894,7 @@ void tst_QSqlRelationalTableModel::relationModel() QVERIFY(model.relationModel(3) == NULL); QVERIFY(model.relationModel(4) == NULL); - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(3, QSqlRelation(qTableName("reltest4"), "id", "name")); QVERIFY_SQL(model, select()); QVERIFY(model.relationModel(0) == NULL); @@ -806,5 +907,285 @@ void tst_QSqlRelationalTableModel::relationModel() QCOMPARE(rel_model->data(rel_model->index(0,1)).toString(), QString("herr")); } +void tst_QSqlRelationalTableModel::casing() +{ + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + if (db.driverName().startsWith("QSQLITE")) + QSKIP("The casing test for SQLITE is irrelevant since SQLITE is case insensitive", SkipAll); + + QStringList tableNames; + tableNames << qTableName("CASETEST1", db.driver()).toUpper(); + tableNames << qTableName("casetest1", db.driver()); + tst_Databases::safeDropTables(db, tableNames); + + QSqlQuery q(db); + QVERIFY_SQL( q, exec("create table " + qTableName("CASETEST1", db.driver()).toUpper() + + " (id int not null primary key, name varchar(20), title_key int, another_title_key int)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("CASETEST1", db.driver()).toUpper() + " values(1, 'harry', 1, 2)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("CASETEST1", db.driver()).toUpper() + " values(2, 'trond', 2, 1)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("CASETEST1", db.driver()).toUpper() + " values(3, 'vohi', 1, 2)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("CASETEST1", db.driver()).toUpper() + " values(4, 'boris', 2, 2)")); + + QVERIFY_SQL( q, exec("create table " + qTableName("casetest1", db.driver()) + + " (ident int not null primary key, name varchar(20), title_key int)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("casetest1", db.driver()) + " values(1, 'jerry', 1)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("casetest1", db.driver()) + " values(2, 'george', 2)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("casetest1", db.driver()) + " values(4, 'kramer', 2)")); + + if (db.driverName().startsWith("QOCI")) { + //try an owner that doesn't exist + QSqlRecord rec = db.driver()->record("doug." + qTableName("CASETEST1", db.driver()).toUpper()); + QCOMPARE( rec.count(), 0); + + //try an owner that does exist + rec = db.driver()->record(db.userName() + "." + qTableName("CASETEST1", db.driver()).toUpper()); + QCOMPARE( rec.count(), 4); + } + QSqlRecord rec = db.driver()->record(qTableName("CASETEST1", db.driver()).toUpper()); + QCOMPARE( rec.count(), 4); + + rec = db.driver()->record(qTableName("casetest1", db.driver())); + QCOMPARE( rec.count(), 3); + + QSqlTableModel upperCaseModel(0, db); + upperCaseModel.setTable(qTableName("CASETEST1", db.driver()).toUpper()); + + QCOMPARE(upperCaseModel.tableName(),qTableName("CASETEST1",db.driver()).toUpper()); + + QVERIFY_SQL(upperCaseModel, select()); + + QCOMPARE(upperCaseModel.rowCount(), 4); + + QSqlTableModel lowerCaseModel(0, db); + lowerCaseModel.setTable(qTableName("casetest1", db.driver())); + QCOMPARE(lowerCaseModel.tableName(), qTableName("casetest1",db.driver())); + QVERIFY_SQL(lowerCaseModel, select()); + + QCOMPARE(lowerCaseModel.rowCount(), 3); + + QSqlRelationalTableModel model(0, db); + model.setTable(qTableName("CASETEST1", db.driver()).toUpper()); + model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + QVERIFY_SQL(model, select()); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr")); + + tst_Databases::safeDropTables(db, tableNames); +} + +void tst_QSqlRelationalTableModel::escapedRelations() +{ + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + recreateTestTables(db); + + QSqlRelationalTableModel model(0, db); + model.setTable(qTableName("reltest1")); + + //try with relation table name quoted + if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { + model.setRelation(2, QSqlRelation(db.driver()->escapeIdentifier(qTableName("reltest2").toUpper(),QSqlDriver::TableName), + "tid", + "title")); + } else { + model.setRelation(2, QSqlRelation(db.driver()->escapeIdentifier(qTableName("reltest2"),QSqlDriver::TableName), + "tid", + "title")); + + } + QVERIFY_SQL(model, select()); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr")); + + //try with index column quoted + if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { + model.setRelation(2, QSqlRelation(qTableName("reltest2"), + db.driver()->escapeIdentifier("tid", QSqlDriver::FieldName).toUpper(), + "title")); + } else { + model.setRelation(2, QSqlRelation(qTableName("reltest2"), + db.driver()->escapeIdentifier("tid", QSqlDriver::FieldName), + "title")); + } + QVERIFY_SQL(model, select()); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr")); + + //try with display column quoted + + if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { + + model.setRelation(2, QSqlRelation(qTableName("reltest2"), + "tid", + db.driver()->escapeIdentifier("title", QSqlDriver::FieldName).toUpper())); + } else { + model.setRelation(2, QSqlRelation(qTableName("reltest2"), + "tid", + db.driver()->escapeIdentifier("title", QSqlDriver::FieldName))); + } + + QVERIFY_SQL(model, select()); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr")); + + //try with tablename and index and display columns quoted in the relation + + if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { + model.setRelation(2, QSqlRelation(qTableName("reltest2"), + "tid", + db.driver()->escapeIdentifier("title", QSqlDriver::FieldName).toUpper())); + } else { + model.setRelation(2, QSqlRelation(qTableName("reltest2"), + "tid", + db.driver()->escapeIdentifier("title", QSqlDriver::FieldName))); + } + QVERIFY_SQL(model, select()); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr")); +} + +void tst_QSqlRelationalTableModel::escapedTableName() +{ + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + // set the values using OnRowChange Strategy with an escaped tablename + { + QSqlRelationalTableModel model(0, db); + + if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { + model.setTable(db.driver()->escapeIdentifier(qTableName("reltest1").toUpper(), QSqlDriver::TableName)); + } else { + model.setTable(db.driver()->escapeIdentifier(qTableName("reltest1"), QSqlDriver::TableName)); + } + model.setSort(0, Qt::AscendingOrder); + model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + QVERIFY_SQL(model, select()); + + QVERIFY(model.setData(model.index(0, 1), QString("harry2"))); + QVERIFY(model.setData(model.index(0, 2), 2)); + + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry2")); + QCOMPARE(model.data(model.index(0, 2)).toString(), QString("mister")); + + model.submit(); + + QVERIFY(model.setData(model.index(3,1), QString("boris2"))); + QVERIFY(model.setData(model.index(3, 2), 1)); + + QCOMPARE(model.data(model.index(3,1)).toString(), QString("boris2")); + QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr")); + + model.submit(); + } + { //verify values + QSqlRelationalTableModel model(0, db); + model.setTable(qTableName("reltest1")); + model.setSort(0, Qt::AscendingOrder); + QVERIFY_SQL(model, select()); + + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry2")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("boris2")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 1); + + model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + QVERIFY_SQL(model, select()); + QCOMPARE(model.data(model.index(0, 2)).toString(), QString("mister")); + QCOMPARE(model.data(model.index(3,2)).toString(), QString("herr")); + + } +} + +void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() { + + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + if (!testWhiteSpaceNames(db.driverName())) + QSKIP("White space test irrelevant for driver", SkipAll); + QSqlRelationalTableModel model(0, db); + model.setTable(db.driver()->escapeIdentifier(qTableName("rel test6"), QSqlDriver::TableName)); + model.setSort(0, Qt::DescendingOrder); + model.setRelation(1, QSqlRelation(db.driver()->escapeIdentifier(qTableName("rel test7"), QSqlDriver::TableName), + db.driver()->escapeIdentifier("city id", QSqlDriver::FieldName), + db.driver()->escapeIdentifier("city name", QSqlDriver::FieldName))); + QVERIFY_SQL(model, select()); + + QCOMPARE(model.data(model.index(0,1)).toString(), QString("Washington")); + QCOMPARE(model.data(model.index(1,1)).toString(), QString("New York")); + + QSqlRecord rec; + QSqlField f1("id", QVariant::Int); + QSqlField f2(db.driver()->escapeIdentifier("city key", QSqlDriver::FieldName), QVariant::Int); + QSqlField f3(db.driver()->escapeIdentifier("extra field", QSqlDriver::FieldName), QVariant::Int); + + f1.setValue(3); + f2.setValue(2); + f3.setValue(7); + + f1.setGenerated(true); + f2.setGenerated(true); + f3.setGenerated(true); + + rec.append(f1); + rec.append(f2); + rec.append(f3); + + QVERIFY_SQL(model, insertRecord(-1, rec)); + model.submitAll(); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("Washington")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 7); + + //TODO: For some reson setting a record using manual submit fails + //model.setEditStrategy(QSqlTableModel::OnManualSubmit); + + QSqlRecord recNew; + QSqlField f1New("id", QVariant::Int); + QSqlField f2New(db.driver()->escapeIdentifier("city key", QSqlDriver::FieldName), QVariant::Int); + QSqlField f3New(db.driver()->escapeIdentifier("extra field", QSqlDriver::FieldName), QVariant::Int); + + f1New.setValue(4); + f2New.setValue(1); + f3New.setValue(6); + + f1New.setGenerated(true); + f2New.setGenerated(true); + f3New.setGenerated(true); + + recNew.append(f1New); + recNew.append(f2New); + recNew.append(f3New); + + QVERIFY_SQL(model, setRecord(0, recNew)); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 4); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("New York")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 6); + + QVERIFY_SQL(model, submitAll()); + QCOMPARE(model.data(model.index(0, 0)).toInt(), 4); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("New York")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 6); +} + QTEST_MAIN(tst_QSqlRelationalTableModel) #include "tst_qsqlrelationaltablemodel.moc" diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 84149aa..0e7355e 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -66,38 +66,59 @@ public: tst_Databases dbs; public slots: - void initTestCase_data(); void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); private slots: + void select_data() { generic_data(); } void select(); + void submitAll_data() { generic_data(); } void submitAll(); - void setRecord_data(); + void setRecord_data() { generic_data(); } void setRecord(); + void insertRow_data() { generic_data(); } void insertRow(); + void insertRecord_data() { generic_data(); } void insertRecord(); + void insertMultiRecords_data() { generic_data(); } void insertMultiRecords(); + void removeRow_data() { generic_data(); } void removeRow(); + void removeRows_data() { generic_data(); } void removeRows(); + void removeInsertedRow_data() { generic_data(); } void removeInsertedRow(); + void setFilter_data() { generic_data(); } void setFilter(); + void setInvalidFilter_data() { generic_data(); } void setInvalidFilter(); + void emptyTable_data() { generic_data(); } void emptyTable(); + void tablesAndSchemas_data() { generic_data("QPSQL"); } void tablesAndSchemas(); + void whitespaceInIdentifiers_data() { generic_data(); } void whitespaceInIdentifiers(); + void primaryKeyOrder_data() { generic_data("QSQLITE"); } void primaryKeyOrder(); + void sqlite_bigTable_data() { generic_data("QSQLITE"); } void sqlite_bigTable(); // bug specific tests + void insertRecordBeforeSelect_data() { generic_data(); } void insertRecordBeforeSelect(); + void submitAllOnInvalidTable_data() { generic_data(); } void submitAllOnInvalidTable(); + void insertRecordsInLoop_data() { generic_data(); } void insertRecordsInLoop(); + void sqlite_attachedDatabase_data() { generic_data("QSQLITE"); } void sqlite_attachedDatabase(); // For task 130799 + +private: + void generic_data(const QString& engine=QString()); }; tst_QSqlTableModel::tst_QSqlTableModel() @@ -121,9 +142,10 @@ void tst_QSqlTableModel::dropTestTables() << qTableName("test2") << qTableName("test3") << qTableName("emptytable") - << qTableName("bigtable"); + << qTableName("bigtable") + << qTableName("foo"); if (testWhiteSpaceNames(db.driverName())) - tableNames << qTableName("qtestw hitespace"); + tableNames << qTableName("qtestw hitespace", db.driver()); tst_Databases::safeDropTables(db, tableNames); @@ -145,7 +167,7 @@ void tst_QSqlTableModel::createTestTables() QVERIFY_SQL( q, exec("create table " + qTableName("test3") + "(id int, random varchar(20), randomtwo varchar(20))")); - QVERIFY_SQL( q, exec("create table " + qTableName("emptytable", db.driver()) + "(id int)")); + QVERIFY_SQL( q, exec("create table " + qTableName("emptytable") + "(id int)")); if (testWhiteSpaceNames(db.driverName())) { QString qry = "create table " + qTableName("qtestw hitespace", db.driver()) + " ("+ db.driver()->escapeIdentifier("a field", QSqlDriver::FieldName) + " int)"; @@ -160,16 +182,16 @@ void tst_QSqlTableModel::repopulateTestTables() QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); - QVERIFY_SQL( q, exec("delete from " + qTableName("test"))); + q.exec("delete from " + qTableName("test")); QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(1, 'harry', 1)")); QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(2, 'trond', 2)")); QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(3, 'vohi', 3)")); - QVERIFY_SQL( q, exec("delete from " + qTableName("test2"))); + q.exec("delete from " + qTableName("test2")); QVERIFY_SQL( q, exec("insert into " + qTableName("test2") + " values(1, 'herr')")); QVERIFY_SQL( q, exec("insert into " + qTableName("test2") + " values(2, 'mister')")); - QVERIFY_SQL( q, exec("delete from " + qTableName("test3"))); + q.exec("delete from " + qTableName("test3")); QVERIFY_SQL( q, exec("insert into " + qTableName("test3") + " values(1, 'foo', 'bar')")); QVERIFY_SQL( q, exec("insert into " + qTableName("test3") + " values(2, 'baz', 'joe')")); } @@ -182,11 +204,13 @@ void tst_QSqlTableModel::recreateTestTables() repopulateTestTables(); } -void tst_QSqlTableModel::initTestCase_data() +void tst_QSqlTableModel::generic_data(const QString &engine) { - if (dbs.fillTestTable() == 0) { - qWarning("NO DATABASES"); - QSKIP("No database drivers are available in this Qt configuration", SkipAll); + if ( dbs.fillTestTable(engine) == 0 ) { + if(engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); } } @@ -212,7 +236,7 @@ void tst_QSqlTableModel::cleanup() void tst_QSqlTableModel::select() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -245,58 +269,56 @@ void tst_QSqlTableModel::select() QCOMPARE(model.data(model.index(3, 3)), QVariant()); } -void tst_QSqlTableModel::setRecord_data() -{ - QTest::addColumn<uint>("submitpolicy"); - QTest::newRow("OnFieldChange") << (uint)QSqlTableModel::OnFieldChange; - QTest::newRow("OnRowChange") << (uint)QSqlTableModel::OnRowChange; - QTest::newRow("OnManualSubmit") << (uint)QSqlTableModel::OnManualSubmit; -} - void tst_QSqlTableModel::setRecord() { - // This needs to be tested with ODBC, which requires a manual change to qsqldatabase\tst_databases.h - // to ensure an ODBC db is added - - QFETCH_GLOBAL(QString, dbName); - QFETCH(uint, submitpolicy); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QSqlTableModel model(0, db); - model.setEditStrategy((QSqlTableModel::EditStrategy)submitpolicy); - model.setTable(qTableName("test3")); - model.setSort(0, Qt::AscendingOrder); - QVERIFY_SQL(model, select()); + QList<QSqlTableModel::EditStrategy> policies = QList<QSqlTableModel::EditStrategy>() << QSqlTableModel::OnFieldChange << QSqlTableModel::OnRowChange << QSqlTableModel::OnManualSubmit; + + QString Xsuffix; + foreach( QSqlTableModel::EditStrategy submitpolicy, policies) { - for (int i = 0; i < model.rowCount(); ++i) { - QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex))); - - QSqlRecord rec = model.record(i); - rec.setValue(1, rec.value(1).toString() + 'X'); - rec.setValue(2, rec.value(2).toString() + 'X'); - QVERIFY(model.setRecord(i, rec)); - - if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) - QVERIFY(model.submitAll()); - else { - // dataChanged() is not emitted when submitAll() is called - QCOMPARE(spy.count(), 2); - QCOMPARE(spy.at(0).count(), 2); - QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 1)); - QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, 1)); + QSqlTableModel model(0, db); + model.setEditStrategy((QSqlTableModel::EditStrategy)submitpolicy); + model.setTable(qTableName("test3")); + model.setSort(0, Qt::AscendingOrder); + QVERIFY_SQL(model, select()); + + for (int i = 0; i < model.rowCount(); ++i) { + QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex))); + + QSqlRecord rec = model.record(i); + rec.setValue(1, rec.value(1).toString() + 'X'); + rec.setValue(2, rec.value(2).toString() + 'X'); + QVERIFY(model.setRecord(i, rec)); + + if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) + QVERIFY(model.submitAll()); + else if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnRowChange && i == model.rowCount() -1) + model.submit(); + else { + // dataChanged() is not emitted when submitAll() is called + QCOMPARE(spy.count(), 2); + QCOMPARE(spy.at(0).count(), 2); + QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 1)); + QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, 1)); + } } - } - QCOMPARE(model.data(model.index(0, 1)).toString(), QString("fooX")); - QCOMPARE(model.data(model.index(0, 2)).toString(), QString("barX")); - QCOMPARE(model.data(model.index(1, 1)).toString(), QString("bazX")); - QCOMPARE(model.data(model.index(1, 2)).toString(), QString("joeX")); + Xsuffix.append('X'); + + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("foo").append(Xsuffix)); + QCOMPARE(model.data(model.index(0, 2)).toString(), QString("bar").append(Xsuffix)); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("baz").append(Xsuffix)); + QCOMPARE(model.data(model.index(1, 2)).toString(), QString("joe").append(Xsuffix)); + } } void tst_QSqlTableModel::insertRow() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -321,7 +343,7 @@ void tst_QSqlTableModel::insertRow() void tst_QSqlTableModel::insertRecord() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -354,7 +376,7 @@ void tst_QSqlTableModel::insertRecord() void tst_QSqlTableModel::insertMultiRecords() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -403,7 +425,7 @@ void tst_QSqlTableModel::insertMultiRecords() void tst_QSqlTableModel::submitAll() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -438,7 +460,7 @@ void tst_QSqlTableModel::submitAll() void tst_QSqlTableModel::removeRow() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -484,7 +506,7 @@ void tst_QSqlTableModel::removeRow() void tst_QSqlTableModel::removeRows() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -533,7 +555,7 @@ void tst_QSqlTableModel::removeRows() void tst_QSqlTableModel::removeInsertedRow() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -565,7 +587,7 @@ void tst_QSqlTableModel::removeInsertedRow() void tst_QSqlTableModel::emptyTable() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -584,12 +606,10 @@ void tst_QSqlTableModel::emptyTable() void tst_QSqlTableModel::tablesAndSchemas() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QPSQL"); - QSqlQuery q(db); q.exec("DROP SCHEMA " + qTableName("testschema") + " CASCADE"); QVERIFY_SQL( q, exec("create schema " + qTableName("testschema"))); @@ -607,14 +627,14 @@ void tst_QSqlTableModel::tablesAndSchemas() void tst_QSqlTableModel::whitespaceInIdentifiers() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); if (!testWhiteSpaceNames(db.driverName())) QSKIP("DBMS doesn't support whitespaces in identifiers", SkipSingle); - QString tableName = qTableName("qtestw hitespace"); + QString tableName = qTableName("qtestw hitespace", db.driver()); QSqlTableModel model(0, db); model.setTable(tableName); @@ -623,16 +643,16 @@ void tst_QSqlTableModel::whitespaceInIdentifiers() void tst_QSqlTableModel::primaryKeyOrder() { - QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "primaryKeyOrderTest"); - db.setDatabaseName(":memory:"); - QVERIFY_SQL(db, open()); + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); QSqlQuery q(db); - QVERIFY_SQL( q, exec("create table foo(a varchar(20), id int primary key, b varchar(20))")); + QVERIFY_SQL( q, exec("create table "+qTableName("foo")+"(a varchar(20), id int not null primary key, b varchar(20))")); QSqlTableModel model(0, db); - model.setTable("foo"); + model.setTable(qTableName("foo")); QSqlIndex pk = model.primaryKey(); QCOMPARE(pk.count(), 1); @@ -652,7 +672,7 @@ void tst_QSqlTableModel::primaryKeyOrder() void tst_QSqlTableModel::setInvalidFilter() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -671,7 +691,7 @@ void tst_QSqlTableModel::setInvalidFilter() void tst_QSqlTableModel::setFilter() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -724,12 +744,10 @@ void tst_QSqlTableModel::setFilter() void tst_QSqlTableModel::sqlite_bigTable() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QSQLITE"); - bool hasTransactions = db.driver()->hasFeature(QSqlDriver::Transactions); if (hasTransactions) QVERIFY(db.transaction()); QSqlQuery q(db); @@ -763,7 +781,7 @@ void tst_QSqlTableModel::sqlite_bigTable() // had first been called. void tst_QSqlTableModel::insertRecordBeforeSelect() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -796,7 +814,7 @@ void tst_QSqlTableModel::insertRecordBeforeSelect() // are inserted and submitted on a non-existing table. void tst_QSqlTableModel::submitAllOnInvalidTable() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -828,7 +846,7 @@ void tst_QSqlTableModel::submitAllOnInvalidTable() // For task 147575: the rowsRemoved signal emitted from the model was lying void tst_QSqlTableModel::insertRecordsInLoop() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -866,12 +884,10 @@ void tst_QSqlTableModel::insertRecordsInLoop() void tst_QSqlTableModel::sqlite_attachedDatabase() { - QFETCH_GLOBAL(QString, dbName); + QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - DBMS_SPECIFIC(db, "QSQLITE"); - QSqlDatabase attachedDb = QSqlDatabase::cloneDatabase(db, db.driverName() + QLatin1String("attached")); attachedDb.setDatabaseName(db.databaseName()+QLatin1String("attached.dat")); QVERIFY_SQL(attachedDb, open()); diff --git a/tests/auto/qsqlthread/tst_qsqlthread.cpp b/tests/auto/qsqlthread/tst_qsqlthread.cpp index 94e0f98..8b8fc65 100644 --- a/tests/auto/qsqlthread/tst_qsqlthread.cpp +++ b/tests/auto/qsqlthread/tst_qsqlthread.cpp @@ -70,7 +70,7 @@ public: void recreateTestTables(); void repopulateTestTables(); - void generic_data(); + void generic_data(const QString &engine=QString()); tst_Databases dbs; public slots: @@ -286,10 +286,14 @@ tst_QSqlThread::~tst_QSqlThread() { } -void tst_QSqlThread::generic_data() +void tst_QSqlThread::generic_data(const QString& engine) { - if (dbs.fillTestTable() == 0) - QSKIP("No database drivers are available in this Qt configuration", SkipAll); + if ( dbs.fillTestTable(engine) == 0 ) { + if(engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); + } } void tst_QSqlThread::dropTestTables() diff --git a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp index a3322ab..84bda92 100644 --- a/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -115,7 +115,6 @@ private slots: void checkChildren(); void data(); void clear(); -#if QT_VERSION >= 0x040200 void sort_data(); void sort(); void sortRole_data(); @@ -133,10 +132,9 @@ private slots: void useCase1(); void useCase2(); void useCase3(); -#endif void rootItemFlags(); - void treeDragAndDrop(); + void treeDragAndDrop(); private: QAbstractItemModel *m_model; @@ -144,7 +142,7 @@ private: QVector<QModelIndex> rcParent; QVector<int> rcFirst; QVector<int> rcLast; - + //return true if models have the same structure, and all child have the same text bool compareModels(QStandardItemModel *model1, QStandardItemModel *model2); //return true if models have the same structure, and all child have the same text @@ -154,9 +152,7 @@ private: static const int defaultSize = 3; Q_DECLARE_METATYPE(QModelIndex) -#if QT_VERSION >= 0x040200 Q_DECLARE_METATYPE(QStandardItem*) -#endif Q_DECLARE_METATYPE(Qt::Orientation) Q_DECLARE_METATYPE(QVariantList) @@ -181,9 +177,7 @@ tst_QStandardItemModel::~tst_QStandardItemModel() void tst_QStandardItemModel::init() { qRegisterMetaType<QModelIndex>("QModelIndex"); -#if QT_VERSION >= 0x040200 qRegisterMetaType<QStandardItem*>("QStandardItem*"); -#endif qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); m_model = new QStandardItemModel(defaultSize, defaultSize); @@ -768,7 +762,6 @@ void tst_QStandardItemModel::clear() QCOMPARE(model.hasChildren(), false); } -#if QT_VERSION >= 0x040200 void tst_QStandardItemModel::sort_data() { QTest::addColumn<int>("sortOrder"); @@ -1383,8 +1376,6 @@ void tst_QStandardItemModel::useCase3() delete childItem; } -#endif // QT_VERSION >= 0x040200 - void tst_QStandardItemModel::rootItemFlags() { QStandardItemModel model(6, 4); @@ -1426,7 +1417,7 @@ bool tst_QStandardItemModel::compareItems(QStandardItem *item1, QStandardItem *i } for (int row = 0; row < item1->columnCount(); row++) for (int col = 0; col < item1->columnCount(); col++) { - + if (!compareItems(item1->child(row, col), item2->child(row, col))) return false; } @@ -1438,19 +1429,19 @@ static QStandardItem *itemFromText(QStandardItem *parent, const QString &text) QStandardItem *item = 0; for(int i = 0; i < parent->columnCount(); i++) for(int j = 0; j < parent->rowCount(); j++) { - + QStandardItem *child = parent->child(j, i); - + if(!child) continue; - + if (child->text() == text) { if (item) { return 0; } item = child; } - + QStandardItem *candidate = itemFromText(child, text); if(candidate) { if (item) { @@ -1470,9 +1461,9 @@ static QModelIndex indexFromText(QStandardItemModel *model, const QString &text) } -struct FriendlyTreeView : public QTreeView +struct FriendlyTreeView : public QTreeView { - friend class tst_QStandardItemModel; + friend class tst_QStandardItemModel; Q_DECLARE_PRIVATE(QTreeView) }; @@ -1480,7 +1471,7 @@ void tst_QStandardItemModel::treeDragAndDrop() { const int nRow = 5; const int nCol = 3; - + QStandardItemModel model; QStandardItemModel checkModel; @@ -1489,13 +1480,13 @@ void tst_QStandardItemModel::treeDragAndDrop() for (int c = 0 ; c < nCol; c ++) colItems1 << new QStandardItem(QString("item %1 - %0").arg(c).arg(i)); model.appendRow(colItems1); - + for (int j = 0; j < nRow; ++j) { QList<QStandardItem *> colItems2; for (int c = 0 ; c < nCol; c ++) colItems2 << new QStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j)); colItems1.at(0)->appendRow(colItems2); - + for (int k = 0; k < nRow; ++k) { QList<QStandardItem *> colItems3; for (int c = 0 ; c < nCol; c ++) @@ -1504,21 +1495,19 @@ void tst_QStandardItemModel::treeDragAndDrop() } } } - - - + for (int i = 0; i < nRow; ++i) { QList<QStandardItem *> colItems1; for (int c = 0 ; c < nCol; c ++) colItems1 << new QStandardItem(QString("item %1 - %0").arg(c).arg(i)); checkModel.appendRow(colItems1); - + for (int j = 0; j < nRow; ++j) { QList<QStandardItem *> colItems2; for (int c = 0 ; c < nCol; c ++) colItems2 << new QStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j)); colItems1.at(0)->appendRow(colItems2); - + for (int k = 0; k < nRow; ++k) { QList<QStandardItem *> colItems3; for (int c = 0 ; c < nCol; c ++) @@ -1527,9 +1516,9 @@ void tst_QStandardItemModel::treeDragAndDrop() } } } - + QVERIFY(compareModels(&model, &checkModel)); - + FriendlyTreeView view; view.setModel(&model); view.expandAll(); @@ -1556,7 +1545,7 @@ void tst_QStandardItemModel::treeDragAndDrop() if(model.dropMimeData(data, Qt::MoveAction, 0, 0, indexFromText(&model, "item 4 - 0"))) view.d_func()->clearOrRemove(); delete data; - + QVERIFY(!compareModels(&model, &checkModel)); //the model must be different at this point QStandardItem *item4 = itemFromText(checkModel.invisibleRootItem(), "item 4 - 0"); item4->insertRow(0, checkModel.takeRow(1)); @@ -1564,7 +1553,6 @@ void tst_QStandardItemModel::treeDragAndDrop() QVERIFY(compareModels(&model, &checkModel)); } - // // step2 drag "item 3" and "item 3/0" into "item 4" // @@ -1572,10 +1560,10 @@ void tst_QStandardItemModel::treeDragAndDrop() selection->clear(); selection->select(QItemSelection(indexFromText(&model, QString("item 3 - 0")), indexFromText(&model, QString("item 3 - %0").arg(nCol-1))), QItemSelectionModel::Select); - + selection->select(QItemSelection(indexFromText(&model, QString("item 3/0 - 0")), indexFromText(&model, QString("item 3/0 - %0").arg(nCol-1))), QItemSelectionModel::Select); - + //code based from QAbstractItemView::startDrag and QAbstractItemView::dropEvent QModelIndexList indexes = view.selectedIndexes(); QMimeData *data = model.mimeData(indexes); diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index f786965..1263a41 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -432,6 +432,10 @@ void tst_QString::replace_uint_uint_data() QTest::newRow( "rep09" ) << QString("ACABCAB") << 4 << 2 << QString("XX") << QString("ACABXXB"); QTest::newRow( "rep10" ) << QString("ACABCAB") << 5 << 2 << QString("XX") << QString("ACABCXX"); QTest::newRow( "rep10" ) << QString("ACABCAB") << 6 << 2 << QString("XX") << QString("ACABCAXX"); + QTest::newRow( "rep12" ) << QString() << 0 << 10 << QString("X") << QString("X"); + QTest::newRow( "rep13" ) << QString("short") << 0 << 10 << QString("X") << QString("X"); + QTest::newRow( "rep14" ) << QString() << 0 << 10 << QString("XX") << QString("XX"); + QTest::newRow( "rep15" ) << QString("short") << 0 << 10 << QString("XX") << QString("XX"); } void tst_QString::replace_string_data() diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp index e31e0db..cb30f83 100644 --- a/tests/auto/qstyle/tst_qstyle.cpp +++ b/tests/auto/qstyle/tst_qstyle.cpp @@ -70,10 +70,7 @@ #include <qlineedit.h> #include <qmdiarea.h> - -#if QT_VERSION >= 0x040200 #include <QCleanlooksStyle> -#endif #ifdef Q_WS_MAC #include <QMacStyle> @@ -343,7 +340,7 @@ void tst_QStyle::testPlastiqueStyle() void tst_QStyle::testCleanlooksStyle() { -#if QT_VERSION >= 0x040200 && !defined(QT_NO_STYLE_CLEANLOOKS) +#if !defined(QT_NO_STYLE_CLEANLOOKS) QCleanlooksStyle cstyle; testAllFunctions(&cstyle); lineUpLayoutTest(&cstyle); @@ -365,7 +362,7 @@ void tst_QStyle::testWindowsXPStyle() QWindowsXPStyle xpstyle; testAllFunctions(&xpstyle); lineUpLayoutTest(&xpstyle); -#else +#else QSKIP("No WindowsXP style", SkipAll); #endif } diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 7954d00..aa63753 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -94,6 +94,7 @@ private slots: void embeddedFonts(); void opaquePaintEvent_data(); void opaquePaintEvent(); + void task188195_baseBackground(); //at the end because it mess with the style. void widgetStyle(); @@ -1354,6 +1355,28 @@ void tst_QStyleSheetStyle::opaquePaintEvent() QCOMPARE(cl.autoFillBackground(), !styled ); } +void tst_QStyleSheetStyle::task188195_baseBackground() +{ + QTreeView tree; + tree.setStyleSheet( "QTreeView:disabled { background-color:#ab1251; }" ); + tree.show(); + QTest::qWait(20); + QImage image(tree.width(), tree.height(), QImage::Format_ARGB32); + + tree.render(&image); + QVERIFY(testForColors(image, tree.palette().base().color())); + QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51))); + + tree.setEnabled(false); + tree.render(&image); + QVERIFY(testForColors(image, QColor(0xab, 0x12, 0x51))); + + tree.setEnabled(true); + tree.render(&image); + QVERIFY(testForColors(image, tree.palette().base().color())); + QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51))); +} + QTEST_MAIN(tst_QStyleSheetStyle) diff --git a/tests/auto/qsvgdevice/tst_qsvgdevice.cpp b/tests/auto/qsvgdevice/tst_qsvgdevice.cpp index 713b3fa..4f16e7e 100644 --- a/tests/auto/qsvgdevice/tst_qsvgdevice.cpp +++ b/tests/auto/qsvgdevice/tst_qsvgdevice.cpp @@ -332,11 +332,7 @@ void tst_QSvgDevice::playPaint( QPainter *p, const QString &type ) qDrawShadePanel(p,4000,5000,4000,2000,palette.active(),false,200,&br); qDrawShadeRect(p,2000,2000,4000,2000,palette.active(),true,100,0,&br); } - } -#if !defined (Q_WS_WIN) && (QT_VERSION < 0x030200) - // This will fail on X11 with 3.1, fixed in 3.2 -#else - else if (type=="clipRect") { + } else if (type=="clipRect") { p->setClipRect(15,25,10,10); p->drawEllipse(10,20,50,70); } else if (type=="multipleClipRects") { @@ -344,9 +340,7 @@ void tst_QSvgDevice::playPaint( QPainter *p, const QString &type ) p->drawEllipse(10,20,50,70); p->setClipRect(100,200,20,20); p->drawEllipse(110,220,50,70); - } -#endif - else if (type == "qsimplerichtext") { + } else if (type == "qsimplerichtext") { p->setPen(QColor(0,0,0)); p->setBrush(Qt::NoBrush); QRect rect1(10, 10, 100, 50); diff --git a/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp index 7ce30aa..8c5da7b 100644 --- a/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp +++ b/tests/auto/qsystemtrayicon/tst_qsystemtrayicon.cpp @@ -42,10 +42,6 @@ #include <QtTest/QtTest> -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include <qcoreapplication.h> #include <qdebug.h> #include <qsystemtrayicon.h> @@ -150,4 +146,3 @@ void tst_QSystemTrayIcon::lastWindowClosed() QTEST_MAIN(tst_QSystemTrayIcon) #include "tst_qsystemtrayicon.moc" -#endif diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 35a8b84..1e7cc48 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -1159,13 +1159,13 @@ void tst_QTcpSocket::readLine() QVERIFY(socket->waitForReadyRead(10000)); char buffer[1024]; - QCOMPARE(socket->readLine(buffer, sizeof(buffer)), qint64(145)); + QCOMPARE(socket->readLine(buffer, sizeof(buffer)), qint64(161)); // * OK fluke Cyrus IMAP4 v2.2.12 server ready__ // // 01234567890123456789012345678901234567890123456789 - QCOMPARE((int) buffer[143], (int) '\r'); - QCOMPARE((int) buffer[144], (int) '\n'); - QCOMPARE((int) buffer[145], (int) '\0'); + QCOMPARE((int) buffer[159], (int) '\r'); + QCOMPARE((int) buffer[160], (int) '\n'); + QCOMPARE((int) buffer[161], (int) '\0'); QCOMPARE(socket->write("1 NOOP\r\n"), qint64(8)); @@ -1198,7 +1198,7 @@ void tst_QTcpSocket::readLineString() { QTcpSocket *socket = newSocket(); // QByteArray expected("* OK fluke Cyrus IMAP4 v2.2.12 server ready\r\n"); - QByteArray expected("* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] aspiriniks Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); + QByteArray expected("* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); socket->connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket->waitForReadyRead(10000)); @@ -1749,7 +1749,7 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead() QCOMPARE(readyReadSpy.count(), 1); QString s = socket->readLine(); - QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] aspiriniks Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); + QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); QCOMPARE(socket->bytesAvailable(), qint64(0)); QCoreApplication::instance()->processEvents(); diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index d2a2546..f5155ae 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -77,6 +77,7 @@ private slots: void resize(); void openOnRootDrives(); void stressTest(); + void rename(); public: }; @@ -143,7 +144,6 @@ void tst_QTemporaryFile::fileTemplate_data() void tst_QTemporaryFile::fileTemplate() { -#if QT_VERSION >= 0x040200 QFETCH(QString, constructorTemplate); QFETCH(QString, suffix); QFETCH(QString, fileTemplate); @@ -156,7 +156,6 @@ void tst_QTemporaryFile::fileTemplate() QCOMPARE(file.fileName().right(suffix.length()), suffix); file.close(); -#endif } @@ -233,9 +232,6 @@ void tst_QTemporaryFile::write() void tst_QTemporaryFile::openCloseOpenClose() { -#if QT_VERSION < 0x040101 - QSKIP("Until Qt 4.1.1, QTemporaryFile would create a new name every time open() was called.", SkipSingle); -#endif QString fileName; { // Create a temp file @@ -247,7 +243,7 @@ void tst_QTemporaryFile::openCloseOpenClose() QVERIFY(QFile::exists(fileName)); file.close(); - // Check that it still exists after being closed + // Check that it still exists after being closed QVERIFY(QFile::exists(fileName)); QVERIFY(!file.isOpen()); QVERIFY(file.open()); @@ -335,5 +331,30 @@ void tst_QTemporaryFile::stressTest() } } +void tst_QTemporaryFile::rename() +{ + // This test checks that the temporary file is deleted, even after a + // rename. + + QDir dir; + QVERIFY(!dir.exists("temporary-file.txt")); + + QString tempname; + { + QTemporaryFile file(dir.filePath("temporary-file.XXXXXX")); + + QVERIFY(file.open()); + tempname = file.fileName(); + QVERIFY(dir.exists(tempname)); + + QVERIFY(file.rename("temporary-file.txt")); + QVERIFY(!dir.exists(tempname)); + QVERIFY(dir.exists("temporary-file.txt")); + } + + QVERIFY(!dir.exists(tempname)); + QVERIFY(!dir.exists("temporary-file.txt")); +} + QTEST_MAIN(tst_QTemporaryFile) #include "tst_qtemporaryfile.moc" diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro index ed2ade3..e52bb7a 100644 --- a/tests/auto/qtextcodec/test/test.pro +++ b/tests/auto/qtextcodec/test/test.pro @@ -5,6 +5,7 @@ wince*: { addFiles.sources = ../*.txt addFiles.path = . DEPLOYMENT += addFiles + DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs } diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp index 48212a4..86b253f 100644 --- a/tests/auto/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp @@ -124,9 +124,7 @@ private slots: void selectWordWithSeparators_data(); void selectWordWithSeparators(); void startOfWord(); -#if QT_VERSION >= 0x040100 void selectBlock(); -#endif void selectVisually(); void insertText(); @@ -1228,13 +1226,9 @@ void tst_QTextCursor::selectWord() cursor.movePosition(QTextCursor::EndOfBlock); cursor.select(QTextCursor::WordUnderCursor); -#if QT_VERSION < 0x040200 - QVERIFY(!cursor.hasSelection()); -#else QVERIFY(cursor.hasSelection()); QCOMPARE(cursor.selectionStart(), 17); QCOMPARE(cursor.selectionEnd(), 22); -#endif } void tst_QTextCursor::selectWordWithSeparators_data() @@ -1269,7 +1263,6 @@ void tst_QTextCursor::startOfWord() QCOMPARE(cursor.position(), 0); } -#if QT_VERSION >= 0x040100 void tst_QTextCursor::selectBlock() { cursor.insertText("foobar"); @@ -1295,7 +1288,6 @@ void tst_QTextCursor::selectBlock() QVERIFY(cursor.blockFormat().alignment() == Qt::AlignHCenter); QCOMPARE(cursor.block().text(), QString("blah")); } -#endif void tst_QTextCursor::selectVisually() { @@ -1551,7 +1543,6 @@ void tst_QTextCursor::update() void tst_QTextCursor::disallowSettingObjectIndicesOnCharFormats() { -#if QT_VERSION >= 0x040200 QTextCharFormat fmt; fmt.setObjectIndex(42); cursor.insertText("Hey", fmt); @@ -1581,7 +1572,6 @@ void tst_QTextCursor::disallowSettingObjectIndicesOnCharFormats() cursor = table->cellAt(0, 0).firstCursorPosition(); QVERIFY(!cursor.isNull()); QCOMPARE(cursor.blockCharFormat().objectIndex(), table->objectIndex()); -#endif } void tst_QTextCursor::blockAndColumnNumber() diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 58cc019..4ef5299 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -193,14 +193,9 @@ void tst_QTextDocument::getSetCheck() QPointer<MyAbstractTextDocumentLayout> var1 = new MyAbstractTextDocumentLayout(0); obj1.setDocumentLayout(var1); QCOMPARE(static_cast<QAbstractTextDocumentLayout *>(var1), obj1.documentLayout()); -#if QT_VERSION >= 0x040200 - // QTextDocument in Qt < 4.2 crashes on this. Qt >= 4.2 should handle this gracefully obj1.setDocumentLayout((QAbstractTextDocumentLayout *)0); QVERIFY(var1.isNull()); QVERIFY(obj1.documentLayout()); -#else - delete var1; -#endif // bool QTextDocument::useDesignMetrics() // void QTextDocument::setUseDesignMetrics(bool) @@ -672,18 +667,6 @@ void tst_QTextDocument::toHtml_data() << QString("<p DEFAULTBLOCKSTYLE><span style=\" font-size:40pt;\">Blah</span></p>"); } -#if QT_VERSION < 0x040200 - { - CREATE_DOC_AND_CURSOR(); - - QTextCharFormat fmt; - fmt.setProperty(QTextFormat::FontSizeIncrement, 2); - cursor.insertText("Blah", fmt); - - QTest::newRow("logical-font-size") << QTextDocumentFragment(&doc) - << QString("<p DEFAULTBLOCKSTYLE><font size=\"5\">Blah</font></p>"); - } -#else { CREATE_DOC_AND_CURSOR(); @@ -694,7 +677,6 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("logical-font-size") << QTextDocumentFragment(&doc) << QString("<p DEFAULTBLOCKSTYLE><span style=\" font-size:x-large;\">Blah</span></p>"); } -#endif { CREATE_DOC_AND_CURSOR(); @@ -892,13 +874,8 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("simpletable") << QTextDocumentFragment(&doc) << QString("<table border=\"1\" cellspacing=\"2\">" -#if QT_VERSION >= 0x040200 "\n<tr>\n<td></td>\n<td></td></tr>" "\n<tr>\n<td></td>\n<td></td></tr>" -#else - "<tr><td></td><td></td></tr>" - "<tr><td></td><td></td></tr>" -#endif "</table>"); } @@ -911,11 +888,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("tablespans") << QTextDocumentFragment(&doc) << QString("<table border=\"1\" cellspacing=\"2\">" -#if QT_VERSION >= 0x040200 "\n<tr>\n<td colspan=\"2\"></td>\n<td colspan=\"2\"></td></tr>" -#else - "<tr><td colspan=\"2\"></td><td colspan=\"2\"></td></tr>" -#endif "</table>"); } @@ -961,7 +934,6 @@ void tst_QTextDocument::toHtml_data() "</table>"); } -#if QT_VERSION >= 0x040200 { CREATE_DOC_AND_CURSOR(); @@ -977,7 +949,6 @@ void tst_QTextDocument::toHtml_data() "\n<tr>\n<td></td>\n<td></td></tr>" "</table>"); } -#endif { CREATE_DOC_AND_CURSOR(); @@ -988,13 +959,8 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("nestedtable") << QTextDocumentFragment(&doc) << QString("<table border=\"1\" cellspacing=\"2\">" -#if QT_VERSION >= 0x040200 "\n<tr>\n<td></td>\n<td>\n<table border=\"1\" cellspacing=\"2\">\n<tr>\n<td>\n<p DEFAULTBLOCKSTYLE>Hey</p></td></tr></table></td></tr>" "\n<tr>\n<td></td>\n<td></td></tr>" -#else - "<tr><td></td><td><table border=\"1\" cellspacing=\"2\"><tr><td><p DEFAULTBLOCKSTYLE>Hey</p></td></tr></table></td></tr>" - "<tr><td></td><td></td></tr>" -#endif "</table>"); } @@ -1011,11 +977,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("colwidths") << QTextDocumentFragment(&doc) << QString("<table border=\"1\" cellspacing=\"2\">" -#if QT_VERSION >= 0x040200 "\n<tr>\n<td></td>\n<td width=\"30%\"></td>\n<td width=\"40\"></td></tr>" -#else - "<tr><td></td><td width=\"30%\"></td><td width=\"40\"></td></tr>" -#endif "</table>"); } @@ -1032,11 +994,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("cellproperties") << QTextDocumentFragment(&doc) << QString("<table border=\"1\" cellspacing=\"2\">" -#if QT_VERSION >= 0x040200 "\n<tr>\n<td bgcolor=\"#ffffff\"></td></tr>" -#else - "<tr><td bgcolor=\"#ffffff\"></td></tr>" -#endif "</table>"); } @@ -1111,9 +1069,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("blockmargins") << QTextDocumentFragment(&doc) << -#if QT_VERSION >= 0x040100 QString("EMPTYBLOCK") + -#endif QString("<p style=\" margin-top:10px; margin-bottom:20px; margin-left:30px; margin-right:40px; -qt-block-indent:0; text-indent:0px;\">Blah</p>"); } @@ -1129,11 +1085,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("lists") << QTextDocumentFragment(&doc) << QString("EMPTYBLOCK") + -#if QT_VERSION >= 0x040200 QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li DEFAULTBLOCKSTYLE>Blah</li></ul>"); -#else - QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb<li DEFAULTBLOCKSTYLE>Blah</ul>"); -#endif } { @@ -1156,11 +1108,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("charfmt-for-list-item") << QTextDocumentFragment(&doc) << QString("EMPTYBLOCK") + -#if QT_VERSION >= 0x040200 QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li style=\" color:#0000ff;\" DEFAULTBLOCKSTYLE><span style=\" color:#ff0000;\">Blah</span></li></ul>"); -#else - QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb<li style=\" color:#0000ff;\" DEFAULTBLOCKSTYLE><span style=\" color:#ff0000;\">Blah</span></ul>"); -#endif } { @@ -1174,9 +1122,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("block-indent") << QTextDocumentFragment(&doc) << -#if QT_VERSION >= 0x040100 QString("EMPTYBLOCK") + -#endif QString("<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:3; text-indent:30px;\">Test</p>"); } @@ -1192,11 +1138,7 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("list-indent") << QTextDocumentFragment(&doc) << QString("EMPTYBLOCK") + -#if QT_VERSION >= 0x040200 QString("<ul style=\"-qt-list-indent: 4;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>"); -#else - QString("<ul style=\"-qt-list-indent: 4;\"><li DEFAULTBLOCKSTYLE>Blah</ul>"); -#endif } { @@ -1217,11 +1159,7 @@ void tst_QTextDocument::toHtml_data() // if you press enter twice in an empty textedit and then insert 'Test' // you actually get three visible paragraphs, two empty leading ones and // a third with the actual text. the corresponding html representation - // therefore should also contain three paragraphs. that only works in >= 4.1, - // 4.0.x needs this additional block. -#if QT_VERSION < 0x040100 - cursor.insertBlock(); -#endif + // therefore should also contain three paragraphs. cursor.insertBlock(); QTextCharFormat fmt; @@ -1232,16 +1170,10 @@ void tst_QTextDocument::toHtml_data() fmt.setProperty(QTextFormat::FontSizeIncrement, 2); cursor.insertText("Test", fmt); -#if QT_VERSION < 0x040200 - QTest::newRow("blockcharfmt") << QTextDocumentFragment(&doc) - << QString("EMPTYBLOCK<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#00ff00;\"><font size=\"4\"><font size=\"5\">Test</font></font></p>"); -#else QTest::newRow("blockcharfmt") << QTextDocumentFragment(&doc) << QString("EMPTYBLOCK<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:x-large; color:#00ff00;\">Test</span></p>"); -#endif } -#if QT_VERSION >= 0x040100 { CREATE_DOC_AND_CURSOR(); @@ -1254,7 +1186,6 @@ void tst_QTextDocument::toHtml_data() QTest::newRow("blockcharfmt2") << QTextDocumentFragment(&doc) << QString("<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" color:#0000ff;\">Test</span></p>"); } -#endif { QTest::newRow("horizontal-ruler") << QTextDocumentFragment::fromHtml("<hr />") @@ -1285,11 +1216,7 @@ void tst_QTextDocument::toHtml_data() cursor = mainFrame->lastCursorPosition(); QTest::newRow("frame") << QTextDocumentFragment(&doc) -#if QT_VERSION >= 0x040200 << QString("<table border=\"1\" style=\"-qt-table-type: frame; float: right; margin-top:2px; margin-bottom:2px; margin-left:2px; margin-right:2px;\" width=\"100\" height=\"50\" bgcolor=\"#00ff00\">\n<tr>\n<td style=\"border: none;\">\n<p DEFAULTBLOCKSTYLE>Hello World</p></td></tr></table>"); -#else - << QString("<table border=\"1\" style=\"-qt-table-type: frame; float: right; margin-top:2px; margin-bottom:2px; margin-left:2px; margin-right:2px;\" width=\"100\" height=\"50\" bgcolor=\"#00ff00\"><tr><td style=\"border: none;\"><p DEFAULTBLOCKSTYLE>Hello World</p></td></tr></table>"); -#endif } { @@ -1993,11 +1920,7 @@ void tst_QTextDocument::resolvedFontInEmptyFormat() void tst_QTextDocument::defaultRootFrameMargin() { -#if QT_VERSION >= 0x040200 && QT_VERSION <= 0x040400 - QCOMPARE(doc->rootFrame()->frameFormat().margin(), 2.0); -#else QCOMPARE(doc->rootFrame()->frameFormat().margin(), 4.0); -#endif } class TestDocument : public QTextDocument @@ -2415,7 +2338,6 @@ void tst_QTextDocument::documentCleanup() void tst_QTextDocument::characterAt() { -#if QT_VERSION >= 0x040500 QTextDocument doc; QTextCursor cursor(&doc); QString text("12345\n67890"); @@ -2432,7 +2354,6 @@ void tst_QTextDocument::characterAt() c = QChar(QChar::ParagraphSeparator); QCOMPARE(doc.characterAt(i), c); } -#endif } void tst_QTextDocument::revisions() diff --git a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index bace7b4..6edaee3 100644 --- a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -2217,9 +2217,6 @@ void tst_QTextDocumentFragment::defaultFont() void tst_QTextDocumentFragment::html_spanBackgroundColor() { setHtml("<span style=\"background-color: blue\">Foo</span>"); -#if QT_VERSION <= 0x040100 - QEXPECT_FAIL("", "Fixed in >= 4.1.1", Continue); -#endif QVERIFY(doc->begin().begin().fragment().charFormat().background().color() == QColor(Qt::blue)); } @@ -2251,9 +2248,6 @@ void tst_QTextDocumentFragment::html_brokenTitle() void tst_QTextDocumentFragment::html_blockVsInline() { -#if QT_VERSION <= 0x040100 - QEXPECT_FAIL("", "Fixed in >= 4.1.1", Abort); -#endif { setHtml("<html><body><div><b>Foo<div>Bar"); QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); @@ -2314,15 +2308,8 @@ void tst_QTextDocumentFragment::html_tbody() QTextTable *table = cursor.currentTable(); QVERIFY(table); QCOMPARE(table->columns(), 1); -#if QT_VERSION <= 0x040100 - QEXPECT_FAIL("", "Fixed in >= 4.1.1", Abort); -#endif QCOMPARE(table->rows(), 2); - -#if QT_VERISON >= 0x040200 QVERIFY(table->format().headerRowCount(), 1); -#endif - QCOMPARE(table->cellAt(0, 0).firstCursorPosition().block().text(), QString("First Cell")); QCOMPARE(table->cellAt(1, 0).firstCursorPosition().block().text(), QString("Second Cell")); } @@ -2380,7 +2367,6 @@ void tst_QTextDocumentFragment::html_nestedTables() void tst_QTextDocumentFragment::html_rowSpans() { -#if QT_VERSION > 0x040100 setHtml("" "<table border=\"1\" width=\"100%\">" " <tr>" @@ -2413,7 +2399,6 @@ void tst_QTextDocumentFragment::html_rowSpans() QCOMPARE(table->cellAt(3, 0).firstCursorPosition().block().text(), QString("blubb")); QCOMPARE(table->cellAt(3, 1).firstCursorPosition().block().text(), QString("baz")); -#endif } void tst_QTextDocumentFragment::html_rowSpans2() diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 534c7b0..4ea3e2f 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -182,9 +182,6 @@ void tst_QTextLayout::init() testFont.setFamily("__Qt__Box__Engine__"); testFont.setPixelSize(TESTFONT_SIZE); testFont.setWeight(QFont::Normal); -#if defined(Q_WS_MAC) && QT_VERSION < 0x040200 - QSKIP("QTestFontEngine is not supported on the mac right now", SkipAll); -#endif QCOMPARE(QFontMetrics(testFont).width('a'), testFont.pixelSize()); } diff --git a/tests/auto/qtextobject/tst_qtextobject.cpp b/tests/auto/qtextobject/tst_qtextobject.cpp index 4fbc155..4d1d4b2 100644 --- a/tests/auto/qtextobject/tst_qtextobject.cpp +++ b/tests/auto/qtextobject/tst_qtextobject.cpp @@ -62,6 +62,7 @@ public: private slots: void getSetCheck(); + void testStandAloneTextObject(); }; tst_QTextObject::tst_QTextObject() @@ -105,5 +106,23 @@ void tst_QTextObject::getSetCheck() QCOMPARE(INT_MAX, obj2.userState()); } +class TestTextObject : public QTextObject +{ +public: + TestTextObject(QTextDocument *document) : QTextObject(document) {} +}; + +void tst_QTextObject::testStandAloneTextObject() +{ + QTextDocument document; + TestTextObject textObject(&document); + + QCOMPARE(textObject.document(), &document); + // don't crash + textObject.format(); + textObject.formatIndex(); + QCOMPARE(textObject.objectIndex(), -1); +} + QTEST_MAIN(tst_QTextObject) #include "tst_qtextobject.moc" diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index f70082d..c60e0bf 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -533,7 +533,7 @@ void tst_QScriptEngine::bengali() void tst_QScriptEngine::gurmukhi() { -#if QT_VERSION >= 0x040001 && defined(Q_WS_X11) +#if defined(Q_WS_X11) { if (QFontDatabase().families(QFontDatabase::Gurmukhi).contains("Lohit Punjabi")) { QFont f("Lohit Punjabi"); diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp index a60433a..358b4b6 100644 --- a/tests/auto/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/qtextstream/tst_qtextstream.cpp @@ -60,6 +60,8 @@ #include <QTextCodec> #include <QProcess> +#include "../network-settings.h" + static const char *TestFileName = "testfile"; Q_DECLARE_METATYPE(qlonglong) @@ -98,10 +100,8 @@ private slots: void readLineFromTextDevice_data(); void readLineFromTextDevice(); void readLineUntilNull(); -#if QT_VERSION >= 0x040103 void readLineMaxlen_data(); void readLineMaxlen(); -#endif void readLinesFromBufferCRCR(); // all @@ -218,13 +218,11 @@ private slots: void utf8IncompleteAtBufferBoundary_data(); void utf8IncompleteAtBufferBoundary(); -#if QT_VERSION >= 0x040100 // status void status_real_read_data(); void status_real_read(); void status_integer_read(); void status_word_read(); -#endif // use case tests void useCase1(); @@ -1229,7 +1227,7 @@ void tst_QTextStream::stillOpenWhenAtEnd() QSKIP("Qt/CE: Cannot test network on emulator", SkipAll); #endif QTcpSocket socket; - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForReadyRead(5000)); QTextStream stream2(&socket); diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index 6b6197a..235d63b 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -326,10 +326,6 @@ void tst_QThread::isRunning() void tst_QThread::setPriority() { -#if QT_VERSION < 0x040100 - QSKIP("QThread::setPriority() was introduced in 4.1.0, you are testing " QT_VERSION_STR, - SkipAll); -#else Simple_Thread thread; // cannot change the priority, since the thread is not running @@ -401,7 +397,6 @@ void tst_QThread::setPriority() QTest::ignoreMessage(QtWarningMsg, "QThread::setPriority: Cannot set priority, thread is not running"); thread.setPriority(QThread::TimeCriticalPriority); QCOMPARE(thread.priority(), QThread::InheritPriority); -#endif } void tst_QThread::priority() diff --git a/tests/auto/qtime/tst_qtime.cpp b/tests/auto/qtime/tst_qtime.cpp index ea4700d..cc91e9d 100644 --- a/tests/auto/qtime/tst_qtime.cpp +++ b/tests/auto/qtime/tst_qtime.cpp @@ -254,11 +254,7 @@ void tst_QTime::isNull() QTime t1; QVERIFY( t1.isNull() ); QTime t2(0,0,0); -#if QT_VERSION >= 0x040100 QVERIFY( !t2.isNull() ); -#else - QVERIFY( t2.isNull() ); -#endif QTime t3(0,0,1); QVERIFY( !t3.isNull() ); QTime t4(0,0,0,1); @@ -270,11 +266,7 @@ void tst_QTime::isNull() void tst_QTime::isValid() { QTime t1; -#if QT_VERSION >= 0x040100 QVERIFY( !t1.isValid() ); -#else - QVERIFY( t1.isValid() ); -#endif QTime t2(24,0,0,0); QVERIFY( !t2.isValid() ); QTime t3(23,60,0,0); @@ -599,11 +591,7 @@ void tst_QTime::fromString_data() QTest::newRow( "data0" ) << QString("00:00:00") << QTime(0,0,0,0) << QTime(0,0,0,0); QTest::newRow( "data1" ) << QString("10:12:34") << QTime(10,12,34,0) << QTime(10,12,34,0); QTest::newRow( "data2" ) << QString("19:03:54.998601") << QTime(19, 3, 54, 999) << QTime(19, 3, 54, 999); -#if QT_VERSION >= 0x040200 QTest::newRow( "data3" ) << QString("19:03:54.999601") << QTime(19, 3, 54, 999) << QTime(19, 3, 54, 999); -#else - QTest::newRow( "data3" ) << QString("19:03:54.999601") << QTime() << QTime(); -#endif } void tst_QTime::fromString() @@ -671,9 +659,7 @@ void tst_QTime::toString_format_data() QTest::newRow( "data2" ) << QTime(10,12,34,45) << QString("hh:m:ss:z") << QString("10:12:34:45"); QTest::newRow( "data3" ) << QTime(10,12,34,45) << QString("hh:ss ap") << QString("10:34 am"); QTest::newRow( "data4" ) << QTime(22,12,34,45) << QString("hh:zzz AP") << QString("10:045 PM"); -#if (QT_VERSION-0 >= 0x030200) QTest::newRow( "data5" ) << QTime(230,230,230,230) << QString("hh:mm:ss") << QString(); -#endif } void tst_QTime::toString_format() diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp index e35f406..9576193 100644 --- a/tests/auto/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/qtimeline/tst_qtimeline.cpp @@ -42,10 +42,6 @@ #include <QtTest/QtTest> -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include <qtimeline.h> //TESTED_CLASS= @@ -705,5 +701,3 @@ void tst_QTimeLine::resume() QTEST_MAIN(tst_QTimeLine) #include "tst_qtimeline.moc" - -#endif //QT_VERSION diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 917a584..bffb4f2 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -44,6 +44,7 @@ #include <qtimer.h> +#include <qthread.h> @@ -81,6 +82,8 @@ private slots: void recurringTimer_data(); void recurringTimer(); void deleteLaterOnQTimer(); // long name, don't want to shadow QObject::deleteLater() + void moveToThread(); + void restartedTimerFiresTooSoon(); }; class TimerHelper : public QObject @@ -386,5 +389,97 @@ void tst_QTimer::deleteLaterOnQTimer() QVERIFY(pointer.isNull()); } +void tst_QTimer::moveToThread() +{ + QTimer ti1; + QTimer ti2; + ti1.start(200); + ti2.start(200); + QVERIFY((ti1.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff)); + QThread tr; + ti1.moveToThread(&tr); + connect(&ti1,SIGNAL(timeout()), &tr, SLOT(quit())); + tr.start(); + QTimer ti3; + ti3.start(200); + QVERIFY((ti3.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff)); + QVERIFY((ti3.timerId() & 0xffffff) != (ti1.timerId() & 0xffffff)); + QTest::qWait(300); + QVERIFY(tr.wait()); + ti2.stop(); + QTimer ti4; + ti4.start(200); + ti3.stop(); + ti2.start(200); + ti3.start(200); + QVERIFY((ti4.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff)); + QVERIFY((ti3.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff)); + QVERIFY((ti3.timerId() & 0xffffff) != (ti1.timerId() & 0xffffff)); +} + +class RestartedTimerFiresTooSoonObject : public QObject +{ + Q_OBJECT + +public: + QBasicTimer m_timer; + + int m_interval; + QTime m_startedTime; + QEventLoop eventLoop; + + inline RestartedTimerFiresTooSoonObject() + : QObject(), m_interval(0) + { } + + void timerFired() + { + static int interval = 1000; + + m_interval = interval; + m_startedTime.start(); + m_timer.start(interval, this); + + // alternate between single-shot and 1 sec + interval = interval ? 0 : 1000; + } + + void timerEvent(QTimerEvent* ev) + { + if (ev->timerId() != m_timer.timerId()) + return; + + m_timer.stop(); + + QTime now = QTime::currentTime(); + int elapsed = m_startedTime.elapsed(); + + if (elapsed < m_interval / 2) { + // severely too early! + m_timer.stop(); + eventLoop.exit(-1); + return; + } + + timerFired(); + + // don't do this forever + static int count = 0; + if (count++ > 20) { + m_timer.stop(); + eventLoop.quit(); + return; + } + } +}; + +void tst_QTimer::restartedTimerFiresTooSoon() +{ + RestartedTimerFiresTooSoonObject object; + object.timerFired(); + QVERIFY(object.eventLoop.exec() == 0); +} + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" +\ diff --git a/tests/auto/qtranslator/qtranslator.pro b/tests/auto/qtranslator/qtranslator.pro index e4ad22a..0d67f70 100644 --- a/tests/auto/qtranslator/qtranslator.pro +++ b/tests/auto/qtranslator/qtranslator.pro @@ -3,7 +3,7 @@ SOURCES += tst_qtranslator.cpp wince*: { - addFiles.sources = hellotr_la.qm + addFiles.sources = hellotr_la.qm msgfmt_from_po.qm addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 272a96f..655ea4e 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -200,6 +200,7 @@ private slots: void selectAll(); void disabledButCheckable(); + void sortByColumn_data(); void sortByColumn(); void evilModel_data(); @@ -208,6 +209,8 @@ private slots: void indexRowSizeHint(); void addRowsWhileSectionsAreHidden(); + void filterProxyModelCrash(); + // task-specific tests: void task174627_moveLeftToRoot(); void task171902_expandWith1stColHidden(); @@ -221,6 +224,7 @@ private slots: void task202039_closePersistentEditor(); void task238873_avoidAutoReopening(); void task244304_clickOnDecoration(); + void task246536_scrollbarsNotWorking(); }; class QtTestModel: public QAbstractItemModel @@ -470,11 +474,7 @@ void tst_QTreeView::construction() QCOMPARE(view.iconSize(), QSize()); QCOMPARE(view.indexAt(QPoint()), QModelIndex()); QVERIFY(!view.indexWidget(QModelIndex())); -#if QT_VERSION >= 0x040400 QVERIFY(qobject_cast<QStyledItemDelegate *>(view.itemDelegate())); -#else - QVERIFY(qobject_cast<QItemDelegate *>(view.itemDelegate())); -#endif QVERIFY(!view.itemDelegateForColumn(-1)); QVERIFY(!view.itemDelegateForColumn(0)); QVERIFY(!view.itemDelegateForColumn(1)); @@ -999,11 +999,7 @@ void tst_QTreeView::itemDelegate() { QTreeView view; -#if QT_VERSION >= 0x040400 QVERIFY(qobject_cast<QStyledItemDelegate *>(view.itemDelegate())); -#else - QVERIFY(qobject_cast<QItemDelegate *>(view.itemDelegate())); -#endif QPointer<QAbstractItemDelegate> oldDelegate = view.itemDelegate(); otherItemDelegate = new QItemDelegate; @@ -1678,9 +1674,16 @@ void tst_QTreeView::moveCursor() view.setColumnHidden(0, true); QVERIFY(view.isColumnHidden(0)); view.show(); + qApp->setActiveWindow(&view); - QModelIndex actual = view.moveCursor(PublicView::MoveDown, Qt::NoModifier); + //here the first visible index should be selected + //because the view got the focus QModelIndex expected = model.index(1, 1, QModelIndex()); + QCOMPARE(view.currentIndex(), expected); + + //then pressing down should go to the next line + QModelIndex actual = view.moveCursor(PublicView::MoveDown, Qt::NoModifier); + expected = model.index(2, 1, QModelIndex()); QCOMPARE(actual, expected); view.setRowHidden(0, QModelIndex(), false); @@ -1860,14 +1863,8 @@ void tst_QTreeView::indexBelow() i = view.indexBelow(i); QVERIFY(i.isValid()); QCOMPARE(i.row(), 1); -#if QT_VERSION >= 0x040100 i = view.indexBelow(i); QVERIFY(!i.isValid()); -#else - // Qt 4.0.x returns the bottom index - i = view.indexBelow(i); - QVERIFY(i.isValid()); -#endif } void tst_QTreeView::clicked() @@ -2464,16 +2461,39 @@ void tst_QTreeView::disabledButCheckable() QCOMPARE(item->checkState(), Qt::Unchecked); } -// Checks that sortByColumn also sets the sortIndicator +void tst_QTreeView::sortByColumn_data() +{ + QTest::addColumn<bool>("sortingEnabled"); + QTest::newRow("sorting enabled") << true; + QTest::newRow("sorting disabled") << false; +} + +// Checks sorting and that sortByColumn also sets the sortIndicator void tst_QTreeView::sortByColumn() { + QFETCH(bool, sortingEnabled); QTreeView view; - QStandardItemModel model(2,2); + QStandardItemModel model(4,2); + model.setItem(0,0,new QStandardItem("b")); + model.setItem(1,0,new QStandardItem("d")); + model.setItem(2,0,new QStandardItem("c")); + model.setItem(3,0,new QStandardItem("a")); + model.setItem(0,1,new QStandardItem("e")); + model.setItem(1,1,new QStandardItem("g")); + model.setItem(2,1,new QStandardItem("h")); + model.setItem(3,1,new QStandardItem("f")); + + view.setSortingEnabled(sortingEnabled); view.setModel(&model); view.sortByColumn(1); QCOMPARE(view.header()->sortIndicatorSection(), 1); + QCOMPARE(view.model()->data(view.model()->index(0,1)).toString(), QString::fromLatin1("h")); + QCOMPARE(view.model()->data(view.model()->index(1,1)).toString(), QString::fromLatin1("g")); view.sortByColumn(0, Qt::AscendingOrder); QCOMPARE(view.header()->sortIndicatorSection(), 0); + QCOMPARE(view.model()->data(view.model()->index(0,0)).toString(), QString::fromLatin1("a")); + QCOMPARE(view.model()->data(view.model()->index(1,0)).toString(), QString::fromLatin1("b")); + } /* @@ -2804,6 +2824,29 @@ void tst_QTreeView::indexRowSizeHint() QCOMPARE(view.indexRowSizeHint(index), w->sizeHint().height()); } +void tst_QTreeView::filterProxyModelCrash() +{ + QStandardItemModel model; + QList<QStandardItem *> items; + for (int i = 0; i < 100; i++) + items << new QStandardItem(QString::fromLatin1("item %1").arg(i)); + model.appendColumn(items); + + QSortFilterProxyModel proxy; + proxy.setSourceModel(&model); + + QTreeView view; + view.setModel(&proxy); + view.show(); + QTest::qWait(30); + proxy.invalidate(); + view.verticalScrollBar()->setValue(15); + QTest::qWait(20); + + proxy.invalidate(); + view.repaint(); //used to crash +} + class task174627_TreeView : public QTreeView { Q_OBJECT @@ -3192,6 +3235,42 @@ void tst_QTreeView::task244304_clickOnDecoration() QCOMPARE(view.currentIndex(), item1.index()); } +void tst_QTreeView::task246536_scrollbarsNotWorking() +{ + struct MyObject : public QObject + { + MyObject() : count(0) + { + } + + bool eventFilter(QObject*, QEvent *e) + { + if (e->type() == QEvent::Paint) + count++; + + return false; + } + + int count; + }; + QTreeView tree; + MyObject o; + tree.viewport()->installEventFilter(&o); + QStandardItemModel model; + tree.setModel(&model); + tree.show(); + QTest::qWait(100); + QList<QStandardItem *> items; + for(int i=0; i<100; ++i){ + items << new QStandardItem(QString::fromLatin1("item %1").arg(i)); + } + model.invisibleRootItem()->appendColumn(items); + QTest::qWait(100); + o.count = 0; + tree.verticalScrollBar()->setValue(50); + QTest::qWait(100); + QVERIFY(o.count > 0); +} QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index b21b240..c3595c2 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -1555,9 +1555,6 @@ void tst_QTreeWidget::keyboardNavigation() void tst_QTreeWidget::scrollToItem() { -#if QT_VERSION < 0x040100 - QSKIP("This behaviour will be merged from main in 4.1.0.", SkipAll); -#else // Check if all parent nodes of the item found are expanded. // Reported in task #78761 QTreeWidgetItem *bar; @@ -1586,7 +1583,6 @@ void tst_QTreeWidget::scrollToItem() QVERIFY(testWidget->isItemExpanded(bar)); bar = bar->parent(); QVERIFY(testWidget->isItemExpanded(bar)); -#endif } // From task #85413 @@ -2087,7 +2083,6 @@ void tst_QTreeWidget::itemWidget() } } -#if QT_VERSION >= 0x040200 void tst_QTreeWidget::insertItemsWithSorting_data() { QTest::addColumn<int>("sortOrder"); @@ -2259,8 +2254,6 @@ void tst_QTreeWidget::insertExpandedItemsWithSorting_data() << (QStringList() << "h" << "g" << "f" << "e"); } - - // From Task 134978 void tst_QTreeWidget::insertExpandedItemsWithSorting() { @@ -2421,7 +2414,6 @@ void tst_QTreeWidget::changeDataWithSorting() QCOMPARE(dataChangedSpy.count(), 1); QCOMPARE(layoutChangedSpy.count(), reorderingExpected ? 1 : 0); } -#endif // QT_VERSION void tst_QTreeWidget::itemOperatorLessThan() { @@ -2599,7 +2591,6 @@ void tst_QTreeWidget::removeSelectedItem() QCOMPARE(selModel->isSelected(w->model()->index(0,0)), false); delete w; - } class AnotherTreeWidget : public QTreeWidget diff --git a/tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp index 49abc6d..e4572c0 100644 --- a/tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp +++ b/tests/auto/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp @@ -42,8 +42,6 @@ #include <QtTest/QtTest> -#if QT_VERSION >= 0x040100 - #include <qtreewidget.h> #include <qtreewidgetitemiterator.h> #include <qapplication.h> @@ -61,7 +59,6 @@ public: tst_QTreeWidgetItemIterator(); ~tst_QTreeWidgetItemIterator(); - public slots: void initTestCase(); void cleanupTestCase(); @@ -136,7 +133,7 @@ void tst_QTreeWidgetItemIterator::initTestCase() case 9: top->setFlags(Qt::ItemIsEnabled);break; case 10: top->setFlags(Qt::ItemIsEnabled);break; - case 11: + case 11: top->setFlags(0); break; @@ -982,7 +979,6 @@ void tst_QTreeWidgetItemIterator::postdecrement() } - void tst_QTreeWidgetItemIterator::plus_eq_data() { QTest::addColumn<int>("start"); @@ -1146,9 +1142,9 @@ void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIte QTest::addColumn<int>("grandChildItems"); // Populate the tree data // we have one iterator pointing to an item in the tree. // This iterator will be updated if we delete the item it is pointing to. - // + // QTest::addColumn<int>("removeindex"); // The index of the node we want to remove - QTest::addColumn<int>("iterator_initial_index"); // The new expected index of + QTest::addColumn<int>("iterator_initial_index"); // The new expected index of QTest::addColumn<int>("iterator_advance_after_removal"); QTest::addColumn<QString>("iterator_new_value"); // The new current item value of the iterator QTest::newRow("Remove 13, it points to 25, it-=1. We should get top0,child2,grandchild2") << 3 << 3 << 3 << 13 << 25 << -1 << QString("top0,child2,grandchild2"); @@ -1245,7 +1241,3 @@ void tst_QTreeWidgetItemIterator::initializeIterator() QTEST_MAIN(tst_QTreeWidgetItemIterator) #include "tst_qtreewidgetitemiterator.moc" - -#else -QTEST_NOOP_MAIN -#endif diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp index 57e779c..e79be38 100644 --- a/tests/auto/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp @@ -522,9 +522,6 @@ void tst_QUdpSocket::bindMode() #endif } -#if QT_VERSION < 0x040100 - QSKIP("QUdpSocket::BindMode was added in Qt 4.1.", SkipAll); -#else QUdpSocket socket; QVERIFY2(socket.bind(), socket.errorString().toLatin1().constData()); QUdpSocket socket2; @@ -550,7 +547,6 @@ void tst_QUdpSocket::bindMode() QVERIFY(!socket2.bind(socket.localPort())); QVERIFY(!socket2.bind(socket.localPort(), QUdpSocket::ReuseAddressHint)); #endif -#endif } void tst_QUdpSocket::writeDatagramToNonExistingPeer_data() diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 3b938f2..5a79792 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -1129,11 +1129,7 @@ void tst_QUrl::setUrl() check("host",ulong.host(),"swww.gad.de"); check("path",ulong.path(),"/servlet/CookieAccepted"); -#if QT_VERSION < 300 - qt_set_locale_codec( KGlobal::charsets()->codecForName( "iso-8859-1" ) ); -#else QTextCodec::setCodecForLocale( KGlobal::charsets()->codecForName( "iso-8859-1" ) ); -#endif // UTF8 tests KURL uloc("/home/dfaure/konqtests/Matériel"); check("locale8bit",uloc.url().latin1(),"file:/home/dfaure/konqtests/Mat%E9riel"); // escaping the letter would be correct too @@ -1155,11 +1151,7 @@ void tst_QUrl::setUrl() uloc = KURL::fromPathOrURL( "" ); check("fromPathOrURL url", uloc.isValid()?"valid":"malformed", "malformed"); -#if QT_VERSION < 300 - qt_set_locale_codec( KGlobal::charsets()->codecForName( "koi8-r" ) ); -#else QTextCodec::setCodecForLocale( KGlobal::charsets()->codecForName( "koi8-r" ) ); -#endif baseURL = "file:/home/coolo"; KURL russian = baseURL.directory(false, true) + QString::fromLocal8Bit( "ÆÇÎ7" ); check( "russian", russian.url(), "file:/home/%C6%C7%CE7" ); diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 78d597e..d15f9c8 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -2414,13 +2414,9 @@ void tst_QVariant::url() void tst_QVariant::globalColor() { -#if QT_VERSION >= 0x040200 QVariant variant(Qt::blue); QVERIFY(variant.type() == QVariant::Color); QVERIFY(qVariantValue<QColor>(variant) == QColor(Qt::blue)); -#else - QSKIP("Implemented/fixed in 4.2", SkipSingle); -#endif } void tst_QVariant::variantMap() diff --git a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp b/tests/auto/qwaitcondition/tst_qwaitcondition.cpp index b2305cb..1e0136f 100644 --- a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp +++ b/tests/auto/qwaitcondition/tst_qwaitcondition.cpp @@ -161,9 +161,6 @@ public: void tst_QWaitCondition::wait_QMutex() { -#if defined(Q_OS_WIN32) && QT_VERSION < 0x030200 - QSKIP("Known race-conditions cause sporadic failures", SkipAll); -#else int x; for (int i = 0; i < iterations; ++i) { { @@ -240,7 +237,6 @@ void tst_QWaitCondition::wait_QMutex() } } } -#endif } void tst_QWaitCondition::wait_QReadWriteLock() @@ -446,9 +442,6 @@ int wake_Thread_2::count = 0; void tst_QWaitCondition::wakeOne() { -#if defined(Q_OS_WIN32) && QT_VERSION < 0x030200 - QSKIP("Known race-conditions cause sporadic failures", SkipAll); -#else int x; // wake up threads, one at a time for (int i = 0; i < iterations; ++i) { @@ -597,7 +590,7 @@ void tst_QWaitCondition::wakeOne() // QReadWriteLock QReadWriteLock readWriteLock; - wake_Thread_2 rwthread[ThreadCount]; + wake_Thread_2 rwthread[ThreadCount]; readWriteLock.lockForWrite(); for (x = 0; x < ThreadCount; ++x) { @@ -641,14 +634,10 @@ void tst_QWaitCondition::wakeOne() QCOMPARE(wake_Thread_2::count, 0); } -#endif } void tst_QWaitCondition::wakeAll() { -#if defined(Q_OS_WIN32) && QT_VERSION < 0x030200 - QSKIP("Known race-conditions cause sporadic failures", SkipAll); -#else int x; for (int i = 0; i < iterations; ++i) { QMutex mutex; @@ -715,7 +704,6 @@ void tst_QWaitCondition::wakeAll() QCOMPARE(exited, ThreadCount); QCOMPARE(wake_Thread_2::count, 0); } -#endif } class wait_RaceConditionThread : public QThread diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 42f496a..a052034 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -343,6 +343,7 @@ private slots: void paintOutsidePaintEvent(); #endif void updateOnDestroyedSignal(); + void toplevelLineEditFocus(); private: bool ensureScreenSize(int width, int height); @@ -2563,9 +2564,6 @@ void tst_QWidget::setGeometry() void tst_QWidget::windowOpacity() { -#if defined(Q_WS_X11) && QT_VERSION < 0x040200 - QSKIP("QWidget::windowOpacity is broken in Qt < 4.2 on X11", SkipAll); -#else #ifdef Q_OS_WINCE QSKIP( "Windows CE does not support windowOpacity", SkipAll); #endif @@ -2575,43 +2573,27 @@ void tst_QWidget::windowOpacity() // Initial value should be 1.0 QCOMPARE(widget.windowOpacity(), 1.0); // children should always return 1.0 -#if QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Prior to 4.2, all children widgets returned 0.0", Continue); -#endif QCOMPARE(child.windowOpacity(), 1.0); widget.setWindowOpacity(0.0); QCOMPARE(widget.windowOpacity(), 0.0); child.setWindowOpacity(0.0); -#if QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Prior to 4.2, all children widgets returned 0.0", Continue); -#endif QCOMPARE(child.windowOpacity(), 1.0); widget.setWindowOpacity(1.0); QCOMPARE(widget.windowOpacity(), 1.0); child.setWindowOpacity(1.0); -#if QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Prior to 4.2, all children widgets returned 0.0", Continue); -#endif QCOMPARE(child.windowOpacity(), 1.0); widget.setWindowOpacity(2.0); QCOMPARE(widget.windowOpacity(), 1.0); child.setWindowOpacity(2.0); -#if QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Prior to 4.2, all children widgets returned 0.0", Continue); -#endif QCOMPARE(child.windowOpacity(), 1.0); widget.setWindowOpacity(-1.0); QCOMPARE(widget.windowOpacity(), 0.0); child.setWindowOpacity(-1.0); -#if QT_VERSION < 0x040200 - QEXPECT_FAIL("", "Prior to 4.2, all children widgets returned 0.0", Continue); -#endif QCOMPARE(child.windowOpacity(), 1.0); -#endif } class UpdateWidget : public QWidget @@ -5320,7 +5302,7 @@ void tst_QWidget::subtractOpaqueSiblings() { #ifdef QT_MAC_USE_COCOA QSKIP("Cocoa only has rect granularity.", SkipAll); -#elif defined(Q_WIDGET_USE_DIRTYLIST) || (QT_VERSION >= 0x040400) +#else QWidget w; w.setGeometry(50, 50, 300, 300); @@ -8727,5 +8709,20 @@ void tst_QWidget::updateOnDestroyedSignal() QTest::qWait(200); } +void tst_QWidget::toplevelLineEditFocus() +{ + testWidget->hide(); + + QLineEdit w; + w.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&w); +#endif + QTest::qWait(200); + + QCOMPARE(QApplication::activeWindow(), &w); + QCOMPARE(QApplication::focusWidget(), &w); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index 400d124..9b9c209 100644 --- a/tests/auto/qwizard/tst_qwizard.cpp +++ b/tests/auto/qwizard/tst_qwizard.cpp @@ -111,6 +111,7 @@ private slots: void task183550_stretchFactor(); void task161658_alignments(); void task177022_setFixedSize(); + void task248107_backButton(); /* Things that could be added: @@ -2481,5 +2482,40 @@ void tst_QWizard::task177022_setFixedSize() } +void tst_QWizard::task248107_backButton() +{ + QWizard wizard; + QWizardPage page1; + QWizardPage page2; + QWizardPage page3; + QWizardPage page4; + wizard.addPage(&page1); + wizard.addPage(&page2); + wizard.addPage(&page3); + wizard.addPage(&page4); + + wizard.show(); + QTest::qWait(100); + QCOMPARE(wizard.currentPage(), &page1); + + QTest::mouseClick(wizard.button(QWizard::NextButton), Qt::LeftButton); + QCOMPARE(wizard.currentPage(), &page2); + + QTest::mouseClick(wizard.button(QWizard::NextButton), Qt::LeftButton); + QCOMPARE(wizard.currentPage(), &page3); + + QTest::mouseClick(wizard.button(QWizard::NextButton), Qt::LeftButton); + QCOMPARE(wizard.currentPage(), &page4); + + QTest::mouseClick(wizard.button(QWizard::BackButton), Qt::LeftButton); + QCOMPARE(wizard.currentPage(), &page3); + + QTest::mouseClick(wizard.button(QWizard::BackButton), Qt::LeftButton); + QCOMPARE(wizard.currentPage(), &page2); + + QTest::mouseClick(wizard.button(QWizard::BackButton), Qt::LeftButton); + QCOMPARE(wizard.currentPage(), &page1); +} + QTEST_MAIN(tst_QWizard) #include "tst_qwizard.moc" diff --git a/tests/auto/qwmatrix/tst_qwmatrix.cpp b/tests/auto/qwmatrix/tst_qwmatrix.cpp index 47fd41f..4a816a8 100644 --- a/tests/auto/qwmatrix/tst_qwmatrix.cpp +++ b/tests/auto/qwmatrix/tst_qwmatrix.cpp @@ -299,16 +299,12 @@ void tst_QWMatrix::mapping_data() void tst_QWMatrix::mapRect() { -#if QT_VERSION >= 0x030100 QFETCH( QMatrix, matrix ); QFETCH( QRect, src ); // qDebug( "got src: %d/%d (%d/%d), matrix=[ %f %f %f %f %f %f ]", -// src.x(), src.y(), src.width(), src.height(), -// matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), matrix.dx(), matrix.dy() ); +// src.x(), src.y(), src.width(), src.height(), +// matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), matrix.dx(), matrix.dy() ); QTEST( QPolygon( matrix.mapRect(src) ), "res" ); -#else - QSKIP( "Not tested with Qt versions < 3.1", SkipAll); -#endif } void tst_QWMatrix::operator_star_qrect() @@ -349,7 +345,6 @@ void tst_QWMatrix::operator_star_qwmatrix() void tst_QWMatrix::assignments() { -#if QT_VERSION >= 0x040000 QMatrix m; m.scale(2, 3); m.rotate(45); @@ -371,24 +366,16 @@ void tst_QWMatrix::assignments() QCOMPARE(m.m22(), c2.m22()); QCOMPARE(m.dx(), c2.dx()); QCOMPARE(m.dy(), c2.dy()); -#else - QSKIP( "Not tested with Qt versions < 4.0", SkipAll); -#endif } void tst_QWMatrix::mapToPolygon() { -#if QT_VERSION >= 0x030100 QFETCH( QMatrix, matrix ); QFETCH( QRect, src ); QFETCH( QPolygon, res ); QCOMPARE( matrix.mapToPolygon( src ), res ); -#else - QSKIP( "Not tested with Qt versions < 3.1", SkipAll); -// qDebug("passing test; transformations are broken in 3.0.x" ); -#endif } diff --git a/tests/auto/qwritelocker/tst_qwritelocker.cpp b/tests/auto/qwritelocker/tst_qwritelocker.cpp index 21bfa8a..258309d 100644 --- a/tests/auto/qwritelocker/tst_qwritelocker.cpp +++ b/tests/auto/qwritelocker/tst_qwritelocker.cpp @@ -189,9 +189,6 @@ void tst_QWriteLocker::unlockAndRelockTest() void tst_QWriteLocker::lockerStateTest() { -#if QT_VERSION < 0x040200 - QSKIP("QWriteLocker doesn't keep state in Qt < 4.2", SkipAll); -#else class LockerStateThread : public tst_QWriteLockerThread { public: @@ -228,7 +225,6 @@ void tst_QWriteLocker::lockerStateTest() delete thread; thread = 0; -#endif } QTEST_MAIN(tst_QWriteLocker) diff --git a/tests/auto/rcc/tst_rcc.cpp b/tests/auto/rcc/tst_rcc.cpp index 3297b2b..57649b4 100644 --- a/tests/auto/rcc/tst_rcc.cpp +++ b/tests/auto/rcc/tst_rcc.cpp @@ -59,8 +59,6 @@ public: private slots: void rcc_data(); void rcc(); - -private: }; @@ -68,18 +66,9 @@ QString findExpectedFile(const QString &base) { QString expectedrccfile = base; - if (QT_VERSION >= 0x040500 && QFileInfo(expectedrccfile + QLatin1String(".450")).exists()) + // Must be updated with each minor release. + if (QFileInfo(expectedrccfile + QLatin1String(".450")).exists()) expectedrccfile += QLatin1String(".450"); - else if (QT_VERSION >= 0x040400 && QFileInfo(expectedrccfile + QLatin1String(".440")).exists()) - expectedrccfile += QLatin1String(".440"); - else if (QT_VERSION >= 0x040300 && QFileInfo(expectedrccfile + QLatin1String(".430")).exists()) - expectedrccfile += QLatin1String(".430"); - else if (QT_VERSION >= 0x040200 && QFileInfo(expectedrccfile + QLatin1String(".420")).exists()) - expectedrccfile += QLatin1String(".420"); - else if (QT_VERSION >= 0x040100 && QFileInfo(expectedrccfile + QLatin1String(".410")).exists()) - expectedrccfile += QLatin1String(".410"); - else if (QT_VERSION >= 0x040000 && QFileInfo(expectedrccfile + QLatin1String(".400")).exists()) - expectedrccfile += QLatin1String(".400"); return expectedrccfile; } diff --git a/tests/auto/selftests/alive/alive.pro b/tests/auto/selftests/alive/alive.pro index 4a6b788..08cf358 100644 --- a/tests/auto/selftests/alive/alive.pro +++ b/tests/auto/selftests/alive/alive.pro @@ -5,3 +5,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = alive diff --git a/tests/auto/selftests/assert/assert.pro b/tests/auto/selftests/assert/assert.pro index 87513d4..0e48375 100644 --- a/tests/auto/selftests/assert/assert.pro +++ b/tests/auto/selftests/assert/assert.pro @@ -8,3 +8,4 @@ CONFIG -= debug_and_release_target !win32:CONFIG += debug +TARGET = assert diff --git a/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro b/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro index 34a43d0..c9ec7e2 100644 --- a/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro +++ b/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = benchlibcallgrind diff --git a/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro b/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro index 41e090e..44b0295 100644 --- a/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro +++ b/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = benchlibeventcounter diff --git a/tests/auto/selftests/benchliboptions/benchliboptions.pro b/tests/auto/selftests/benchliboptions/benchliboptions.pro index 2f02eef..4dee69f 100644 --- a/tests/auto/selftests/benchliboptions/benchliboptions.pro +++ b/tests/auto/selftests/benchliboptions/benchliboptions.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = benchliboptions diff --git a/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro b/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro index 3d8cbfa..3621449 100644 --- a/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro +++ b/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = benchlibtickcounter diff --git a/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro b/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro index 364e80b..f4694b5 100644 --- a/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro +++ b/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = benchlibwalltime diff --git a/tests/auto/selftests/cmptest/cmptest.pro b/tests/auto/selftests/cmptest/cmptest.pro index c19a77a..8b2df1c 100644 --- a/tests/auto/selftests/cmptest/cmptest.pro +++ b/tests/auto/selftests/cmptest/cmptest.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = cmptest diff --git a/tests/auto/selftests/commandlinedata/commandlinedata.pro b/tests/auto/selftests/commandlinedata/commandlinedata.pro index c900fc8..96bfa5b 100644 --- a/tests/auto/selftests/commandlinedata/commandlinedata.pro +++ b/tests/auto/selftests/commandlinedata/commandlinedata.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = commandlinedata diff --git a/tests/auto/selftests/crashes/crashes.pro b/tests/auto/selftests/crashes/crashes.pro index 57eb4c7..7eec6ea 100644 --- a/tests/auto/selftests/crashes/crashes.pro +++ b/tests/auto/selftests/crashes/crashes.pro @@ -7,3 +7,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = crashes diff --git a/tests/auto/selftests/datatable/datatable.pro b/tests/auto/selftests/datatable/datatable.pro index 69aed7a..98f04d6 100644 --- a/tests/auto/selftests/datatable/datatable.pro +++ b/tests/auto/selftests/datatable/datatable.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = datatable diff --git a/tests/auto/selftests/datetime/datetime.pro b/tests/auto/selftests/datetime/datetime.pro index 489e5cb..b015661 100644 --- a/tests/auto/selftests/datetime/datetime.pro +++ b/tests/auto/selftests/datetime/datetime.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = datetime diff --git a/tests/auto/selftests/differentexec/differentexec.pro b/tests/auto/selftests/differentexec/differentexec.pro index e789649..c11b0d3 100644 --- a/tests/auto/selftests/differentexec/differentexec.pro +++ b/tests/auto/selftests/differentexec/differentexec.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = differentexec diff --git a/tests/auto/selftests/exception/exception.pro b/tests/auto/selftests/exception/exception.pro index 14d8c7f..65705c6 100644 --- a/tests/auto/selftests/exception/exception.pro +++ b/tests/auto/selftests/exception/exception.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = exception diff --git a/tests/auto/selftests/expectfail/expectfail.pro b/tests/auto/selftests/expectfail/expectfail.pro index c411199..97a3560 100644 --- a/tests/auto/selftests/expectfail/expectfail.pro +++ b/tests/auto/selftests/expectfail/expectfail.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = expectfail diff --git a/tests/auto/selftests/failinit/failinit.pro b/tests/auto/selftests/failinit/failinit.pro index 729cf74..e3d54c8 100644 --- a/tests/auto/selftests/failinit/failinit.pro +++ b/tests/auto/selftests/failinit/failinit.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = failinit diff --git a/tests/auto/selftests/failinitdata/failinitdata.pro b/tests/auto/selftests/failinitdata/failinitdata.pro index 6b48af1..1ff96f7 100644 --- a/tests/auto/selftests/failinitdata/failinitdata.pro +++ b/tests/auto/selftests/failinitdata/failinitdata.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = failinitdata diff --git a/tests/auto/selftests/fetchbogus/fetchbogus.pro b/tests/auto/selftests/fetchbogus/fetchbogus.pro index badb636..3a5d13b 100644 --- a/tests/auto/selftests/fetchbogus/fetchbogus.pro +++ b/tests/auto/selftests/fetchbogus/fetchbogus.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = fetchbogus diff --git a/tests/auto/selftests/globaldata/globaldata.pro b/tests/auto/selftests/globaldata/globaldata.pro index eb3b454..1bdcf07 100644 --- a/tests/auto/selftests/globaldata/globaldata.pro +++ b/tests/auto/selftests/globaldata/globaldata.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = globaldata diff --git a/tests/auto/selftests/maxwarnings/maxwarnings.pro b/tests/auto/selftests/maxwarnings/maxwarnings.pro index b43affe..393a964 100644 --- a/tests/auto/selftests/maxwarnings/maxwarnings.pro +++ b/tests/auto/selftests/maxwarnings/maxwarnings.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = maxwarnings diff --git a/tests/auto/selftests/multiexec/multiexec.pro b/tests/auto/selftests/multiexec/multiexec.pro index 723f56f..639b9b8 100644 --- a/tests/auto/selftests/multiexec/multiexec.pro +++ b/tests/auto/selftests/multiexec/multiexec.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = multiexec diff --git a/tests/auto/selftests/qexecstringlist/qexecstringlist.pro b/tests/auto/selftests/qexecstringlist/qexecstringlist.pro index 27afcb2..73bdaca 100644 --- a/tests/auto/selftests/qexecstringlist/qexecstringlist.pro +++ b/tests/auto/selftests/qexecstringlist/qexecstringlist.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = qexecstringlist diff --git a/tests/auto/selftests/singleskip/singleskip.pro b/tests/auto/selftests/singleskip/singleskip.pro index 0d66f68..9762c97 100644 --- a/tests/auto/selftests/singleskip/singleskip.pro +++ b/tests/auto/selftests/singleskip/singleskip.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = singleskip diff --git a/tests/auto/selftests/skip/skip.pro b/tests/auto/selftests/skip/skip.pro index 545a579..989fdeb 100644 --- a/tests/auto/selftests/skip/skip.pro +++ b/tests/auto/selftests/skip/skip.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = skip diff --git a/tests/auto/selftests/skipglobal/skipglobal.pro b/tests/auto/selftests/skipglobal/skipglobal.pro index 97553c6..0205a88 100644 --- a/tests/auto/selftests/skipglobal/skipglobal.pro +++ b/tests/auto/selftests/skipglobal/skipglobal.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = skipglobal diff --git a/tests/auto/selftests/skipinit/skipinit.pro b/tests/auto/selftests/skipinit/skipinit.pro index d8ee13e..6912183 100644 --- a/tests/auto/selftests/skipinit/skipinit.pro +++ b/tests/auto/selftests/skipinit/skipinit.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = skipinit diff --git a/tests/auto/selftests/skipinitdata/skipinitdata.pro b/tests/auto/selftests/skipinitdata/skipinitdata.pro index 8da653e..206ed11 100644 --- a/tests/auto/selftests/skipinitdata/skipinitdata.pro +++ b/tests/auto/selftests/skipinitdata/skipinitdata.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = skipinitdata diff --git a/tests/auto/selftests/sleep/sleep.pro b/tests/auto/selftests/sleep/sleep.pro index 7b28ccc..0bd3225 100644 --- a/tests/auto/selftests/sleep/sleep.pro +++ b/tests/auto/selftests/sleep/sleep.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = sleep diff --git a/tests/auto/selftests/strcmp/strcmp.pro b/tests/auto/selftests/strcmp/strcmp.pro index 489211c..3121c25 100644 --- a/tests/auto/selftests/strcmp/strcmp.pro +++ b/tests/auto/selftests/strcmp/strcmp.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = strcmp diff --git a/tests/auto/selftests/subtest/subtest.pro b/tests/auto/selftests/subtest/subtest.pro index 4d258ee..fe3cafa 100644 --- a/tests/auto/selftests/subtest/subtest.pro +++ b/tests/auto/selftests/subtest/subtest.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = subtest diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 4243612..103fd79 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -195,7 +195,7 @@ void tst_Selftests::runSubTest() QProcess proc; proc.setEnvironment(QStringList("")); - proc.start(subdir + "/tst_" + subdir, arguments); + proc.start(subdir + "/" + subdir, arguments); QVERIFY(proc.waitForFinished()); const QByteArray out(proc.readAllStandardOutput()); @@ -309,7 +309,7 @@ void tst_Selftests::checkXML() const QProcess proc; proc.setEnvironment(QStringList("")); - proc.start(subdir + "/tst_" + subdir, arguments); + proc.start(subdir + "/" + subdir, arguments); QVERIFY(proc.waitForFinished()); QByteArray out(proc.readAllStandardOutput()); diff --git a/tests/auto/selftests/updateBaselines.sh b/tests/auto/selftests/updateBaselines.sh deleted file mode 100755 index a0f22e6..0000000 --- a/tests/auto/selftests/updateBaselines.sh +++ /dev/null @@ -1,34 +0,0 @@ -# Be *really* sure that your fix is right, before running this script. - -tests=" \ - cmptest \ - cmptest \ - cmptest \ - datatable \ - datetime \ - expectfail \ - expectfail \ - globaldata \ - globaldata \ - maxwarnings \ - multiexec \ - singleskip \ - qexecstringlist \ - differentexec \ - skip \ - skip \ - skipglobal \ - sleep \ - strcmp \ - subtest \ - warnings" - -for test in $tests; do - echo "Updating $test" - cd $test - baseline="../expected_"$test".txt" - p4 edit $baseline - ./tst_$test > ../expected_"$test".txt - p4 revert -a $baseline - cd .. -done diff --git a/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro b/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro index 8cdf7cc..cf3098d 100644 --- a/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro +++ b/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = waitwithoutgui diff --git a/tests/auto/selftests/warnings/warnings.pro b/tests/auto/selftests/warnings/warnings.pro index 9ae22d3..eaf06b4 100644 --- a/tests/auto/selftests/warnings/warnings.pro +++ b/tests/auto/selftests/warnings/warnings.pro @@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle CONFIG -= debug_and_release_target +TARGET = warnings diff --git a/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro b/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro new file mode 100644 index 0000000..f1ec54e --- /dev/null +++ b/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qgraphicswidget +TEMPLATE = app +# Input +SOURCES += tst_qgraphicswidget.cpp diff --git a/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp new file mode 100644 index 0000000..97837e2 --- /dev/null +++ b/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +****************************************************************************/ + +#include <qtest.h> +#include <QGraphicsItem> +#include <QGraphicsScene> +#include <QGraphicsView> +#include <QGraphicsWidget> +//TESTED_FILES= + +class tst_QGraphicsWidget : public QObject +{ + Q_OBJECT + +public: + tst_QGraphicsWidget(); + virtual ~tst_QGraphicsWidget(); + +public slots: + void init(); + void cleanup(); + +private slots: + void move(); +}; + +tst_QGraphicsWidget::tst_QGraphicsWidget() +{ +} + +tst_QGraphicsWidget::~tst_QGraphicsWidget() +{ +} + +void tst_QGraphicsWidget::init() +{ +} + +void tst_QGraphicsWidget::cleanup() +{ +} + +void tst_QGraphicsWidget::move() +{ + QGraphicsScene scene; + QGraphicsWidget *widget = new QGraphicsWidget(); + scene.addItem(widget); + QGraphicsView view(&scene); + view.show(); + QBENCHMARK { + widget->setPos(qrand(),qrand()); + } +} + +QTEST_MAIN(tst_QGraphicsWidget) +#include "tst_qgraphicswidget.moc" diff --git a/tests/benchmarks/qimagereader/tst_qimagereader.cpp b/tests/benchmarks/qimagereader/tst_qimagereader.cpp index ae7ecb2..1b5acb4 100644 --- a/tests/benchmarks/qimagereader/tst_qimagereader.cpp +++ b/tests/benchmarks/qimagereader/tst_qimagereader.cpp @@ -102,9 +102,7 @@ tst_QImageReader::tst_QImageReader() images << QPair<QString, QByteArray>(QLatin1String("4bpp-rle.bmp"), QByteArray("bmp")); images << QPair<QString, QByteArray>(QLatin1String("tst7.bmp"), QByteArray("bmp")); images << QPair<QString, QByteArray>(QLatin1String("16bpp.bmp"), QByteArray("bmp")); -#if QT_VERSION >= 0x040200 images << QPair<QString, QByteArray>(QLatin1String("negativeheight.bmp"), QByteArray("bmp")); -#endif images << QPair<QString, QByteArray>(QLatin1String("marble.xpm"), QByteArray("xpm")); images << QPair<QString, QByteArray>(QLatin1String("kollada.png"), QByteArray("png")); images << QPair<QString, QByteArray>(QLatin1String("teapot.ppm"), QByteArray("ppm")); diff --git a/tests/benchmarks/qobject/main.cpp b/tests/benchmarks/qobject/main.cpp index cd8b142..65833b8 100644 --- a/tests/benchmarks/qobject/main.cpp +++ b/tests/benchmarks/qobject/main.cpp @@ -42,12 +42,7 @@ #include <QtGui> #include <qtest.h> #include "object.h" - -#if QT_VERSION >= 0x040000 -# include <qcoreapplication.h> -#else -# include <qapplication.h> -#endif +#include <qcoreapplication.h> #include <qdatetime.h> enum { @@ -58,7 +53,7 @@ enum { class QObjectBenchmark : public QObject { Q_OBJECT -private slots: +private slots: void signal_slot_benchmark(); void signal_slot_benchmark_data(); void qproperty_benchmark_data(); @@ -82,13 +77,8 @@ void QObjectBenchmark::signal_slot_benchmark() Object singleObject; Object multiObject; -#if QT_VERSION >= 0x040000 singleObject.setObjectName("single"); multiObject.setObjectName("multi"); -#else - singleObject.setName("single"); - multiObject.setName("double"); -#endif singleObject.connect(&singleObject, SIGNAL(signal0()), SLOT(slot0())); diff --git a/tests/benchmarks/qpainter/tst_qpainter.cpp b/tests/benchmarks/qpainter/tst_qpainter.cpp index af2c412..60c099b 100644 --- a/tests/benchmarks/qpainter/tst_qpainter.cpp +++ b/tests/benchmarks/qpainter/tst_qpainter.cpp @@ -700,11 +700,7 @@ void tst_QPainter::compositionModes_data() QTest::addColumn<QSize>("size"); QTest::addColumn<QColor>("color"); -#if QT_VERSION >= 0x040500 const int n = QPainter::RasterOp_SourceAndNotDestination; -#else - const int n = QPainter::CompositionMode_Exclusion; -#endif for (int i = 0; i <= n; ++i) { QString title("%1:%2"); QTest::newRow(qPrintable(title.arg(i).arg("10x10:opaque"))) @@ -732,9 +728,7 @@ void tst_QPainter::compositionModes() src.fill(color); QPixmap dest(size); -#if QT_VERSION >= 0x040500 if (mode < QPainter::RasterOp_SourceOrDestination) -#endif color.setAlpha(127); // porter-duff needs an alpha channel dest.fill(color); diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp index 82a3a17..a1ba001 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp @@ -83,9 +83,8 @@ void QHelpSearchIndexReader::cancelSearching() mutex.unlock(); } -void QHelpSearchIndexReader::search(const QString &collectionFile, - const QString &indexFilesFolder, - const QList<QHelpSearchQuery> &queryList) +void QHelpSearchIndexReader::search(const QString &collectionFile, const QString &indexFilesFolder, + const QList<QHelpSearchQuery> &queryList) { QMutexLocker lock(&mutex); @@ -147,17 +146,16 @@ void QHelpSearchIndexReader::run() try { #endif QCLuceneBooleanQuery booleanQuery; - if (!buildQuery(booleanQuery, queryList)) { + QCLuceneStandardAnalyzer analyzer; + if (!buildQuery(booleanQuery, queryList, analyzer)) { emit searchingFinished(0); return; } const QStringList attribList = engine.filterAttributes(engine.currentFilter()); if (!attribList.isEmpty()) { - QCLuceneStandardAnalyzer analyzer; QCLuceneQuery* query = QCLuceneQueryParser::parse(QLatin1String("+") - + attribList.join(QLatin1String(" +")), QLatin1String("attribute"), - analyzer); + + attribList.join(QLatin1String(" +")), QLatin1String("attribute"), analyzer); if (!query) { emit searchingFinished(0); @@ -168,10 +166,26 @@ void QHelpSearchIndexReader::run() QCLuceneIndexSearcher indexSearcher(indexPath); QCLuceneHits hits = indexSearcher.search(booleanQuery); - const QStringList namespaceList = engine.registeredDocumentations(); + + bool boost = true; + QCLuceneBooleanQuery tryHarderQuery; + if (hits.length() == 0) { + if (buildTryHarderQuery(tryHarderQuery, queryList, analyzer)) { + if (!attribList.isEmpty()) { + QCLuceneQuery* query = QCLuceneQueryParser::parse(QLatin1String("+") + + attribList.join(QLatin1String(" +")), QLatin1String("attribute"), + analyzer); + tryHarderQuery.add(query, true, true, false); + } + hits = indexSearcher.search(tryHarderQuery); + boost = (hits.length() == 0); + } + } QSet<QString> pathSet; QCLuceneDocument document; + const QStringList namespaceList = engine.registeredDocumentations(); + for (qint32 i = 0; i < hits.length(); i++) { document = hits.document(i); const QString path = document.get(QLatin1String("path")); @@ -192,8 +206,8 @@ void QHelpSearchIndexReader::run() } indexSearcher.close(); - int count = hitList.count(); - if (count > 0) + const int count = hitList.count(); + if ((count > 0) && boost) boostSearchHits(engine, hitList, queryList); emit searchingFinished(hitList.count()); @@ -206,11 +220,9 @@ void QHelpSearchIndexReader::run() } } -bool QHelpSearchIndexReader::defaultQuery(const QString &term, - QCLuceneBooleanQuery &booleanQuery) +bool QHelpSearchIndexReader::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery, + QCLuceneStandardAnalyzer &analyzer) { - QCLuceneStandardAnalyzer analyzer; - const QLatin1String c("content"); const QLatin1String t("titleTokenized"); @@ -226,21 +238,23 @@ bool QHelpSearchIndexReader::defaultQuery(const QString &term, } bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery, - const QList<QHelpSearchQuery> &queryList) + const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer) { foreach (const QHelpSearchQuery query, queryList) { switch (query.fieldName) { case QHelpSearchQuery::FUZZY: { const QLatin1String fuzzy("~"); - foreach (const QString term, query.wordList) { - if (term.isEmpty() || !defaultQuery(term.toLower() + fuzzy, booleanQuery)) + foreach (const QString &term, query.wordList) { + if (term.isEmpty() + || !defaultQuery(term.toLower() + fuzzy, booleanQuery, analyzer)) { return false; + } } } break; case QHelpSearchQuery::WITHOUT: { QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords(); - foreach (const QString term, query.wordList) { + foreach (const QString &term, query.wordList) { if (stopWords.contains(term, Qt::CaseInsensitive)) continue; @@ -259,14 +273,14 @@ bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery, } break; case QHelpSearchQuery::PHRASE: { - const QString term = query.wordList.at(0).toLower(); + const QString &term = query.wordList.at(0).toLower(); if (term.contains(QLatin1Char(' '))) { QStringList termList = term.split(QLatin1String(" ")); QCLucenePhraseQuery *q = new QCLucenePhraseQuery(); QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords(); - foreach (const QString t, termList) { - if (!stopWords.contains(t, Qt::CaseInsensitive)) - q->addTerm(QCLuceneTerm(QLatin1String("content"), t.toLower())); + foreach (const QString &term, termList) { + if (!stopWords.contains(term, Qt::CaseInsensitive)) + q->addTerm(QCLuceneTerm(QLatin1String("content"), term.toLower())); } booleanQuery.add(q, true, true, false); } else { @@ -286,7 +300,7 @@ bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery, case QHelpSearchQuery::ALL: { QStringList stopWords = QCLuceneStopAnalyzer().englishStopWords(); - foreach (const QString term, query.wordList) { + foreach (const QString &term, query.wordList) { if (stopWords.contains(term, Qt::CaseInsensitive)) continue; @@ -302,9 +316,8 @@ bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery, } break; case QHelpSearchQuery::DEFAULT: { - QCLuceneStandardAnalyzer analyzer; - foreach (const QString t, query.wordList) { - QCLuceneQuery *query = QCLuceneQueryParser::parse(t.toLower(), + foreach (const QString &term, query.wordList) { + QCLuceneQuery *query = QCLuceneQueryParser::parse(term.toLower(), QLatin1String("content"), analyzer); if (query) @@ -313,8 +326,8 @@ bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery, } break; case QHelpSearchQuery::ATLEAST: { - foreach (const QString term, query.wordList) { - if (term.isEmpty() || !defaultQuery(term.toLower(), booleanQuery)) + foreach (const QString &term, query.wordList) { + if (term.isEmpty() || !defaultQuery(term.toLower(), booleanQuery, analyzer)) return false; } } @@ -324,16 +337,38 @@ bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery, return true; } +bool QHelpSearchIndexReader::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery, + const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer) +{ + bool retVal = false; + foreach (const QHelpSearchQuery query, queryList) { + switch (query.fieldName) { + default: break; + case QHelpSearchQuery::DEFAULT: { + foreach (const QString &term, query.wordList) { + QCLuceneQuery *query = QCLuceneQueryParser::parse(term.toLower(), + QLatin1String("content"), analyzer); + + if (query) { + retVal = true; + booleanQuery.add(query, true, false, false); + } + } + } break; + } + } + return retVal; +} + void QHelpSearchIndexReader::boostSearchHits(const QHelpEngineCore &engine, - QList<QHelpSearchEngine::SearchHit> &hitList, - const QList<QHelpSearchQuery> &queryList) + QList<QHelpSearchEngine::SearchHit> &hitList, const QList<QHelpSearchQuery> &queryList) { foreach (const QHelpSearchQuery query, queryList) { if (query.fieldName != QHelpSearchQuery::DEFAULT) continue; QString joinedQuery = query.wordList.join(QLatin1String(" ")); - + QCLuceneStandardAnalyzer analyzer; QCLuceneQuery *parsedQuery = QCLuceneQueryParser::parse( joinedQuery, QLatin1String("content"), analyzer); @@ -351,8 +386,7 @@ void QHelpSearchIndexReader::boostSearchHits(const QHelpEngineCore &engine, QStringList searchTerms; while (index != -1) { nextIndex = joinedQuery.indexOf(QLatin1String("content:"), index + 1); - term = joinedQuery.mid(index + length, nextIndex - (length + index)) - .simplified(); + term = joinedQuery.mid(index + length, nextIndex - (length + index)).simplified(); if (term.startsWith(QLatin1String("\"")) && term.endsWith(QLatin1String("\""))) { searchTerms.append(term.remove(QLatin1String("\""))); @@ -370,17 +404,19 @@ void QHelpSearchIndexReader::boostSearchHits(const QHelpEngineCore &engine, QString data = QString::fromUtf8(engine.fileData(hit.first)); int counter = 0; - foreach (const QString& term, searchTerms) + foreach (const QString &term, searchTerms) counter += data.count(term, Qt::CaseInsensitive); hitMap.insertMulti(counter, hit); } QList<QHelpSearchEngine::SearchHit> boostedList; - QMap<int, QHelpSearchEngine::SearchHit>::const_iterator i; - for (i = hitMap.constEnd(), --i; i != hitMap.constBegin(); --i) - boostedList.append(i.value()); - boostedList += hitList.mid(count - 1, hitList.count()); - + QMap<int, QHelpSearchEngine::SearchHit>::const_iterator it = hitMap.constEnd(); + do { + --it; + boostedList.append(it.value()); + } while (it != hitMap.constBegin()); + boostedList += hitList.mid(count, hitList.count()); + hitList = boostedList; } } diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h index 892c4e6..f7536e9 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h +++ b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h @@ -54,6 +54,8 @@ // #include "qhelpsearchengine.h" + +#include "fulltextsearch/qanalyzer_p.h" #include "fulltextsearch/qquery_p.h" #include <QtCore/QList> @@ -93,12 +95,13 @@ signals: private: void run(); - bool defaultQuery(const QString &term, - QCLuceneBooleanQuery &booleanQuery); - bool buildQuery(QCLuceneBooleanQuery &booleanQuery, - const QList<QHelpSearchQuery> &queryList); - void boostSearchHits(const QHelpEngineCore &engine, - QList<QHelpSearchEngine::SearchHit> &hitList, + bool defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery, + QCLuceneStandardAnalyzer &analyzer); + bool buildQuery(QCLuceneBooleanQuery &booleanQuery, const QList<QHelpSearchQuery> &queryList, + QCLuceneStandardAnalyzer &analyzer); + bool buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery, + const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer); + void boostSearchHits(const QHelpEngineCore &engine, QList<QHelpSearchEngine::SearchHit> &hitList, const QList<QHelpSearchQuery> &queryList); private: diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp index e53bbae..195c490 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp @@ -59,16 +59,340 @@ #include <QtNetwork/QLocalSocket> #include <QtNetwork/QLocalServer> +#include "private/qfunctions_p.h" + QT_BEGIN_NAMESPACE namespace qt { namespace fulltextsearch { namespace clucene { +// taken from qtexthtmlparser +static const struct QTextHtmlEntity +{ + const char *name; + quint16 code; +} entities[] = { + { "AElig", 0x00c6 }, + { "AMP", 38 }, + { "Aacute", 0x00c1 }, + { "Acirc", 0x00c2 }, + { "Agrave", 0x00c0 }, + { "Alpha", 0x0391 }, + { "Aring", 0x00c5 }, + { "Atilde", 0x00c3 }, + { "Auml", 0x00c4 }, + { "Beta", 0x0392 }, + { "Ccedil", 0x00c7 }, + { "Chi", 0x03a7 }, + { "Dagger", 0x2021 }, + { "Delta", 0x0394 }, + { "ETH", 0x00d0 }, + { "Eacute", 0x00c9 }, + { "Ecirc", 0x00ca }, + { "Egrave", 0x00c8 }, + { "Epsilon", 0x0395 }, + { "Eta", 0x0397 }, + { "Euml", 0x00cb }, + { "GT", 62 }, + { "Gamma", 0x0393 }, + { "Iacute", 0x00cd }, + { "Icirc", 0x00ce }, + { "Igrave", 0x00cc }, + { "Iota", 0x0399 }, + { "Iuml", 0x00cf }, + { "Kappa", 0x039a }, + { "LT", 60 }, + { "Lambda", 0x039b }, + { "Mu", 0x039c }, + { "Ntilde", 0x00d1 }, + { "Nu", 0x039d }, + { "OElig", 0x0152 }, + { "Oacute", 0x00d3 }, + { "Ocirc", 0x00d4 }, + { "Ograve", 0x00d2 }, + { "Omega", 0x03a9 }, + { "Omicron", 0x039f }, + { "Oslash", 0x00d8 }, + { "Otilde", 0x00d5 }, + { "Ouml", 0x00d6 }, + { "Phi", 0x03a6 }, + { "Pi", 0x03a0 }, + { "Prime", 0x2033 }, + { "Psi", 0x03a8 }, + { "QUOT", 34 }, + { "Rho", 0x03a1 }, + { "Scaron", 0x0160 }, + { "Sigma", 0x03a3 }, + { "THORN", 0x00de }, + { "Tau", 0x03a4 }, + { "Theta", 0x0398 }, + { "Uacute", 0x00da }, + { "Ucirc", 0x00db }, + { "Ugrave", 0x00d9 }, + { "Upsilon", 0x03a5 }, + { "Uuml", 0x00dc }, + { "Xi", 0x039e }, + { "Yacute", 0x00dd }, + { "Yuml", 0x0178 }, + { "Zeta", 0x0396 }, + { "aacute", 0x00e1 }, + { "acirc", 0x00e2 }, + { "acute", 0x00b4 }, + { "aelig", 0x00e6 }, + { "agrave", 0x00e0 }, + { "alefsym", 0x2135 }, + { "alpha", 0x03b1 }, + { "amp", 38 }, + { "and", 0x22a5 }, + { "ang", 0x2220 }, + { "apos", 0x0027 }, + { "aring", 0x00e5 }, + { "asymp", 0x2248 }, + { "atilde", 0x00e3 }, + { "auml", 0x00e4 }, + { "bdquo", 0x201e }, + { "beta", 0x03b2 }, + { "brvbar", 0x00a6 }, + { "bull", 0x2022 }, + { "cap", 0x2229 }, + { "ccedil", 0x00e7 }, + { "cedil", 0x00b8 }, + { "cent", 0x00a2 }, + { "chi", 0x03c7 }, + { "circ", 0x02c6 }, + { "clubs", 0x2663 }, + { "cong", 0x2245 }, + { "copy", 0x00a9 }, + { "crarr", 0x21b5 }, + { "cup", 0x222a }, + { "curren", 0x00a4 }, + { "dArr", 0x21d3 }, + { "dagger", 0x2020 }, + { "darr", 0x2193 }, + { "deg", 0x00b0 }, + { "delta", 0x03b4 }, + { "diams", 0x2666 }, + { "divide", 0x00f7 }, + { "eacute", 0x00e9 }, + { "ecirc", 0x00ea }, + { "egrave", 0x00e8 }, + { "empty", 0x2205 }, + { "emsp", 0x2003 }, + { "ensp", 0x2002 }, + { "epsilon", 0x03b5 }, + { "equiv", 0x2261 }, + { "eta", 0x03b7 }, + { "eth", 0x00f0 }, + { "euml", 0x00eb }, + { "euro", 0x20ac }, + { "exist", 0x2203 }, + { "fnof", 0x0192 }, + { "forall", 0x2200 }, + { "frac12", 0x00bd }, + { "frac14", 0x00bc }, + { "frac34", 0x00be }, + { "frasl", 0x2044 }, + { "gamma", 0x03b3 }, + { "ge", 0x2265 }, + { "gt", 62 }, + { "hArr", 0x21d4 }, + { "harr", 0x2194 }, + { "hearts", 0x2665 }, + { "hellip", 0x2026 }, + { "iacute", 0x00ed }, + { "icirc", 0x00ee }, + { "iexcl", 0x00a1 }, + { "igrave", 0x00ec }, + { "image", 0x2111 }, + { "infin", 0x221e }, + { "int", 0x222b }, + { "iota", 0x03b9 }, + { "iquest", 0x00bf }, + { "isin", 0x2208 }, + { "iuml", 0x00ef }, + { "kappa", 0x03ba }, + { "lArr", 0x21d0 }, + { "lambda", 0x03bb }, + { "lang", 0x2329 }, + { "laquo", 0x00ab }, + { "larr", 0x2190 }, + { "lceil", 0x2308 }, + { "ldquo", 0x201c }, + { "le", 0x2264 }, + { "lfloor", 0x230a }, + { "lowast", 0x2217 }, + { "loz", 0x25ca }, + { "lrm", 0x200e }, + { "lsaquo", 0x2039 }, + { "lsquo", 0x2018 }, + { "lt", 60 }, + { "macr", 0x00af }, + { "mdash", 0x2014 }, + { "micro", 0x00b5 }, + { "middot", 0x00b7 }, + { "minus", 0x2212 }, + { "mu", 0x03bc }, + { "nabla", 0x2207 }, + { "nbsp", 0x00a0 }, + { "ndash", 0x2013 }, + { "ne", 0x2260 }, + { "ni", 0x220b }, + { "not", 0x00ac }, + { "notin", 0x2209 }, + { "nsub", 0x2284 }, + { "ntilde", 0x00f1 }, + { "nu", 0x03bd }, + { "oacute", 0x00f3 }, + { "ocirc", 0x00f4 }, + { "oelig", 0x0153 }, + { "ograve", 0x00f2 }, + { "oline", 0x203e }, + { "omega", 0x03c9 }, + { "omicron", 0x03bf }, + { "oplus", 0x2295 }, + { "or", 0x22a6 }, + { "ordf", 0x00aa }, + { "ordm", 0x00ba }, + { "oslash", 0x00f8 }, + { "otilde", 0x00f5 }, + { "otimes", 0x2297 }, + { "ouml", 0x00f6 }, + { "para", 0x00b6 }, + { "part", 0x2202 }, + { "percnt", 0x0025 }, + { "permil", 0x2030 }, + { "perp", 0x22a5 }, + { "phi", 0x03c6 }, + { "pi", 0x03c0 }, + { "piv", 0x03d6 }, + { "plusmn", 0x00b1 }, + { "pound", 0x00a3 }, + { "prime", 0x2032 }, + { "prod", 0x220f }, + { "prop", 0x221d }, + { "psi", 0x03c8 }, + { "quot", 34 }, + { "rArr", 0x21d2 }, + { "radic", 0x221a }, + { "rang", 0x232a }, + { "raquo", 0x00bb }, + { "rarr", 0x2192 }, + { "rceil", 0x2309 }, + { "rdquo", 0x201d }, + { "real", 0x211c }, + { "reg", 0x00ae }, + { "rfloor", 0x230b }, + { "rho", 0x03c1 }, + { "rlm", 0x200f }, + { "rsaquo", 0x203a }, + { "rsquo", 0x2019 }, + { "sbquo", 0x201a }, + { "scaron", 0x0161 }, + { "sdot", 0x22c5 }, + { "sect", 0x00a7 }, + { "shy", 0x00ad }, + { "sigma", 0x03c3 }, + { "sigmaf", 0x03c2 }, + { "sim", 0x223c }, + { "spades", 0x2660 }, + { "sub", 0x2282 }, + { "sube", 0x2286 }, + { "sum", 0x2211 }, + { "sup", 0x2283 }, + { "sup1", 0x00b9 }, + { "sup2", 0x00b2 }, + { "sup3", 0x00b3 }, + { "supe", 0x2287 }, + { "szlig", 0x00df }, + { "tau", 0x03c4 }, + { "there4", 0x2234 }, + { "theta", 0x03b8 }, + { "thetasym", 0x03d1 }, + { "thinsp", 0x2009 }, + { "thorn", 0x00fe }, + { "tilde", 0x02dc }, + { "times", 0x00d7 }, + { "trade", 0x2122 }, + { "uArr", 0x21d1 }, + { "uacute", 0x00fa }, + { "uarr", 0x2191 }, + { "ucirc", 0x00fb }, + { "ugrave", 0x00f9 }, + { "uml", 0x00a8 }, + { "upsih", 0x03d2 }, + { "upsilon", 0x03c5 }, + { "uuml", 0x00fc }, + { "weierp", 0x2118 }, + { "xi", 0x03be }, + { "yacute", 0x00fd }, + { "yen", 0x00a5 }, + { "yuml", 0x00ff }, + { "zeta", 0x03b6 }, + { "zwj", 0x200d }, + { "zwnj", 0x200c } +}; + +Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &entityStr, const QTextHtmlEntity &entity) +{ + return entityStr < QLatin1String(entity.name); +} + +Q_STATIC_GLOBAL_OPERATOR bool operator<(const QTextHtmlEntity &entity, const QString &entityStr) +{ + return QLatin1String(entity.name) < entityStr; +} + +static QChar resolveEntity(const QString &entity) +{ + const QTextHtmlEntity *start = &entities[0]; + const QTextHtmlEntity *end = &entities[(sizeof(entities) / sizeof(entities[0]))]; + const QTextHtmlEntity *e = qBinaryFind(start, end, entity); + if (e == end) + return QChar(); + return e->code; +} + +static const uint latin1Extended[0xA0 - 0x80] = { + 0x20ac, // 0x80 + 0x0081, // 0x81 direct mapping + 0x201a, // 0x82 + 0x0192, // 0x83 + 0x201e, // 0x84 + 0x2026, // 0x85 + 0x2020, // 0x86 + 0x2021, // 0x87 + 0x02C6, // 0x88 + 0x2030, // 0x89 + 0x0160, // 0x8A + 0x2039, // 0x8B + 0x0152, // 0x8C + 0x008D, // 0x8D direct mapping + 0x017D, // 0x8E + 0x008F, // 0x8F directmapping + 0x0090, // 0x90 directmapping + 0x2018, // 0x91 + 0x2019, // 0x92 + 0x201C, // 0x93 + 0X201D, // 0x94 + 0x2022, // 0x95 + 0x2013, // 0x96 + 0x2014, // 0x97 + 0x02DC, // 0x98 + 0x2122, // 0x99 + 0x0161, // 0x9A + 0x203A, // 0x9B + 0x0153, // 0x9C + 0x009D, // 0x9D direct mapping + 0x017E, // 0x9E + 0x0178 // 0x9F +}; +// end taken from qtexthtmlparser + class DocumentHelper { public: - DocumentHelper(const QString& fileName, const QByteArray &data) + DocumentHelper(const QString &fileName, const QByteArray &data) : fileName(fileName) , data(readData(data)) {} ~DocumentHelper() {} @@ -131,8 +455,15 @@ private: while (j < length) { c = buf[j++]; if (c == QLatin1Char('<') || c == QLatin1Char('&')) { - if (count > 1) + if (count > 1 && c != QLatin1Char('&')) parsedContent.append(QLatin1Char(' ')); + else if (c == QLatin1Char('&')) { + // Note: this will modify the counter j, in case we sucessful parsed the entity + // we will have modified the counter to stay 1 before the closing ';', so + // the following if condition will be met with if (c == QLatin1Char(';')) + parsedContent.append(parseEntity(length, buf, j)); + } + count = 0; valid = false; continue; @@ -157,6 +488,63 @@ private: return parsedContent; } + // taken from qtexthtmlparser + // parses an entity after "&", and returns it + QString parseEntity(int len, const QChar *buf, int &pos) const + { + int recover = pos; + QString entity; + while (pos < len) { + QChar c = buf[pos++]; + if (c.isSpace() || pos - recover > 9) { + goto error; + } + if (c == QLatin1Char(';')) { + pos--; + break; + } + entity += c; + } + { + QChar resolved = resolveEntity(entity); + if (!resolved.isNull()) + return QString(resolved); + } + if (entity.length() > 1 && entity.at(0) == QLatin1Char('#')) { + entity.remove(0, 1); // removing leading # + + int base = 10; + bool ok = false; + + if (entity.at(0).toLower() == QLatin1Char('x')) { // hex entity? + entity.remove(0, 1); + base = 16; + } + + uint uc = entity.toUInt(&ok, base); + if (ok) { + if (uc >= 0x80 && uc < 0x80 + (sizeof(latin1Extended) / sizeof(latin1Extended[0]))) + uc = latin1Extended[uc - 0x80]; // windows latin 1 extended + QString str; + if (uc > 0xffff) { + // surrogate pair + uc -= 0x10000; + ushort high = uc/0x400 + 0xd800; + ushort low = uc%0x400 + 0xdc00; + str.append(QChar(high)); + str.append(QChar(low)); + } else { + str.append(QChar(uc)); + } + return str; + } + } + error: + pos = recover; + return QLatin1String(" "); + } + // end taken from qtexthtmlparser + private: QString fileName; QString data; @@ -239,7 +627,7 @@ void QHelpSearchIndexWriter::run() // old style qhc file < 4.4.2, need to convert... const QStringList indexedNamespaces = engine.customValue(oldKey). toString().split(QLatin1String("|"), QString::SkipEmptyParts); - foreach (const QString& nameSpace, indexedNamespaces) + foreach (const QString &nameSpace, indexedNamespaces) indexMap.insert(nameSpace, QDateTime()); engine.removeCustomValue(oldKey); } else { @@ -294,7 +682,7 @@ void QHelpSearchIndexWriter::run() } if (QCLuceneIndexReader::indexExists(indexPath) && !reindex) { - foreach(const QString& namespaceName, registeredDocs) { + foreach(const QString &namespaceName, registeredDocs) { mutexLocker.relock(); if (m_cancel) { emit indexingFinished(); @@ -342,7 +730,7 @@ void QHelpSearchIndexWriter::run() writer->setMaxFieldLength(QCLuceneIndexWriter::DEFAULT_MAX_FIELD_LENGTH); QStringList namespaces; - foreach(const QString& namespaceName, registeredDocs) { + foreach(const QString &namespaceName, registeredDocs) { mutexLocker.relock(); if (m_cancel) { writer->close(); @@ -367,7 +755,7 @@ void QHelpSearchIndexWriter::run() break; } else { bool bail = false; - foreach (const QStringList& attributes, attributeSets) { + foreach (const QStringList &attributes, attributeSets) { const QList<QUrl> docFiles = indexableFiles(&engine, namespaceName, attributes); if (!addDocuments(docFiles, engine, attributes, namespaceName, @@ -397,7 +785,7 @@ void QHelpSearchIndexWriter::run() mutexLocker.unlock(); QStringList indexedNamespaces = indexMap.keys(); - foreach(const QString& namespaceName, indexedNamespaces) { + foreach(const QString &namespaceName, indexedNamespaces) { mutexLocker.relock(); if (m_cancel) break; @@ -422,7 +810,7 @@ bool QHelpSearchIndexWriter::addDocuments(const QList<QUrl> docFiles, const QString attrList = attributes.join(QLatin1String(" ")); locker.unlock(); - foreach(const QUrl& url, docFiles) { + foreach(const QUrl &url, docFiles) { QCLuceneDocument document; DocumentHelper helper(url.toString(), engine.fileData(url)); if (helper.addFieldsToDocument(&document, namespaceName, attrList)) @@ -450,8 +838,8 @@ void QHelpSearchIndexWriter::removeDocuments(const QString &indexPath, reader.close(); } -bool QHelpSearchIndexWriter::writeIndexMap(QHelpEngineCore& engine, - const QMap<QString, QDateTime>& indexMap) +bool QHelpSearchIndexWriter::writeIndexMap(QHelpEngineCore &engine, + const QMap<QString, QDateTime> &indexMap) { QByteArray bArray; diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp index ef272e8..89060bd 100644 --- a/tools/assistant/tools/assistant/contentwindow.cpp +++ b/tools/assistant/tools/assistant/contentwindow.cpp @@ -118,19 +118,24 @@ void ContentWindow::keyPressEvent(QKeyEvent *e) bool ContentWindow::eventFilter(QObject *o, QEvent *e) { - if (m_contentWidget && o == m_contentWidget->viewport() && e->type() - == QEvent::MouseButtonRelease) { + if (m_contentWidget && o == m_contentWidget->viewport() + && e->type() == QEvent::MouseButtonRelease) { QMouseEvent *me = static_cast<QMouseEvent*>(e); - if (m_contentWidget->indexAt(me->pos()).isValid() - && me->button() == Qt::LeftButton) { - itemClicked(m_contentWidget->currentIndex()); - } else if (m_contentWidget->indexAt(me->pos()).isValid() - && me->button() == Qt::MidButton) { - QHelpContentModel *contentModel = - qobject_cast<QHelpContentModel*>(m_contentWidget->model()); - QHelpContentItem *itm = - contentModel->contentItemAt(m_contentWidget->currentIndex()); - CentralWidget::instance()->setSourceInNewTab(itm->url()); + QModelIndex index = m_contentWidget->indexAt(me->pos()); + QItemSelectionModel *sm = m_contentWidget->selectionModel(); + + if (index.isValid() && (sm && sm->isSelected(index))) { + if (me->button() == Qt::LeftButton) { + itemClicked(index); + } else if (me->button() == Qt::MidButton) { + QHelpContentModel *contentModel = + qobject_cast<QHelpContentModel*>(m_contentWidget->model()); + if (contentModel) { + QHelpContentItem *itm = contentModel->contentItemAt(index); + if (itm && !isPdfFile(itm)) + CentralWidget::instance()->setSourceInNewTab(itm->url()); + } + } } } return QWidget::eventFilter(o, e); @@ -141,16 +146,19 @@ void ContentWindow::showContextMenu(const QPoint &pos) if (!m_contentWidget->indexAt(pos).isValid()) return; - QMenu menu; - QAction *curTab = menu.addAction(tr("Open Link")); - QAction *newTab = menu.addAction(tr("Open Link in New Tab")); - menu.move(m_contentWidget->mapToGlobal(pos)); - QHelpContentModel *contentModel = qobject_cast<QHelpContentModel*>(m_contentWidget->model()); QHelpContentItem *itm = contentModel->contentItemAt(m_contentWidget->currentIndex()); + QMenu menu; + QAction *curTab = menu.addAction(tr("Open Link")); + QAction *newTab = menu.addAction(tr("Open Link in New Tab")); + if (isPdfFile(itm)) + newTab->setEnabled(false); + + menu.move(m_contentWidget->mapToGlobal(pos)); + QAction *action = menu.exec(); if (curTab == action) emit linkActivated(itm->url()); @@ -160,14 +168,20 @@ void ContentWindow::showContextMenu(const QPoint &pos) void ContentWindow::itemClicked(const QModelIndex &index) { - if (!index.isValid()) - return; QHelpContentModel *contentModel = qobject_cast<QHelpContentModel*>(m_contentWidget->model()); - QHelpContentItem *itm = - contentModel->contentItemAt(index); - if (itm) - emit linkActivated(itm->url()); + + if (contentModel) { + QHelpContentItem *itm = contentModel->contentItemAt(index); + if (itm) + emit linkActivated(itm->url()); + } +} + +bool ContentWindow::isPdfFile(QHelpContentItem *item) const +{ + const QString &path = item->url().path(); + return path.endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive); } QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/contentwindow.h b/tools/assistant/tools/assistant/contentwindow.h index ab8f8dd..ddc3e7c 100644 --- a/tools/assistant/tools/assistant/contentwindow.h +++ b/tools/assistant/tools/assistant/contentwindow.h @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE class QHelpEngine; +class QHelpContentItem; class QHelpContentWidget; class ContentWindow : public QWidget @@ -75,6 +76,7 @@ private: void focusInEvent(QFocusEvent *e); void keyPressEvent(QKeyEvent *e); bool eventFilter(QObject *o, QEvent *e); + bool isPdfFile(QHelpContentItem *item) const; QHelpEngine *m_helpEngine; QHelpContentWidget *m_contentWidget; diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index 50f18c0..0d2271d 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -10,8 +10,8 @@ description = "Qt Assistant" HTML.{postheader,address} = "" HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \ "<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \ - "<td width=\"30%\" align=\"left\">Copyright © 2008 Nokia Corporation " \ + "<td width=\"30%\" align=\"left\">Copyright © 2009 Nokia Corporation " \ "and/or its subsidiary(-ies)</td>\n" \ "<td width=\"40%\" align=\"center\">Trademarks</td>\n" \ - "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.5.0</div></td>\n" \ + "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.5.1</div></td>\n" \ "</tr></table></div></address>" diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index 9817f23..f7225fa 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -164,6 +164,7 @@ public: protected: virtual QWebPage *createWindow(QWebPage::WebWindowType); + virtual void triggerAction(WebAction action, bool checked = false); virtual bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type); @@ -171,16 +172,30 @@ protected: private: CentralWidget *centralWidget; QHelpEngine *helpEngine; + bool closeNewTabIfNeeded; + + friend class HelpViewer; + Qt::MouseButtons m_pressedButtons; + Qt::KeyboardModifiers m_keyboardModifiers; }; HelpPage::HelpPage(CentralWidget *central, QHelpEngine *engine, QObject *parent) - : QWebPage(parent), centralWidget(central), helpEngine(engine) + : QWebPage(parent) + , centralWidget(central) + , helpEngine(engine) + , closeNewTabIfNeeded(false) + , m_pressedButtons(Qt::NoButton) + , m_keyboardModifiers(Qt::NoModifier) { } QWebPage *HelpPage::createWindow(QWebPage::WebWindowType) { - return centralWidget->newEmptyTab()->page(); + HelpPage* newPage = static_cast<HelpPage*>(centralWidget->newEmptyTab()->page()); + if (newPage) + newPage->closeNewTabIfNeeded = closeNewTabIfNeeded; + closeNewTabIfNeeded = false; + return newPage; } static bool isLocalUrl(const QUrl &url) @@ -196,15 +211,33 @@ static bool isLocalUrl(const QUrl &url) return false; } +void HelpPage::triggerAction(WebAction action, bool checked) +{ + switch (action) { + case OpenLinkInNewWindow: + closeNewTabIfNeeded = true; + default: // fall through + QWebPage::triggerAction(action, checked); + break; + } +} + bool HelpPage::acceptNavigationRequest(QWebFrame *, - const QNetworkRequest &request, QWebPage::NavigationType) + const QNetworkRequest &request, QWebPage::NavigationType type) { const QUrl &url = request.url(); + const bool closeNewTab = closeNewTabIfNeeded; + closeNewTabIfNeeded = false; + if (isLocalUrl(url)) { - if (url.path().endsWith(QLatin1String("pdf"))) { - QString fileName = url.toString(); - fileName = QDir::tempPath() + QDir::separator() + fileName.right - (fileName.length() - fileName.lastIndexOf(QChar('/'))); + const QString& path = url.path(); + if (path.endsWith(QLatin1String(".pdf"))) { + const int lastDash = path.lastIndexOf(QChar('/')); + QString fileName = QDir::tempPath() + QDir::separator(); + if (lastDash < 0) + fileName += path; + else + fileName += path.mid(lastDash + 1, path.length()); QFile tmpFile(QDir::cleanPath(fileName)); if (tmpFile.open(QIODevice::ReadWrite)) { @@ -212,8 +245,22 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *, tmpFile.close(); } QDesktopServices::openUrl(QUrl(tmpFile.fileName())); + + if (closeNewTab) + QMetaObject::invokeMethod(CentralWidget::instance(), "closeTab"); return false; } + + if (type == QWebPage::NavigationTypeLinkClicked + && (m_keyboardModifiers & Qt::ControlModifier + || m_pressedButtons == Qt::MidButton)) { + HelpViewer* viewer = centralWidget->newEmptyTab(); + if (viewer) + CentralWidget::instance()->setSource(url); + m_pressedButtons = Qt::NoButton; + m_keyboardModifiers = Qt::NoModifier; + return false; + } return true; } @@ -328,6 +375,16 @@ void HelpViewer::actionChanged() emit forwardAvailable(a->isEnabled()); } +void HelpViewer::mousePressEvent(QMouseEvent *event) +{ + HelpPage *currentPage = static_cast<HelpPage*>(page()); + if (currentPage) { + currentPage->m_pressedButtons = event->buttons(); + currentPage->m_keyboardModifiers = event->modifiers(); + } + QWebView::mousePressEvent(event); +} + #else // !defined(QT_NO_WEBKIT) HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) @@ -396,15 +453,19 @@ void HelpViewer::zoomOut(int range) bool HelpViewer::launchedWithExternalApp(const QUrl &url) { - bool isPdf = url.path().endsWith(QLatin1String("pdf")); + bool isPdf = url.path().endsWith(QLatin1String(".pdf")); if (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("ftp") || url.scheme() == QLatin1String("mailto") || isPdf) { bool launched = false; if (isPdf && url.scheme() == QLatin1String("qthelp")) { - QString fileName = url.toString(); - fileName = QDir::tempPath() + QDir::separator() + fileName.right - (fileName.length() - fileName.lastIndexOf(QLatin1Char('/'))); + const QString& path = url.path(); + const int lastDash = path.lastIndexOf(QChar('/')); + QString fileName = QDir::tempPath() + QDir::separator(); + if (lastDash < 0) + fileName += path; + else + fileName += path.mid(lastDash + 1, path.length()); QFile tmpFile(QDir::cleanPath(fileName)); if (tmpFile.open(QIODevice::ReadWrite)) { diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index af5c197..eea7340 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -107,6 +107,7 @@ Q_SIGNALS: protected: virtual void wheelEvent(QWheelEvent *); void mouseReleaseEvent(QMouseEvent *e); + void mousePressEvent(QMouseEvent *event); private Q_SLOTS: void actionChanged(); diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp index e7575fa..0beb5ee 100644 --- a/tools/assistant/tools/assistant/indexwindow.cpp +++ b/tools/assistant/tools/assistant/indexwindow.cpp @@ -122,10 +122,9 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) m_indexWidget->setCurrentIndex(idx); break; case Qt::Key_Escape: - emit escapePressed(); + emit escapePressed(); break; - default: - ; + default: ; // stop complaining } } else if (obj == m_indexWidget && e->type() == QEvent::ContextMenu) { QContextMenuEvent *ctxtEvent = static_cast<QContextMenuEvent*>(e); @@ -140,44 +139,15 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) if (curTab == action) m_indexWidget->activateCurrentItem(); else if (newTab == action) { - QHelpIndexModel *model = - qobject_cast<QHelpIndexModel*>(m_indexWidget->model()); - QString keyword = model->data(idx, Qt::DisplayRole).toString(); - if (model) { - QMap<QString, QUrl> links = model->linksForKeyword(keyword); - if (links.count() == 1) { - CentralWidget::instance()-> - setSourceInNewTab(links.constBegin().value()); - } else { - TopicChooser tc(this, keyword, links); - if (tc.exec() == QDialog::Accepted) { - CentralWidget::instance()->setSourceInNewTab(tc.link()); - } - } - } + open(m_indexWidget, idx); } } } else if (m_indexWidget && obj == m_indexWidget->viewport() && e->type() == QEvent::MouseButtonRelease) { QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e); QModelIndex idx = m_indexWidget->indexAt(mouseEvent->pos()); - if (idx.isValid() && mouseEvent->button()==Qt::MidButton) { - QHelpIndexModel *model = - qobject_cast<QHelpIndexModel*>(m_indexWidget->model()); - QString keyword = model->data(idx, Qt::DisplayRole).toString(); - if (model) { - QMap<QString, QUrl> links = model->linksForKeyword(keyword); - if (links.count() > 1) { - TopicChooser tc(this, keyword, links); - if (tc.exec() == QDialog::Accepted) { - CentralWidget::instance()->setSourceInNewTab(tc.link()); - } - } else if (links.count() == 1) { - CentralWidget::instance()-> - setSourceInNewTab(links.constBegin().value()); - } - } - } + if (idx.isValid() && mouseEvent->button()==Qt::MidButton) + open(m_indexWidget, idx); } #ifdef Q_OS_MAC else if (obj == m_indexWidget && e->type() == QEvent::KeyPress) { @@ -213,4 +183,27 @@ void IndexWindow::focusInEvent(QFocusEvent *e) } } +void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index) +{ + QHelpIndexModel *model = qobject_cast<QHelpIndexModel*>(indexWidget->model()); + if (model) { + QString keyword = model->data(index, Qt::DisplayRole).toString(); + QMap<QString, QUrl> links = model->linksForKeyword(keyword); + + QUrl url; + if (links.count() > 1) { + TopicChooser tc(this, keyword, links); + if (tc.exec() == QDialog::Accepted) + url = tc.link(); + } else if (links.count() == 1) { + url = links.constBegin().value(); + } + + if (url.path().endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive)) + CentralWidget::instance()->setSource(url); + else + CentralWidget::instance()->setSourceInNewTab(url); + } +} + QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/indexwindow.h b/tools/assistant/tools/assistant/indexwindow.h index f1f57f9..14ed83c 100644 --- a/tools/assistant/tools/assistant/indexwindow.h +++ b/tools/assistant/tools/assistant/indexwindow.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QHelpIndexWidget; class QHelpEngine; +class QModelIndex; class IndexWindow : public QWidget { @@ -79,6 +80,7 @@ private slots: private: bool eventFilter(QObject *obj, QEvent *e); void focusInEvent(QFocusEvent *e); + void open(QHelpIndexWidget *indexWidget, const QModelIndex &index); QLineEdit *m_searchLineEdit; QHelpIndexWidget *m_indexWidget; diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 0f246be..df39650 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -186,9 +186,11 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) m_helpEngine->setCustomValue(QLatin1String("useAppFont"), false); m_helpEngine->setCustomValue(QLatin1String("useBrowserFont"), false); m_helpEngine->setCustomValue(QLatin1String("appFont"), qApp->font()); - m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"), QFontDatabase::Latin); + m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"), + QFontDatabase::Latin); m_helpEngine->setCustomValue(QLatin1String("browserFont"), qApp->font()); - m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"), QFontDatabase::Latin); + m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"), + QFontDatabase::Latin); } else { updateApplicationFont(); } @@ -377,118 +379,107 @@ void MainWindow::insertLastPages() void MainWindow::setupActions() { - QString system = QLatin1String("win"); + QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); #ifdef Q_OS_MAC - system = QLatin1String("mac"); setUnifiedTitleAndToolBarOnMac(true); + resourcePath.append(QLatin1String("mac")); +#else + resourcePath.append(QLatin1String("win")); #endif QMenu *menu = menuBar()->addMenu(tr("&File")); - m_pageSetupAction = menu->addAction(tr("Page Set&up..."), m_centralWidget, SLOT(pageSetup())); - m_printPreviewAction = menu->addAction(tr("Print Preview..."), m_centralWidget, SLOT(printPreview())); + m_pageSetupAction = menu->addAction(tr("Page Set&up..."), m_centralWidget, + SLOT(pageSetup())); + m_printPreviewAction = menu->addAction(tr("Print Preview..."), m_centralWidget, + SLOT(printPreview())); + m_printAction = menu->addAction(tr("&Print..."), m_centralWidget, SLOT(print())); - m_printAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/print.png").arg(system))); - m_printAction->setShortcut(tr("CTRL+P")); + m_printAction->setIcon(QIcon(resourcePath + QLatin1String("/print.png"))); + m_printAction->setShortcut(QKeySequence::Print); menu->addSeparator(); m_newTabAction = menu->addAction(tr("New &Tab"), m_centralWidget, SLOT(newTab())); - m_newTabAction->setShortcut(tr("CTRL+T")); - m_closeTabAction = menu->addAction(tr("&Close Tab"), m_centralWidget, SLOT(closeTab())); - m_closeTabAction->setShortcut(tr("CTRL+W")); + m_newTabAction->setShortcut(QKeySequence::AddTab); + + m_closeTabAction = menu->addAction(tr("&Close Tab"), m_centralWidget, + SLOT(closeTab())); + m_closeTabAction->setShortcuts(QKeySequence::Close); QAction *tmp = menu->addAction(tr("&Quit"), this, SLOT(close())); tmp->setShortcut(tr("CTRL+Q")); tmp->setMenuRole(QAction::QuitRole); menu = menuBar()->addMenu(tr("&Edit")); - m_copyAction = menu->addAction(tr("&Copy selected Text"), - m_centralWidget, SLOT(copySelection())); - m_copyAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/editcopy.png").arg(system))); - m_copyAction->setShortcut(tr("Ctrl+C")); + m_copyAction = menu->addAction(tr("&Copy selected Text"), m_centralWidget, + SLOT(copySelection())); + m_copyAction->setIcon(QIcon(resourcePath + QLatin1String("/editcopy.png"))); + m_copyAction->setShortcuts(QKeySequence::Copy); m_copyAction->setEnabled(false); - m_findAction = menu->addAction(tr("&Find in Text..."), - m_centralWidget, SLOT(showTextSearch())); - m_findAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/find.png").arg(system))); - m_findAction->setShortcut(tr("Ctrl+F")); - m_findAction->setShortcut(QKeySequence::Find); + m_findAction = menu->addAction(tr("&Find in Text..."), m_centralWidget, + SLOT(showTextSearch())); + m_findAction->setIcon(QIcon(resourcePath + QLatin1String("/find.png"))); + m_findAction->setShortcuts(QKeySequence::Find); - QAction *findNextAction = menu->addAction(tr("Find &Next"), - m_centralWidget, SLOT(findNext())); - findNextAction->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("F3")) - << QKeySequence(tr("CTRL+G"))); + QAction *findNextAction = menu->addAction(tr("Find &Next"), m_centralWidget, + SLOT(findNext())); + findNextAction->setShortcuts(QKeySequence::FindNext); QAction *findPreviousAction = menu->addAction(tr("Find &Previous"), m_centralWidget, SLOT(findPrevious())); - findPreviousAction->setShortcuts(QList<QKeySequence>() << - QKeySequence(tr("Shift+F3")) << QKeySequence(tr("CTRL+SHIFT+G"))); + findPreviousAction->setShortcuts(QKeySequence::FindPrevious); menu->addSeparator(); tmp = menu->addAction(tr("Preferences..."), this, SLOT(showPreferences())); tmp->setMenuRole(QAction::PreferencesRole); m_viewMenu = menuBar()->addMenu(tr("&View")); - m_zoomInAction = m_viewMenu->addAction(tr("Zoom &in"), - m_centralWidget, SLOT(zoomIn())); - m_zoomInAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/zoomin.png").arg(system))); - m_zoomInAction->setShortcut(tr("Ctrl++")); - - m_zoomOutAction = m_viewMenu->addAction(tr("Zoom &out"), - m_centralWidget, SLOT(zoomOut())); - m_zoomOutAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/zoomout.png").arg(system))); - m_zoomOutAction->setShortcut(tr("Ctrl+-")); - - m_resetZoomAction = m_viewMenu->addAction(tr("Normal &Size"), - m_centralWidget, SLOT(resetZoom())); - m_resetZoomAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/resetzoom.png").arg(system))); + m_zoomInAction = m_viewMenu->addAction(tr("Zoom &in"), m_centralWidget, + SLOT(zoomIn())); + m_zoomInAction->setIcon(QIcon(resourcePath + QLatin1String("/zoomin.png"))); + m_zoomInAction->setShortcut(QKeySequence::ZoomIn); + + m_zoomOutAction = m_viewMenu->addAction(tr("Zoom &out"), m_centralWidget, + SLOT(zoomOut())); + m_zoomOutAction->setIcon(QIcon(resourcePath + QLatin1String("/zoomout.png"))); + m_zoomOutAction->setShortcut(QKeySequence::ZoomOut); + + m_resetZoomAction = m_viewMenu->addAction(tr("Normal &Size"), m_centralWidget, + SLOT(resetZoom())); + m_resetZoomAction->setIcon(QIcon(resourcePath + QLatin1String("/resetzoom.png"))); m_resetZoomAction->setShortcut(tr("Ctrl+0")); m_viewMenu->addSeparator(); - m_viewMenu->addAction(tr("Contents"), this, - SLOT(showContents()), QKeySequence(tr("ALT+C"))); - m_viewMenu->addAction(tr("Index"), this, - SLOT(showIndex()), QKeySequence(tr("ALT+I"))); - m_viewMenu->addAction(tr("Bookmarks"), this, - SLOT(showBookmarks()), QKeySequence(tr("ALT+O"))); - m_viewMenu->addAction(tr("Search"), this, - SLOT(showSearch()), QKeySequence(tr("ALT+S"))); + m_viewMenu->addAction(tr("Contents"), this, SLOT(showContents()), + QKeySequence(tr("ALT+C"))); + m_viewMenu->addAction(tr("Index"), this, SLOT(showIndex()), + QKeySequence(tr("ALT+I"))); + m_viewMenu->addAction(tr("Bookmarks"), this, SLOT(showBookmarks()), + QKeySequence(tr("ALT+O"))); + m_viewMenu->addAction(tr("Search"), this, SLOT(showSearch()), + QKeySequence(tr("ALT+S"))); menu = menuBar()->addMenu(tr("&Go")); - m_homeAction = menu->addAction(tr("&Home"), - m_centralWidget, SLOT(home())); + m_homeAction = menu->addAction(tr("&Home"), m_centralWidget, SLOT(home())); m_homeAction->setShortcut(tr("Ctrl+Home")); - m_homeAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/home.png").arg(system))); + m_homeAction->setIcon(QIcon(resourcePath + QLatin1String("/home.png"))); - m_backAction = menu->addAction(tr("&Back"), - m_centralWidget, SLOT(backward())); + m_backAction = menu->addAction(tr("&Back"), m_centralWidget, SLOT(backward())); m_backAction->setEnabled(false); - m_backAction->setShortcuts(QList<QKeySequence>() - << QKeySequence(Qt::CTRL|Qt::Key_Left) << QKeySequence::Back); - m_backAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/previous.png").arg(system))); + m_backAction->setShortcuts(QKeySequence::Back); + m_backAction->setIcon(QIcon(resourcePath + QLatin1String("/previous.png"))); - m_nextAction = menu->addAction(tr("&Forward"), - m_centralWidget, SLOT(forward())); + m_nextAction = menu->addAction(tr("&Forward"), m_centralWidget, SLOT(forward())); m_nextAction->setEnabled(false); - m_nextAction->setShortcuts(QList<QKeySequence>() - << QKeySequence(Qt::CTRL|Qt::Key_Right) << QKeySequence::Forward); - m_nextAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/next.png").arg(system))); + m_nextAction->setShortcuts(QKeySequence::Forward); + m_nextAction->setIcon(QIcon(resourcePath + QLatin1String("/next.png"))); - m_syncAction = menu->addAction(tr("Sync with Table of Contents"), - this, SLOT(syncContents())); - m_syncAction->setIcon(QIcon( - QString::fromUtf8(":/trolltech/assistant/images/%1/synctoc.png").arg(system))); + m_syncAction = menu->addAction(tr("Sync with Table of Contents"), this, + SLOT(syncContents())); + m_syncAction->setIcon(QIcon(resourcePath + QLatin1String("/synctoc.png"))); menu->addSeparator(); @@ -496,8 +487,7 @@ void MainWindow::setupActions() tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Right")) << QKeySequence(Qt::CTRL + Qt::Key_PageDown)); - tmp = menu->addAction(tr("Previous Page"), - m_centralWidget, SLOT(previousPage())); + tmp = menu->addAction(tr("Previous Page"), m_centralWidget, SLOT(previousPage())); tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Left")) << QKeySequence(Qt::CTRL + Qt::Key_PageUp)); @@ -525,53 +515,52 @@ void MainWindow::setupActions() navigationBar->addAction(m_resetZoomAction); QList<QAction*> actionList; - actionList << m_backAction << m_nextAction << m_homeAction; - actionList << sep << m_zoomInAction << m_zoomOutAction; - actionList << sep2 << m_copyAction << m_printAction << m_findAction; + actionList << m_backAction << m_nextAction << m_homeAction << sep + << m_zoomInAction << m_zoomOutAction << sep2 << m_copyAction + << m_printAction << m_findAction; m_centralWidget->setGlobalActions(actionList); #if defined(Q_WS_MAC) QMenu *windowMenu = new QMenu(tr("&Window"), this); menuBar()->insertMenu(menu->menuAction(), windowMenu); - windowMenu->addAction(tr("Minimize"), this, - SLOT(showMinimized()), QKeySequence(tr("Ctrl+M"))); - windowMenu->addAction(tr("Zoom"), this, - SLOT(showMaximized())); + windowMenu->addAction(tr("Zoom"), this, SLOT(showMaximized())); + windowMenu->addAction(tr("Minimize"), this, SLOT(showMinimized()), + QKeySequence(tr("Ctrl+M"))); #endif // content viewer connections - connect(m_centralWidget, SIGNAL(copyAvailable(bool)), - this, SLOT(copyAvailable(bool))); - connect(m_centralWidget, SIGNAL(currentViewerChanged()), - this, SLOT(updateNavigationItems())); - connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), - this, SLOT(updateNavigationItems())); - connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), - this, SLOT(updateNavigationItems())); - connect(m_centralWidget, SIGNAL(highlighted(const QString&)), - statusBar(), SLOT(showMessage(const QString&))); - connect(m_centralWidget, SIGNAL(addNewBookmark(const QString&, - const QString&)), this, SLOT(addNewBookmark(const QString&, const QString&))); + connect(m_centralWidget, SIGNAL(copyAvailable(bool)), this, + SLOT(copyAvailable(bool))); + connect(m_centralWidget, SIGNAL(currentViewerChanged()), this, + SLOT(updateNavigationItems())); + connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), this, + SLOT(updateNavigationItems())); + connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), this, + SLOT(updateNavigationItems())); + connect(m_centralWidget, SIGNAL(highlighted(QString)), statusBar(), + SLOT(showMessage(QString))); + connect(m_centralWidget, SIGNAL(addNewBookmark(QString, QString)), this, + SLOT(addNewBookmark(QString, QString))); // bookmarks - connect(m_bookmarkWidget, SIGNAL(requestShowLink(const QUrl&)), - m_centralWidget, SLOT(setSource(const QUrl&))); - connect(m_bookmarkWidget, SIGNAL(escapePressed()), - this, SLOT(activateCurrentCentralWidgetTab())); + connect(m_bookmarkWidget, SIGNAL(requestShowLink(QUrl)), m_centralWidget, + SLOT(setSource(QUrl))); + connect(m_bookmarkWidget, SIGNAL(escapePressed()), this, + SLOT(activateCurrentCentralWidgetTab())); // index window - connect(m_indexWindow, SIGNAL(linkActivated(const QUrl&)), - m_centralWidget, SLOT(setSource(const QUrl&))); - connect(m_indexWindow, SIGNAL(linksActivated(const QMap<QString, QUrl>&, const QString&)), - this, SLOT(showTopicChooser(const QMap<QString, QUrl>&, const QString&))); - connect(m_indexWindow, SIGNAL(escapePressed()), - this, SLOT(activateCurrentCentralWidgetTab())); + connect(m_indexWindow, SIGNAL(linkActivated(QUrl)), m_centralWidget, + SLOT(setSource(QUrl))); + connect(m_indexWindow, SIGNAL(linksActivated(QMap<QString, QUrl>, QString)), + this, SLOT(showTopicChooser(QMap<QString, QUrl>, QString))); + connect(m_indexWindow, SIGNAL(escapePressed()), this, + SLOT(activateCurrentCentralWidgetTab())); // content window - connect(m_contentWindow, SIGNAL(linkActivated(const QUrl&)), - m_centralWidget, SLOT(setSource(const QUrl&))); - connect(m_contentWindow, SIGNAL(escapePressed()), - this, SLOT(activateCurrentCentralWidgetTab())); + connect(m_contentWindow, SIGNAL(linkActivated(QUrl)), m_centralWidget, + SLOT(setSource(QUrl))); + connect(m_contentWindow, SIGNAL(escapePressed()), this, + SLOT(activateCurrentCentralWidgetTab())); #if defined(QT_NO_PRINTER) m_pageSetupAction->setVisible(false); @@ -601,17 +590,19 @@ void MainWindow::setupFilterToolbar() QToolBar *filterToolBar = addToolBar(tr("Filter Toolbar")); filterToolBar->setObjectName(QLatin1String("FilterToolBar")); - filterToolBar->addWidget(new QLabel(tr("Filtered by:").append(QLatin1String(" ")), this)); + filterToolBar->addWidget(new QLabel(tr("Filtered by:").append(QLatin1Char(' ')), + this)); filterToolBar->addWidget(m_filterCombo); - if (m_helpEngine->customValue(QLatin1String("HideFilterFunctionality"), true).toBool()) + const QLatin1String hideFilter("HideFilterFunctionality"); + if (m_helpEngine->customValue(hideFilter, true).toBool()) filterToolBar->hide(); toolBarMenu()->addAction(filterToolBar->toggleViewAction()); - connect(m_helpEngine, SIGNAL(setupFinished()), - this, SLOT(setupFilterCombo())); - connect(m_filterCombo, SIGNAL(activated(const QString&)), - this, SLOT(filterDocumentation(const QString&))); + connect(m_helpEngine, SIGNAL(setupFinished()), this, + SLOT(setupFilterCombo())); + connect(m_filterCombo, SIGNAL(activated(const QString&)), this, + SLOT(filterDocumentation(const QString&))); setupFilterCombo(); } @@ -626,7 +617,8 @@ void MainWindow::setupAddressToolbar() addressToolBar->setObjectName(QLatin1String("AddressToolBar")); insertToolBarBreak(addressToolBar); - addressToolBar->addWidget(new QLabel(tr("Address:").append(QLatin1String(" ")), this)); + addressToolBar->addWidget(new QLabel(tr("Address:").append(QLatin1String(" ")), + this)); addressToolBar->addWidget(m_addressLineEdit); if (m_helpEngine->customValue(QLatin1String("HideAddressBar"), true).toBool()) @@ -684,7 +676,8 @@ void MainWindow::showNewAddress(const QUrl &url) void MainWindow::addBookmark() { - addNewBookmark(m_centralWidget->currentTitle(), m_centralWidget->currentSource().toString()); + addNewBookmark(m_centralWidget->currentTitle(), + m_centralWidget->currentSource().toString()); } void MainWindow::gotoAddress() @@ -784,7 +777,8 @@ void MainWindow::showAboutDialog() if (!contents.isEmpty()) { iconArray = m_helpEngine->customValue(QLatin1String("AboutIcon"), QByteArray()).toByteArray(); - QByteArray resources = m_helpEngine->customValue(QLatin1String("AboutImages"), + QByteArray resources = + m_helpEngine->customValue(QLatin1String("AboutImages"), QByteArray()).toByteArray(); QPixmap pix; pix.loadFromData(iconArray); @@ -795,13 +789,16 @@ void MainWindow::showAboutDialog() } else { #if QT_EDITION == QT_EDITION_OPENSOURCE QString edition = tr("Open Source Edition"); - QString info = tr("This version of Qt Assistant is part of the Qt Open Source Edition, for use " + QString info = tr("This version of Qt Assistant is part of the Qt Open " + "Source Edition, for use " "in the development of Open Source applications. " "Qt is a comprehensive C++ framework for cross-platform application " "development."); - QString moreInfo = tr("You need a commercial Qt license for development of proprietary (closed " - "source) applications. Please see <a href=\"http://qtsoftware.com/company/about/businessmodel" - "\">http://qtsoftware.com/company/about/businessmodel</a> for an overview of Qt licensing."); + QString moreInfo = tr("You need a commercial Qt license for development " + "of proprietary (closed source) applications. Please see " + "<a href=\"http://qtsoftware.com/company/about/businessmodel" + "\">http://qtsoftware.com/company/about/businessmodel</a> for an " + "overview of Qt licensing."); #else QString edition; QString info; @@ -816,13 +813,14 @@ void MainWindow::showAboutDialog() "<p>Version %2 %3</p></center>" "<p>%4</p>" "<p>%5</p>" - "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p>" - "<p>The program is provided AS IS with NO WARRANTY OF ANY KIND," + "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)" + ".</p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" " PARTICULAR PURPOSE.<p/>") .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)) .arg(edition).arg(info).arg(moreInfo), resources); - aboutDia.setPixmap(QString::fromLatin1(":/trolltech/assistant/images/assistant-128.png")); + QLatin1String path(":/trolltech/assistant/images/assistant-128.png"); + aboutDia.setPixmap(QString(path)); } if (aboutDia.windowTitle().isEmpty()) aboutDia.setWindowTitle(tr("About %1").arg(windowTitle())); @@ -974,20 +972,19 @@ QWidget* MainWindow::setupBookmarkWidget() QString MainWindow::collectionFileDirectory(bool createDir, const QString &cacheDir) { - QString collectionPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); + QString collectionPath = + QDesktopServices::storageLocation(QDesktopServices::DataLocation); if (collectionPath.isEmpty()) { if (cacheDir.isEmpty()) collectionPath = QDir::homePath() + QDir::separator() + QLatin1String(".assistant"); else - collectionPath = QDir::homePath() + QLatin1String("/.") - + cacheDir; + collectionPath = QDir::homePath() + QLatin1String("/.") + cacheDir; } else { if (cacheDir.isEmpty()) collectionPath = collectionPath + QLatin1String("/Trolltech/Assistant"); else - collectionPath = collectionPath + QDir::separator() - + cacheDir; + collectionPath = collectionPath + QDir::separator() + cacheDir; } collectionPath = QDir::cleanPath(collectionPath); if (createDir) { @@ -1001,8 +998,8 @@ QString MainWindow::collectionFileDirectory(bool createDir, const QString &cache QString MainWindow::defaultHelpCollectionFileName() { return collectionFileDirectory() + QDir::separator() + - QString(QLatin1String("qthelpcollection_%1.qhc")). - arg(QLatin1String(QT_VERSION_STR)); + QString(QLatin1String("qthelpcollection_%1.qhc")). + arg(QLatin1String(QT_VERSION_STR)); } QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 8b87b7b..c716b1c 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -72,7 +72,7 @@ public: MainWindow(CmdLineParser *cmdLine, QWidget *parent = 0); ~MainWindow(); - static void activateCurrentBrowser(); + static void activateCurrentBrowser(); static QString collectionFileDirectory(bool createDir = false, const QString &cacheDir = QString()); static QString defaultHelpCollectionFileName(); @@ -103,12 +103,12 @@ private slots: void gotoAddress(); void showPreferences(); void showNewAddress(); - void showAboutDialog(); + void showAboutDialog(); void copyAvailable(bool yes); void updateNavigationItems(); void showNewAddress(const QUrl &url); void addNewBookmark(const QString &title, const QString &url); - void showTopicChooser(const QMap<QString, QUrl> &links, const QString &keyword); + void showTopicChooser(const QMap<QString, QUrl> &links, const QString &keyword); void updateApplicationFont(); void filterDocumentation(const QString &customFilter); void setupFilterCombo(); @@ -128,7 +128,7 @@ private: void setupFilterToolbar(); void setupAddressToolbar(); QMenu *toolBarMenu(); - QWidget *setupBookmarkWidget(); + QWidget *setupBookmarkWidget(); QHelpEngine *m_helpEngine; CentralWidget *m_centralWidget; diff --git a/tools/checksdk/main.cpp b/tools/checksdk/main.cpp index 1d4b616..717f5c9 100644 --- a/tools/checksdk/main.cpp +++ b/tools/checksdk/main.cpp @@ -97,12 +97,6 @@ int main(int argc, char **argv) } } - // Check for SDK Name, otherwise use Windows Mobile as default - if (sdkName.isEmpty()) { - qWarning("No SDK specified: Defaulting to Windows Mobile 5.0 Pocket PC SDK"); - sdkName = QString::fromLatin1("Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"); - } - CeSdkHandler handler; if (!handler.parse()) { qWarning("Could not find any installed SDK, aborting!"); @@ -118,6 +112,12 @@ int main(int argc, char **argv) return 0; } + // Check for SDK Name, otherwise use Windows Mobile as default + if (sdkName.isEmpty()) { + qWarning("No SDK specified: Defaulting to Windows Mobile 5.0 Pocket PC SDK"); + sdkName = QString::fromLatin1("Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"); + } + // finally find the given SDK and prompt out the environment to be set for (QList<CeSdkInfo>::iterator it = list.begin(); it != list.end(); ++it ) { if (sdkName == it->name()) { diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 83abd38..bcbf557 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -474,6 +474,9 @@ void Configure::parseCmdLine() else if( configCmdLine.at(i) == "-developer-build" ) dictionary[ "BUILDDEV" ] = "yes"; else if( configCmdLine.at(i) == "-nokia-developer" ) { + cout << "Detected -nokia-developer option" << endl; + cout << "Nokia employees and agents are allowed to use this software under" << endl; + cout << "the authority of Nokia Corporation and/or its subsidiary(-ies)" << endl; dictionary[ "BUILDNOKIA" ] = "yes"; dictionary[ "BUILDDEV" ] = "yes"; dictionary["LICENSE_CONFIRMED"] = "yes"; @@ -675,6 +678,9 @@ void Configure::parseCmdLine() } else if ( configCmdLine.at(i) == "-opengl-es-cl" ) { dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_CL" ] = "yes"; + } else if ( configCmdLine.at(i) == "-opengl-es-2" ) { + dictionary[ "OPENGL" ] = "yes"; + dictionary[ "OPENGL_ES_2" ] = "yes"; } // Databases ------------------------------------------------ else if( configCmdLine.at(i) == "-qt-sql-mysql" ) @@ -1632,6 +1638,7 @@ bool Configure::displayHelp() desc( "-signature <file>", "Use file for signing the target project"); desc("OPENGL_ES_CM", "no", "-opengl-es-cm", "Enable support for OpenGL ES Common"); desc("OPENGL_ES_CL", "no", "-opengl-es-cl", "Enable support for OpenGL ES Common Lite"); + desc("OPENGL_ES_2", "no", "-opengl-es-2", "Enable support for OpenGL ES 2.0"); desc("DIRECTSHOW", "no", "-phonon-wince-ds9", "Enable Phonon Direct Show 9 backend for Windows CE"); return true; @@ -1785,6 +1792,8 @@ bool Configure::checkAvailability(const QString &part) available = (dictionary[ "ARCHITECTURE" ] == "windowsce"); else if (part == "OPENGL_ES_CL") available = (dictionary[ "ARCHITECTURE" ] == "windowsce"); + else if (part == "OPENGL_ES_2") + available = (dictionary[ "ARCHITECTURE" ] == "windowsce"); else if (part == "DIRECTSHOW") available = (dictionary[ "ARCHITECTURE" ] == "windowsce"); else if (part == "SSE2") @@ -2264,6 +2273,10 @@ void Configure::generateOutputVars() qtConfig += "opengles1"; } + if ( dictionary["OPENGL_ES_2"] == "yes" ) { + qtConfig += "opengles2"; + } + if ( dictionary["OPENGL_ES_CL"] == "yes" ) { qtConfig += "opengles1cl"; } @@ -2664,9 +2677,11 @@ void Configure::generateConfigfiles() if(dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS"; if(dictionary["OPENGL_ES_CM"] == "yes" || - dictionary["OPENGL_ES_CL"] == "yes") qconfigList += "QT_OPENGL_ES"; + dictionary["OPENGL_ES_CL"] == "yes" || + dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES"; if(dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1"; + if(dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2"; if(dictionary["OPENGL_ES_CL"] == "yes") qconfigList += "QT_OPENGL_ES_1_CL"; if(dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL"; @@ -3030,7 +3045,7 @@ void Configure::generateHeaders() args += buildPath + "/bin/syncqt.bat"; QStringList env; env += QString("QTDIR=" + sourcePath); - //env += QString("PATH=" + buildPath + "/bin/;%PATH%"); + env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH")); Environment::execute(args, env, QStringList()); } } @@ -3500,7 +3515,7 @@ void Configure::readLicense() #else } else { Tools::checkLicense(dictionary, licenseInfo, firstLicensePath()); - if (dictionary["DONE"] != "error") { + if (dictionary["DONE"] != "error" && dictionary["BUILDNOKIA"] != "yes") { // give the user some feedback, and prompt for license acceptance cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl; if (!showLicense(dictionary["LICENSE FILE"])) { diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp index ae1ecda..2649d44 100644 --- a/tools/configure/tools.cpp +++ b/tools/configure/tools.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "tools.h" #include <QDir> @@ -17,6 +58,13 @@ using namespace std; void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString> &licenseInfo, const QString &path) { + if (dictionary[ "BUILDNOKIA" ] == "yes") { + dictionary["EDITION"] = "NokiaInternalBuild"; + dictionary["LICENSE_FILE"] = ""; // No License for nokia developers + dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE"; + return; // No license key checking in internal builds + } + QString tpLicense = dictionary["QT_SOURCE_TREE"] + "/LICENSE.PREVIEW.OPENSOURCE"; if (QFile::exists(tpLicense)) { dictionary["EDITION"] = "Preview"; @@ -101,25 +149,28 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString dictionary["EDITION"] = "GUIFramework"; dictionary["QT_EDITION"] = "QT_EDITION_DESKTOPLIGHT"; } + + if (platforms == 'X') { + dictionary["LICENSE_EXTENSION"] = "-ALLOS"; + } else if (strchr("3679ACDEHJKMSUWX", platforms)) { + dictionary["LICENSE_EXTENSION"] = "-EMBEDDED"; + } else if (strchr("4BFPQRTY", platforms)) { + dictionary["LICENSE_EXTENSION"] = "-DESKTOP"; + } } else if (strcmp(licenseSchema,"Z4M") == 0 || strcmp(licenseSchema,"R4M") == 0 || strcmp(licenseSchema,"Q4M") == 0) { if (products == 'B') { dictionary["EDITION"] = "Evaluation"; dictionary["QT_EDITION"] = "QT_EDITION_EVALUATION"; + dictionary["LICENSE_EXTENSION"] = "-EVALUATION"; } } - // Determine license extension ----------------------------------------------------------------- if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) { // Generic, no-suffix license dictionary["LICENSE_EXTENSION"] = QString(); - } else if (platforms == 'X') { - dictionary["LICENSE_EXTENSION"] = "-ALLOS"; - } else if (/*Windows CE */platforms == '6' || /*Embedded */ platforms == '8' || /*Embedded + Windows CE*/platforms == 'K' || /*Windows + Windows CE*/ platforms == 'H') { - dictionary["LICENSE_EXTENSION"] = "-EMBEDDED"; - } else if (/*Windows*/ platforms == 'R' || /*Mac+X11+Windows*/ platforms == 'F') { - dictionary["LICENSE_EXTENSION"] = "-DESKTOP"; - } else if (dictionary["EDITION"] == "Evaluation") { - dictionary["LICENSE_EXTENSION"] = "-EVALUATION"; + } else if (dictionary["LICENSE_EXTENSION"].isEmpty()) { + cout << "License file does not contain proper license key." << endl; + dictionary["DONE"] = "error"; } if (licenseType.isEmpty() || dictionary["EDITION"].isEmpty() @@ -129,19 +180,9 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString return; } - // verify that we are licensed to use Qt for Windows if (dictionary["PLATFORM NAME"].contains("Windows CE")) { - // verify that we are licensed to use Qt for Windows AND Qt for Windows CE - if (platforms != 'H') { - cout << "You are not licensed for the " << dictionary["PLATFORM NAME"] << " platform." << endl << endl; - cout << "Please contact sales@trolltech.com to upgrade your license" << endl; - cout << "to include the " << dictionary["PLATFORM NAME"] << " platform, or install the" << endl; - cout << "Qt Open Source Edition if you intend to develop free software." << endl; - dictionary["DONE"] = "error"; - return; - } - } else { - if (!( platforms == 'R' || ( platforms == '6' )|| platforms == '8' )) { + // verify that we are licensed to use Qt for Windows CE + if (dictionary["LICENSE_EXTENSION"] != "-EMBEDDED" && dictionary["LICENSE_EXTENSION"] != "-ALLOS") { cout << "You are not licensed for the " << dictionary["PLATFORM NAME"] << " platform." << endl << endl; cout << "Please contact sales@trolltech.com to upgrade your license" << endl; cout << "to include the " << dictionary["PLATFORM NAME"] << " platform, or install the" << endl; diff --git a/tools/configure/tools.h b/tools/configure/tools.h index e95ff13..68a439a 100644 --- a/tools/configure/tools.h +++ b/tools/configure/tools.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef _TOOLS_H_ #define _TOOLS_H_ diff --git a/tools/designer/src/components/objectinspector/objectinspectormodel.cpp b/tools/designer/src/components/objectinspector/objectinspectormodel.cpp index 3effa60..bc1ac0c 100644 --- a/tools/designer/src/components/objectinspector/objectinspectormodel.cpp +++ b/tools/designer/src/components/objectinspector/objectinspectormodel.cpp @@ -202,12 +202,15 @@ namespace qdesigner_internal { isContainer = widgetItem->isContainer(); } + // We might encounter temporary states with no layouts when re-layouting. + // Just default to Widget handling for the moment. if (isQLayoutWidget(w)) { - m_type = LayoutWidget; - const QLayout *layout = w->layout(); - m_managedLayoutType = LayoutInfo::layoutType(ctx.core, layout); - m_className = QLatin1String(layout->metaObject()->className()); - m_objectName = layout->objectName(); + if (const QLayout *layout = w->layout()) { + m_type = LayoutWidget; + m_managedLayoutType = LayoutInfo::layoutType(ctx.core, layout); + m_className = QLatin1String(layout->metaObject()->className()); + m_objectName = layout->objectName(); + } return; } diff --git a/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp b/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp index 1b267aa..346da18 100644 --- a/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp +++ b/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp @@ -271,7 +271,7 @@ void TextEditor::fileActionActivated() const QString newPath = m_core->dialogGui()->getOpenFileName(this, tr("Choose a File"), oldPath); if (newPath.isEmpty() || newPath == oldPath) return; - const QString newText = QLatin1String("file:") + newPath; + const QString newText = QUrl::fromLocalFile(newPath).toString(); m_editor->setText(newText); emit textChanged(newText); } diff --git a/tools/designer/src/lib/shared/actioneditor.cpp b/tools/designer/src/lib/shared/actioneditor.cpp index 6a66442..7f96a15 100644 --- a/tools/designer/src/lib/shared/actioneditor.cpp +++ b/tools/designer/src/lib/shared/actioneditor.cpp @@ -456,7 +456,7 @@ void ActionEditor::slotNewAction() if (actionData.checkable) setInitialProperty(sheet, QLatin1String(checkablePropertyC), QVariant(true)); - if (!actionData.keysequence.isEmpty()) + if (!actionData.keysequence.value().isEmpty()) setInitialProperty(sheet, QLatin1String(shortcutPropertyC), qVariantFromValue(actionData.keysequence)); sheet->setProperty(sheet->indexOf(QLatin1String(iconPropertyC)), qVariantFromValue(actionData.icon)); @@ -491,10 +491,10 @@ static QDesignerFormWindowCommand *setIconPropertyCommand(const PropertySheetIco // return a FormWindow command to apply a QKeySequence or a reset command // in case it is empty. -static QDesignerFormWindowCommand *setKeySequencePropertyCommand(const QKeySequence &ks, QAction *action, QDesignerFormWindowInterface *fw) +static QDesignerFormWindowCommand *setKeySequencePropertyCommand(const PropertySheetKeySequenceValue &ks, QAction *action, QDesignerFormWindowInterface *fw) { const QString shortcutProperty = QLatin1String(shortcutPropertyC); - if (ks.isEmpty()) { + if (ks.value().isEmpty()) { ResetPropertyCommand *cmd = new ResetPropertyCommand(fw); cmd->init(action, shortcutProperty); return cmd; @@ -544,7 +544,7 @@ void ActionEditor::editAction(QAction *action) oldActionData.text = action->text(); oldActionData.toolTip = textPropertyValue(sheet, QLatin1String(toolTipPropertyC)); oldActionData.icon = qVariantValue<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC)))); - oldActionData.keysequence = qVariantValue<QKeySequence>(sheet->property(sheet->indexOf(QLatin1String(shortcutPropertyC)))); + oldActionData.keysequence = ActionModel::actionShortCut(sheet); oldActionData.checkable = action->isCheckable(); dlg.setActionData(oldActionData); diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp index 941a9ba..1b638c3 100644 --- a/tools/designer/src/lib/shared/actionrepository.cpp +++ b/tools/designer/src/lib/shared/actionrepository.cpp @@ -42,6 +42,7 @@ #include "actionrepository_p.h" #include "qtresourceview_p.h" #include "iconloader_p.h" +#include "qdesigner_utils_p.h" #include <QtDesigner/QDesignerFormEditorInterface> #include <QtDesigner/QDesignerPropertySheetExtension> @@ -168,16 +169,20 @@ QWidgetList ActionModel::associatedWidgets(const QAction *action) } // shortcut is a fake property, need to retrieve it via property sheet. -static QString actionShortCut(QDesignerFormEditorInterface *core, QAction *action) +PropertySheetKeySequenceValue ActionModel::actionShortCut(QDesignerFormEditorInterface *core, QAction *action) { QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), action); if (!sheet) - return QString(); + return PropertySheetKeySequenceValue(); + return actionShortCut(sheet); +} + +PropertySheetKeySequenceValue ActionModel::actionShortCut(const QDesignerPropertySheetExtension *sheet) +{ const int index = sheet->indexOf(QLatin1String("shortcut")); if (index == -1) - return QString(); - const QKeySequence keysequence = qvariant_cast<QKeySequence>(sheet->property(index)); - return keysequence.toString(); + return PropertySheetKeySequenceValue(); + return qvariant_cast<PropertySheetKeySequenceValue>(sheet->property(index)); } void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, QStandardItemList &sl) @@ -221,7 +226,7 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, item->setText(action->text()); item->setToolTip(action->text()); // shortcut - const QString shortcut = actionShortCut(core, action); + const QString shortcut = actionShortCut(core, action).value().toString(); item = sl[ShortCutColumn]; item->setText(shortcut); item->setToolTip(shortcut); diff --git a/tools/designer/src/lib/shared/actionrepository_p.h b/tools/designer/src/lib/shared/actionrepository_p.h index 9d1af5a..66d77ce 100644 --- a/tools/designer/src/lib/shared/actionrepository_p.h +++ b/tools/designer/src/lib/shared/actionrepository_p.h @@ -65,9 +65,12 @@ QT_BEGIN_NAMESPACE class QPixmap; class QDesignerFormEditorInterface; +class QDesignerPropertySheetExtension; namespace qdesigner_internal { +class PropertySheetKeySequenceValue; + // Shared model of actions, to be used for several views (detailed/icon view). class QDESIGNER_SHARED_EXPORT ActionModel: public QStandardItemModel { @@ -99,6 +102,10 @@ public: // Find the associated menus and toolbars, ignore toolbuttons static QWidgetList associatedWidgets(const QAction *action); + // Retrieve shortcut via property sheet as it is a fake property + static PropertySheetKeySequenceValue actionShortCut(QDesignerFormEditorInterface *core, QAction *action); + static PropertySheetKeySequenceValue actionShortCut(const QDesignerPropertySheetExtension *ps); + signals: void resourceImageDropped(const QString &path, QAction *action); diff --git a/tools/designer/src/lib/shared/newactiondialog.cpp b/tools/designer/src/lib/shared/newactiondialog.cpp index 53aec4b..bb163d6 100644 --- a/tools/designer/src/lib/shared/newactiondialog.cpp +++ b/tools/designer/src/lib/shared/newactiondialog.cpp @@ -134,7 +134,7 @@ ActionData NewActionDialog::actionData() const rc.toolTip = m_ui->tooltipEditor->text(); rc.icon = m_ui->iconSelector->icon(); rc.checkable = m_ui->checkableCheckBox->checkState() == Qt::Checked; - rc.keysequence = m_ui->keySequenceEdit->keySequence(); + rc.keysequence = PropertySheetKeySequenceValue(m_ui->keySequenceEdit->keySequence()); return rc; } @@ -144,7 +144,7 @@ void NewActionDialog::setActionData(const ActionData &d) m_ui->editObjectName->setText(d.name); m_ui->iconSelector->setIcon(d.icon); m_ui->tooltipEditor->setText(d.toolTip); - m_ui->keySequenceEdit->setKeySequence(d.keysequence); + m_ui->keySequenceEdit->setKeySequence(d.keysequence.value()); m_ui->checkableCheckBox->setCheckState(d.checkable ? Qt::Checked : Qt::Unchecked); m_auto_update_object_name = false; diff --git a/tools/designer/src/lib/shared/newactiondialog_p.h b/tools/designer/src/lib/shared/newactiondialog_p.h index c8bd34c..d4e9b5b 100644 --- a/tools/designer/src/lib/shared/newactiondialog_p.h +++ b/tools/designer/src/lib/shared/newactiondialog_p.h @@ -84,7 +84,7 @@ struct ActionData { QString toolTip; PropertySheetIconValue icon; bool checkable; - QKeySequence keysequence; + PropertySheetKeySequenceValue keysequence; }; inline bool operator==(const ActionData &a1, const ActionData &a2) { return a1.compare(a2) == 0u; } diff --git a/tools/designer/src/lib/shared/plugindialog_p.h b/tools/designer/src/lib/shared/plugindialog_p.h index d50a804..a2601d4 100644 --- a/tools/designer/src/lib/shared/plugindialog_p.h +++ b/tools/designer/src/lib/shared/plugindialog_p.h @@ -42,6 +42,17 @@ #ifndef PLUGINDIALOG_H #define PLUGINDIALOG_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "ui_plugindialog.h" QT_BEGIN_NAMESPACE diff --git a/tools/designer/src/lib/shared/qdesigner_utils.cpp b/tools/designer/src/lib/shared/qdesigner_utils.cpp index d2f092e..75fa180 100644 --- a/tools/designer/src/lib/shared/qdesigner_utils.cpp +++ b/tools/designer/src/lib/shared/qdesigner_utils.cpp @@ -397,7 +397,7 @@ namespace qdesigner_internal QMapIterator<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> itPath(paths); while (itPath.hasNext()) { QPair<QIcon::Mode, QIcon::State> pair = itPath.next().key(); - icon.addPixmap(m_pixmapCache->pixmap(itPath.value()), pair.first, pair.second); + icon.addFile(itPath.value().path(), QSize(), pair.first, pair.second); } m_cache.insert(value, icon); return icon; diff --git a/tools/designer/src/lib/shared/textpropertyeditor.cpp b/tools/designer/src/lib/shared/textpropertyeditor.cpp index cf12842..95a9f85 100644 --- a/tools/designer/src/lib/shared/textpropertyeditor.cpp +++ b/tools/designer/src/lib/shared/textpropertyeditor.cpp @@ -293,6 +293,7 @@ namespace qdesigner_internal { } setFocusProxy(m_lineEdit); + setText(m_cachedText); markIntermediateState(); } diff --git a/tools/designer/src/lib/uilib/resourcebuilder.cpp b/tools/designer/src/lib/uilib/resourcebuilder.cpp index 3679f92..5df10e9 100644 --- a/tools/designer/src/lib/uilib/resourcebuilder.cpp +++ b/tools/designer/src/lib/uilib/resourcebuilder.cpp @@ -98,21 +98,21 @@ QVariant QResourceBuilder::loadResource(const QDir &workingDirectory, const DomP if (const int flags = iconStateFlags(dpi)) { // new, post 4.4 format QIcon icon; if (flags & NormalOff) - icon.addPixmap(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QIcon::Normal, QIcon::Off); + icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOff()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::Off); if (flags & NormalOn) - icon.addPixmap(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QIcon::Normal, QIcon::On); + icon.addFile(QFileInfo(workingDirectory, dpi->elementNormalOn()->text()).absoluteFilePath(), QSize(), QIcon::Normal, QIcon::On); if (flags & DisabledOff) - icon.addPixmap(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QIcon::Disabled, QIcon::Off); + icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOff()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::Off); if (flags & DisabledOn) - icon.addPixmap(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QIcon::Disabled, QIcon::On); + icon.addFile(QFileInfo(workingDirectory, dpi->elementDisabledOn()->text()).absoluteFilePath(), QSize(), QIcon::Disabled, QIcon::On); if (flags & ActiveOff) - icon.addPixmap(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QIcon::Active, QIcon::Off); + icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOff()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::Off); if (flags & ActiveOn) - icon.addPixmap(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QIcon::Active, QIcon::On); + icon.addFile(QFileInfo(workingDirectory, dpi->elementActiveOn()->text()).absoluteFilePath(), QSize(), QIcon::Active, QIcon::On); if (flags & SelectedOff) - icon.addPixmap(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QIcon::Selected, QIcon::Off); + icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::Off); if (flags & SelectedOn) - icon.addPixmap(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QIcon::Selected, QIcon::On); + icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::On); return qVariantFromValue(icon); } else { // 4.3 legacy const QIcon icon(QFileInfo(workingDirectory, dpi->text()).absoluteFilePath()); diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 2842bc7..9ccc60e 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -210,6 +210,7 @@ int main(int argc, char *argv[]) qWarning() << qPrintable(cd.error()); return 2; } + Translator::reportDuplicates(tr.resolveDuplicates(), inFiles[0].name, verbose); for (int i = 1; i < inFiles.size(); ++i) { Translator tr2; @@ -217,6 +218,7 @@ int main(int argc, char *argv[]) qWarning() << qPrintable(cd.error()); return 2; } + Translator::reportDuplicates(tr2.resolveDuplicates(), inFiles[i].name, verbose); for (int j = 0; j < tr2.messageCount(); ++j) tr.replaceSorted(tr2.message(j)); } diff --git a/tools/linguist/linguist/formpreviewview.cpp b/tools/linguist/linguist/formpreviewview.cpp index 990414b..184f01b 100644 --- a/tools/linguist/linguist/formpreviewview.cpp +++ b/tools/linguist/linguist/formpreviewview.cpp @@ -473,7 +473,7 @@ void FormPreviewView::setSourceContext(int model, MessageItem *messageItem) } QDir dir = QFileInfo(m_dataModel->srcFileName(model)).dir(); - QString fileName = dir.absoluteFilePath(messageItem->fileName()); + QString fileName = QDir::cleanPath(dir.absoluteFilePath(messageItem->fileName())); if (m_lastFormName != fileName) { delete m_form; m_form = 0; diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index e0a8a56..84200d4 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -188,7 +188,7 @@ private: static const QVariant &pxObsolete() { - static const QVariant v = + static const QVariant v = qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_obsolete.png"))); return v; } @@ -1535,7 +1535,7 @@ void MainWindow::selectedMessageChanged(const QModelIndex &sortedIndex, const QM } else { m_sourceAndFormView->setCurrentWidget(m_sourceCodeView); QDir dir = QFileInfo(m_dataModel->srcFileName(model)).dir(); - QString fileName = dir.absoluteFilePath(m->fileName()); + QString fileName = QDir::cleanPath(dir.absoluteFilePath(m->fileName())); m_sourceCodeView->setSourceContext(fileName, m->lineNumber()); } m_errorsView->setEnabled(true); diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp index f8c679c..dc8b8e4 100644 --- a/tools/linguist/linguist/messageeditor.cpp +++ b/tools/linguist/linguist/messageeditor.cpp @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE // Allow translators to provide localized names for QLocale::languageToString // At least the own language should be translated ... This is a "hack" until // functionality is provided within Qt (see task 196275). -static const char * language_strings[] = +static const char * language_strings[] = { QT_TRANSLATE_NOOP("MessageEditor", "German"), QT_TRANSLATE_NOOP("MessageEditor", "Japanese"), @@ -786,6 +786,7 @@ void MessageEditor::selectAll() void MessageEditor::emitTranslationChanged() { + static_cast<FormWidget *>(sender())->getEditor()->setFocus(); // DND proofness updateBeginFromSource(); updateUndoRedo(); emit translationChanged(translations(m_currentModel)); @@ -793,6 +794,7 @@ void MessageEditor::emitTranslationChanged() void MessageEditor::emitTranslatorCommentChanged() { + static_cast<FormWidget *>(sender())->getEditor()->setFocus(); // DND proofness updateUndoRedo(); emit translatorCommentChanged(m_editors[m_currentModel].transCommentText->getTranslation()); } diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp index 0ea462d..7a8063b 100644 --- a/tools/linguist/linguist/messagemodel.cpp +++ b/tools/linguist/linguist/messagemodel.cpp @@ -209,19 +209,19 @@ bool DataModel::load(const QString &fileName, bool *langGuessed, QWidget *parent return false; } - QList<TranslatorMessage> dupes = tor.findDuplicates(); + QSet<TranslatorMessagePtr> dupes = tor.resolveDuplicates(); if (!dupes.isEmpty()) { QString err = tr("<qt>Duplicate messages found in '%1':").arg(Qt::escape(fileName)); int numdups = 0; - foreach (const TranslatorMessage &msg, dupes) { + foreach (const TranslatorMessagePtr &msg, dupes) { if (++numdups >= 5) { err += tr("<p>[more duplicates omitted]"); break; } err += tr("<p>* Context: %1<br>* Source: %2") - .arg(Qt::escape(msg.context()), Qt::escape(msg.sourceText())); - if (!msg.comment().isEmpty()) - err += tr("<br>* Comment: %3").arg(Qt::escape(msg.comment())); + .arg(Qt::escape(msg->context()), Qt::escape(msg->sourceText())); + if (!msg->comment().isEmpty()) + err += tr("<br>* Comment: %3").arg(Qt::escape(msg->comment())); } QMessageBox::warning(parent, QObject::tr("Qt Linguist"), err); } @@ -289,7 +289,11 @@ bool DataModel::load(const QString &fileName, bool *langGuessed, QWidget *parent c = sys.country(); *langGuessed = true; } - setLanguageAndCountry(l, c); + if (!setLanguageAndCountry(l, c)) + QMessageBox::warning(parent, QObject::tr("Qt Linguist"), + tr("Linguist does not know the plural rules for '%1'.\n" + "Will assume a single universal form.") + .arg(m_localizedLanguage)); // Try to detect the correct source language in the following order // 1. Look for the language attribute in the ts // if that fails @@ -379,17 +383,17 @@ void DataModel::doCharCounting(const QString &text, int &trW, int &trC, int &trC } } -void DataModel::setLanguageAndCountry(QLocale::Language lang, QLocale::Country country) +bool DataModel::setLanguageAndCountry(QLocale::Language lang, QLocale::Country country) { if (m_language == lang && m_country == country) - return; + return true; m_language = lang; m_country = country; if (lang == QLocale::C || uint(lang) > uint(QLocale::LastLanguage)) // XXX does this make any sense? lang = QLocale::English; QByteArray rules; - getNumerusInfo(lang, country, &rules, &m_numerusForms); + bool ok = getNumerusInfo(lang, country, &rules, &m_numerusForms); m_localizedLanguage = QCoreApplication::translate("MessageEditor", QLocale::languageToString(lang).toAscii()); m_countRefNeeds.clear(); for (int i = 0; i < rules.size(); ++i) { @@ -397,8 +401,13 @@ void DataModel::setLanguageAndCountry(QLocale::Language lang, QLocale::Country c while (++i < rules.size() && rules.at(i) != (char)Q_NEWRULE) {} } m_countRefNeeds.append(true); + if (!ok) { + m_numerusForms.clear(); + m_numerusForms << tr("Universal Form"); + } emit languageChanged(); setModified(true); + return ok; } void DataModel::setSourceLanguageAndCountry(QLocale::Language lang, QLocale::Country country) @@ -451,7 +460,7 @@ QString DataModel::prettifyFileName(const QString &fn) /****************************************************************************** * - * DataModelIterator + * DataModelIterator * *****************************************************************************/ @@ -1100,7 +1109,7 @@ void MultiDataModel::updateCountsOnRemove(int model, bool writable) /****************************************************************************** * - * MultiDataModelIterator + * MultiDataModelIterator * *****************************************************************************/ @@ -1205,17 +1214,17 @@ int MessageModel::columnCount(const QModelIndex &) const QVariant MessageModel::data(const QModelIndex &index, int role) const { - static QVariant pxOn = + static QVariant pxOn = qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_on.png"))); - static QVariant pxOff = + static QVariant pxOff = qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_off.png"))); - static QVariant pxObsolete = + static QVariant pxObsolete = qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_obsolete.png"))); static QVariant pxDanger = qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_danger.png"))); static QVariant pxWarning = qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_warning.png"))); - static QVariant pxEmpty = + static QVariant pxEmpty = qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_empty.png"))); int row = index.row(); diff --git a/tools/linguist/linguist/messagemodel.h b/tools/linguist/linguist/messagemodel.h index 7fc2aa6..3b75f7a 100644 --- a/tools/linguist/linguist/messagemodel.h +++ b/tools/linguist/linguist/messagemodel.h @@ -210,7 +210,7 @@ public: static QString prettifyPlainFileName(const QString &fn); static QString prettifyFileName(const QString &fn); - void setLanguageAndCountry(QLocale::Language lang, QLocale::Country country); + bool setLanguageAndCountry(QLocale::Language lang, QLocale::Country country); QLocale::Language language() const { return m_language; } QLocale::Country country() const { return m_country; } void setSourceLanguageAndCountry(QLocale::Language lang, QLocale::Country country); diff --git a/tools/linguist/linguist/phrase.cpp b/tools/linguist/linguist/phrase.cpp index 563c72d..300f6e8 100644 --- a/tools/linguist/linguist/phrase.cpp +++ b/tools/linguist/linguist/phrase.cpp @@ -243,7 +243,7 @@ bool PhraseBook::load(const QString &fileName, bool *langGuessed) // don't click on these! reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), false); reader.setFeature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"), true); - reader.setFeature(QLatin1String("http://qtsoftware.com/xml/features/report-whitespace" + reader.setFeature(QLatin1String("http://trolltech.com/xml/features/report-whitespace" "-only-CharData"), false); QphHandler *hand = new QphHandler(this); reader.setContentHandler(hand); diff --git a/tools/linguist/linguist/phraseview.cpp b/tools/linguist/linguist/phraseview.cpp index 78c9151..72c27dc 100644 --- a/tools/linguist/linguist/phraseview.cpp +++ b/tools/linguist/linguist/phraseview.cpp @@ -135,7 +135,7 @@ void PhraseView::contextMenuEvent(QContextMenuEvent *event) void PhraseView::mouseDoubleClickEvent(QMouseEvent *event) { QModelIndex index = indexAt(event->pos()); - if (!index.isValid()) + if (!index.isValid()) return; emit phraseSelected(m_modelIndex, m_phraseModel->phrase(index)->target()); diff --git a/tools/linguist/linguist/translationsettingsdialog.h b/tools/linguist/linguist/translationsettingsdialog.h index 8a633d9..a7ed1b4 100644 --- a/tools/linguist/linguist/translationsettingsdialog.h +++ b/tools/linguist/linguist/translationsettingsdialog.h @@ -76,4 +76,4 @@ private: QT_END_NAMESPACE -#endif // TRANSLATIONSETTINGSDIALOG_H +#endif // TRANSLATIONSETTINGSDIALOG_H diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index f1fdb3a..3bcc998 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -94,19 +94,6 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo } else { if (!cd.errors().isEmpty()) printOut(cd.error()); - const QList<TranslatorMessage> dupes = tor.findDuplicates(); - if (!dupes.isEmpty()) { - qWarning("lrelease error: duplicate messages found in '%s':", - qPrintable(tsFileName)); - foreach (const TranslatorMessage &msg, dupes) { - qWarning("\n* Context: %s\n* Source: %s", - qPrintable(msg.context()), - qPrintable(msg.sourceText())); - if (!msg.comment().isEmpty()) - qWarning("\n* Comment: %s", qPrintable(msg.comment())); - } - ok = false; - } } return ok; } @@ -115,6 +102,8 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, bool verbose, bool ignoreUnfinished, bool removeIdentical, TranslatorSaveMode mode) { + Translator::reportDuplicates(tor.resolveDuplicates(), qmFileName, verbose); + if (verbose) printOut(QCoreApplication::tr( "Updating '%1'...\n").arg(qmFileName)); if (removeIdentical) { diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index e7865d5..b537b6e 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -73,7 +73,7 @@ static void recursiveFileInfoList(const QDir &dir, if (fname != QLatin1String(".") && fname != QLatin1String("..")) { if (it->isDir()) recursiveFileInfoList(QDir(it->absoluteFilePath()), nameFilters, filter, recursive, fileinfolist); - else + else fileinfolist->append(*it); } } @@ -146,6 +146,7 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil *fail = true; continue; } + tor.resolveDuplicates(); cd.clearErrors(); if (!codecForTr.isEmpty() && codecForTr != tor.codecName()) qWarning("lupdate warning: Codec for tr() '%s' disagrees with " diff --git a/tools/linguist/shared/cpp.cpp b/tools/linguist/shared/cpp.cpp index a7854d9..2e137cf 100644 --- a/tools/linguist/shared/cpp.cpp +++ b/tools/linguist/shared/cpp.cpp @@ -107,6 +107,7 @@ enum { static QString yyFileName; static int yyCh; static bool yyCodecIsUtf8; +static bool yyForceUtf8; static QString yyIdent; static QString yyComment; static QString yyString; @@ -129,12 +130,19 @@ static int yyInPos; static uint getChar() { - if (yyInPos >= yyInStr.size()) - return EOF; - QChar c = yyInStr[yyInPos++]; - if (c.unicode() == '\n') - ++yyCurLineNo; - return c.unicode(); + forever { + if (yyInPos >= yyInStr.size()) + return EOF; + uint c = yyInStr[yyInPos++].unicode(); + if (c == '\\' && yyInPos < yyInStr.size() && yyInStr[yyInPos].unicode() == '\n') { + ++yyCurLineNo; + ++yyInPos; + continue; + } + if (c == '\n') + ++yyCurLineNo; + return c; + } } static uint getToken() @@ -692,7 +700,7 @@ static void recordMessage( yyFileName, line, QStringList(), TranslatorMessage::Unfinished, plural); msg.setExtraComment(transcode(extracomment.simplified(), utf8)); - if (utf8 && !yyCodecIsUtf8 && msg.needs8Bit()) + if ((utf8 || yyForceUtf8) && !yyCodecIsUtf8 && msg.needs8Bit()) msg.setUtf8(true); tor->extend(msg); } @@ -783,7 +791,7 @@ static void parse(Translator *tor, const QString &initialContext, const QString if (yyTok == Tok_ColonColon) fullName.append(QString()); while (yyTok == Tok_ColonColon || yyTok == Tok_Ident) { - if (yyTok == Tok_Ident) + if (yyTok == Tok_Ident) fullName.append(yyIdent); yyTok = getToken(); } @@ -1007,6 +1015,9 @@ void fetchtrInlinedCpp(const QString &in, Translator &translator, const QString yyInStr = in; yyInPos = 0; yyFileName = QString(); + yyCodecIsUtf8 = (translator.codecName() == "UTF-8"); + yyForceUtf8 = true; + yySourceIsUnicode = true; yySavedBraceDepth.clear(); yySavedParenDepth.clear(); yyBraceDepth = 0; @@ -1025,6 +1036,7 @@ bool loadCPP(Translator &translator, QIODevice &dev, ConversionData &cd) QString defaultContext = cd.m_defaultContext; yyCodecIsUtf8 = (translator.codecName() == "UTF-8"); + yyForceUtf8 = false; QTextStream ts(&dev); QByteArray codecName = cd.m_codecForSource.isEmpty() ? translator.codecName() : cd.m_codecForSource; diff --git a/tools/linguist/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp index e2a6719..f3a29cc 100644 --- a/tools/linguist/shared/numerus.cpp +++ b/tools/linguist/shared/numerus.cpp @@ -104,7 +104,7 @@ static const uchar arabicRules[] = Q_MOD_100 | Q_BETWEEN, 3, 10, Q_NEWRULE, Q_MOD_100 | Q_NEQ, 0 }; -static const char * const japaneseStyleForms[] = { "Unique Form", 0 }; +static const char * const japaneseStyleForms[] = { "Universal Form", 0 }; static const char * const englishStyleForms[] = { "Singular", "Plural", 0 }; static const char * const frenchStyleForms[] = { "Singular", "Plural", 0 }; static const char * const latvianForms[] = { "Singular", "Plural", "Nullar", 0 }; diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index e9375e9..5842771 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -389,7 +389,7 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) for (; l != lines.size(); ++l) { QString line = lines.at(l); if (line.isEmpty()) - continue; + continue; if (isTranslationLine(line)) { bool isObsolete = line.startsWith(QLatin1String("#~ msgstr")); const QString prefix = QLatin1String(isObsolete ? "#~ " : ""); diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 1e91f92..5440752 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -157,11 +157,6 @@ ProFileEvaluator::Private::Private(ProFileEvaluator *q_) m_prevLineNo = 0; m_prevProFile = 0; m_verbose = true; - m_block = 0; - m_commentItem = 0; - m_syntaxError = 0; - m_lineNo = 0; - m_contNextLine = false; } bool ProFileEvaluator::Private::read(ProFile *pro) @@ -172,8 +167,12 @@ bool ProFileEvaluator::Private::read(ProFile *pro) return false; } + m_block = 0; + m_commentItem = 0; + m_contNextLine = false; m_syntaxError = false; m_lineNo = 1; + m_blockstack.clear(); m_blockstack.push(pro); QTextStream ts(&file); @@ -276,6 +275,9 @@ void ProFileEvaluator::Private::insertVariable(const QString &line, int *i) { ProVariable::VariableOperator opkind; + if (m_proitem.isEmpty()) // Line starting with '=', like a conflict marker + return; + switch (m_proitem.at(m_proitem.length() - 1).unicode()) { case '+': m_proitem.chop(1); @@ -711,7 +713,7 @@ QStringList ProFileEvaluator::Private::qmakeFeaturePaths() // if (!specdir.cdUp() || specdir.isRoot()) // break; // if (QFile::exists(specdir.path() + QDir::separator() + "features")) { - // foreach (const QString &concat_it, concat) + // foreach (const QString &concat_it, concat) // feature_roots << (specdir.path() + concat_it); // break; // } @@ -1002,9 +1004,10 @@ bool ProFileEvaluator::Private::isActiveConfig(const QString &config, bool regex QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &func, const QString &arguments) { QStringList argumentsList = split_arg_list(arguments); + QStringList args; for (int i = 0; i < argumentsList.count(); ++i) - args += expandVariableReferences(argumentsList[i]); + args += expandVariableReferences(argumentsList[i]).join(Option::field_sep); 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, @@ -1265,10 +1268,11 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct for (int mut = 0; mut < mutuals.count(); mut++) { if (configs[i] == mutuals[mut].trimmed()) { cond = (configs[i] == args[0]); - break; + goto done_T_CONFIG; } } } + done_T_CONFIG: break; } case CF_CONTAINS: { @@ -1295,12 +1299,12 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct for (int mut = 0; mut < mutuals.count(); mut++) { if (val == mutuals[mut].trimmed()) { cond = (regx.exactMatch(val) || val == args[1]); - break; + goto done_T_CONTAINS; } } } } - + done_T_CONTAINS: break; } case CF_COUNT: { @@ -1373,7 +1377,7 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct parents.append(proFile->fileName()); if (!parents.isEmpty()) parents.takeLast(); - if (parents.isEmpty()) + if (parents.isEmpty()) q->fileMessage(format("Project ERROR: %1").arg(msg)); else q->fileMessage(format("Project ERROR: %1. File was included from: '%2'") @@ -1472,7 +1476,13 @@ ProFile *ProFileEvaluator::parsedProFile(const QString &fileName) { QFileInfo fi(fileName); if (fi.exists()) { - ProFile *pro = new ProFile(fi.absoluteFilePath()); + QString fn = QDir::cleanPath(fi.absoluteFilePath()); + foreach (const ProFile *pf, d->m_profileStack) + if (pf->fileName() == fn) { + errorMessage(d->format("circular inclusion of %1").arg(fn)); + return 0; + } + ProFile *pro = new ProFile(fn); if (d->read(pro)) return pro; delete pro; diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index c197e2b..5563ac5 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -103,6 +103,43 @@ static uint elfHash(const QByteArray &ba) return h; } +class ByteTranslatorMessage +{ +public: + ByteTranslatorMessage( + const QByteArray &context, + const QByteArray &sourceText, + const QByteArray &comment, + const QStringList &translations) : + m_context(context), + m_sourcetext(sourceText), + m_comment(comment), + m_translations(translations) + {} + const QByteArray &context() const { return m_context; } + const QByteArray &sourceText() const { return m_sourcetext; } + const QByteArray &comment() const { return m_comment; } + const QStringList &translations() const { return m_translations; } + bool operator<(const ByteTranslatorMessage& m) const; + +private: + QByteArray m_context; + QByteArray m_sourcetext; + QByteArray m_comment; + QStringList m_translations; +}; + +Q_DECLARE_TYPEINFO(ByteTranslatorMessage, Q_MOVABLE_TYPE); + +bool ByteTranslatorMessage::operator<(const ByteTranslatorMessage& m) const +{ + if (m_context != m.m_context) + return m_context < m.m_context; + if (m_sourcetext != m.m_sourcetext) + return m_sourcetext < m.m_sourcetext; + return m_comment < m.m_comment; +} + class Releaser { public: @@ -133,27 +170,12 @@ public: m_codec = QTextCodec::codecForName(codecName); } - TranslatorMessage findMessage(const QString &context, - const QString &sourceText, const QString &comment, - const QString &fileName = QString(), int lineNumber = -1) const; - bool save(QIODevice *iod); - void insert(const TranslatorMessage &); - void remove(const TranslatorMessage &); - - bool contains(const QString &context, const QString &sourceText, - const QString & comment) const; - - bool contains(const QString &context, const QString &comment, - const QString &fileName, int lineNumber) const; + void insert(const TranslatorMessage &msg, bool forceComment); void squeeze(TranslatorSaveMode mode); - QList<TranslatorMessage> messages() const; - - bool isEmpty() const; - void setNumerusRules(const QByteArray &rules); private: @@ -163,18 +185,20 @@ private: // on turn should be the same as passed to the actual tr(...) calls QByteArray originalBytes(const QString &str, bool isUtf8) const; - Prefix commonPrefix(const TranslatorMessage &m1, const TranslatorMessage &m2) const; + void insertInternal(const TranslatorMessage &message, bool forceComment, bool isUtf8); + + static Prefix commonPrefix(const ByteTranslatorMessage &m1, const ByteTranslatorMessage &m2); - uint msgHash(const TranslatorMessage &msg) const; + static uint msgHash(const ByteTranslatorMessage &msg); - void writeMessage(const TranslatorMessage & msg, QDataStream & stream, + void writeMessage(const ByteTranslatorMessage & msg, QDataStream & stream, TranslatorSaveMode strip, Prefix prefix) const; // for squeezed but non-file data, this is what needs to be deleted QByteArray m_messageArray; QByteArray m_offsetArray; QByteArray m_contextArray; - QMap<TranslatorMessage, void *> m_messages; + QMap<ByteTranslatorMessage, void *> m_messages; QByteArray m_numerusRules; // Used to reproduce the original bytes @@ -193,12 +217,12 @@ QByteArray Releaser::originalBytes(const QString &str, bool isUtf8) const return m_codec ? m_codec->fromUnicode(str) : str.toLatin1(); } -uint Releaser::msgHash(const TranslatorMessage &msg) const +uint Releaser::msgHash(const ByteTranslatorMessage &msg) { - return elfHash(originalBytes(msg.sourceText() + msg.comment(), msg.isUtf8())); + return elfHash(msg.sourceText() + msg.comment()); } -Prefix Releaser::commonPrefix(const TranslatorMessage &m1, const TranslatorMessage &m2) const +Prefix Releaser::commonPrefix(const ByteTranslatorMessage &m1, const ByteTranslatorMessage &m2) { if (msgHash(m1) != msgHash(m2)) return NoPrefix; @@ -211,7 +235,7 @@ Prefix Releaser::commonPrefix(const TranslatorMessage &m1, const TranslatorMessa return HashContextSourceTextComment; } -void Releaser::writeMessage(const TranslatorMessage & msg, QDataStream & stream, +void Releaser::writeMessage(const ByteTranslatorMessage &msg, QDataStream &stream, TranslatorSaveMode mode, Prefix prefix) const { for (int i = 0; i < msg.translations().count(); ++i) { @@ -228,14 +252,14 @@ void Releaser::writeMessage(const TranslatorMessage & msg, QDataStream & stream, switch (prefix) { default: case HashContextSourceTextComment: - stream << quint8(Tag_Comment) << originalBytes(msg.comment(), msg.isUtf8()); + stream << quint8(Tag_Comment) << msg.comment(); // fall through case HashContextSourceText: - stream << quint8(Tag_SourceText) << originalBytes(msg.sourceText(), msg.isUtf8()); + stream << quint8(Tag_SourceText) << msg.sourceText(); // fall through case HashContext: - stream << quint8(Tag_Context) << originalBytes(msg.context(), msg.isUtf8()); - ; + stream << quint8(Tag_Context) << msg.context(); + break; } stream << quint8(Tag_End); @@ -275,7 +299,7 @@ void Releaser::squeeze(TranslatorSaveMode mode) if (m_messages.isEmpty() && mode == SaveEverything) return; - QMap<TranslatorMessage, void *> messages = m_messages; + QMap<ByteTranslatorMessage, void *> messages = m_messages; // re-build contents m_messageArray.clear(); @@ -286,7 +310,7 @@ void Releaser::squeeze(TranslatorSaveMode mode) QMap<Offset, void *> offsets; QDataStream ms(&m_messageArray, QIODevice::WriteOnly); - QMap<TranslatorMessage, void *>::const_iterator it, next; + QMap<ByteTranslatorMessage, void *>::const_iterator it, next; int cpPrev = 0, cpNext = 0; for (it = messages.constBegin(); it != messages.constEnd(); ++it) { cpPrev = cpNext; @@ -310,7 +334,7 @@ void Releaser::squeeze(TranslatorSaveMode mode) } if (mode == SaveStripped) { - QMap<QString, int> contextSet; + QMap<QByteArray, int> contextSet; for (it = messages.constBegin(); it != messages.constEnd(); ++it) ++contextSet[it.key().context()]; @@ -322,10 +346,10 @@ void Releaser::squeeze(TranslatorSaveMode mode) else hTableSize = (contextSet.size() < 10000) ? 15013 : 3 * contextSet.size() / 2; - QMultiMap<int, QString> hashMap; - QMap<QString, int>::const_iterator c; + QMultiMap<int, QByteArray> hashMap; + QMap<QByteArray, int>::const_iterator c; for (c = contextSet.constBegin(); c != contextSet.constEnd(); ++c) - hashMap.insert(elfHash(originalBytes(c.key(), false /*FIXME*/)) % hTableSize, c.key()); + hashMap.insert(elfHash(c.key()) % hTableSize, c.key()); /* The contexts found in this translator are stored in a hash @@ -360,16 +384,14 @@ void Releaser::squeeze(TranslatorSaveMode mode) t << quint16(0); // the entry at offset 0 cannot be used uint upto = 2; - QMap<int, QString>::const_iterator entry = hashMap.constBegin(); + QMap<int, QByteArray>::const_iterator entry = hashMap.constBegin(); while (entry != hashMap.constEnd()) { int i = entry.key(); hTable[i] = quint16(upto >> 1); do { - QString context = entry.value(); - QByteArray ba = context.toUtf8(); - const char *con = ba.data(); - uint len = uint(qstrlen(con)); + const char *con = entry.value().constData(); + uint len = uint(entry.value().length()); len = qMin(len, 255u); t << quint8(len); t.writeRawData(con, len); @@ -394,68 +416,28 @@ void Releaser::squeeze(TranslatorSaveMode mode) } } -bool Releaser::contains(const QString &context, const QString &sourceText, - const QString &comment) const -{ - return !findMessage(context, sourceText, comment).translation().isNull(); -} - -bool Releaser::contains(const QString &context, const QString &comment, - const QString &fileName, int lineNumber) const -{ - return !findMessage(context, QString(), comment, fileName, lineNumber).isNull(); -} - -void Releaser::insert(const TranslatorMessage &message) -{ - m_messages.insert(message, 0); -} - -void Releaser::remove(const TranslatorMessage &message) +void Releaser::insertInternal(const TranslatorMessage &message, bool forceComment, bool isUtf8) { - m_messages.remove(message); -} - - -TranslatorMessage Releaser::findMessage(const QString &context, - const QString &sourceText, const QString &comment, - const QString &fileName, int lineNumber) const -{ - if (m_messages.isEmpty()) - return TranslatorMessage(); - - QMap<TranslatorMessage, void *>::const_iterator it; - - // Either we want to find an item that matches context, sourcetext - // (and optionally comment) Or we want to find an item that - // matches context, filename, linenumber (and optionally comment) - TranslatorMessage msg(context, sourceText, comment, QString(), fileName, lineNumber); - it = m_messages.constFind(msg); - if (it != m_messages.constEnd()) - return it.key(); - - if (!comment.isEmpty()) { - it = m_messages.constFind(TranslatorMessage(context, sourceText, QString(), QString(), fileName, lineNumber)); - if (it != m_messages.constEnd()) - return it.key(); + ByteTranslatorMessage bmsg(originalBytes(message.context(), isUtf8), + originalBytes(message.sourceText(), isUtf8), + originalBytes(message.comment(), isUtf8), + message.translations()); + if (!forceComment) { + ByteTranslatorMessage bmsg2( + bmsg.context(), bmsg.sourceText(), QByteArray(""), bmsg.translations()); + if (!m_messages.contains(bmsg2)) { + m_messages.insert(bmsg2, 0); + return; + } } - - it = m_messages.constFind(TranslatorMessage(context, QString(), comment, QString(), fileName, lineNumber)); - if (it != m_messages.constEnd()) - return it.key(); - if (comment.isEmpty()) - return TranslatorMessage(); - - it = m_messages.constFind(TranslatorMessage(context, QString(), QString(), QString(), fileName, lineNumber)); - if (it != m_messages.constEnd()) - return it.key(); - return TranslatorMessage(); + m_messages.insert(bmsg, 0); } -bool Releaser::isEmpty() const +void Releaser::insert(const TranslatorMessage &message, bool forceComment) { - return m_messageArray.isEmpty() && m_offsetArray.isEmpty() - && m_contextArray.isEmpty() && m_messages.isEmpty(); + insertInternal(message, forceComment, message.isUtf8()); + if (message.isUtf8() && message.isNonUtf8()) + insertInternal(message, forceComment, false); } void Releaser::setNumerusRules(const QByteArray &rules) @@ -463,11 +445,6 @@ void Releaser::setNumerusRules(const QByteArray &rules) m_numerusRules = rules; } -QList<TranslatorMessage> Releaser::messages() const -{ - return m_messages.keys(); -} - static quint8 read8(const uchar *data) { return *data; @@ -478,6 +455,31 @@ static quint32 read32(const uchar *data) return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3]); } +static void fromBytes(const char *str, int len, QTextCodec *codec, QTextCodec *utf8Codec, + QString *out, QString *utf8Out, + bool *isSystem, bool *isUtf8, bool *needs8Bit) +{ + for (int i = 0; i < len; ++i) + if (str[i] & 0x80) { + if (utf8Codec) { + QTextCodec::ConverterState cvtState; + *utf8Out = utf8Codec->toUnicode(str, len, &cvtState); + *isUtf8 = !cvtState.invalidChars; + } + QTextCodec::ConverterState cvtState; + *out = codec->toUnicode(str, len, &cvtState); + *isSystem = !cvtState.invalidChars; + *needs8Bit = true; + return; + } + *out = QString::fromLatin1(str, len); + *isSystem = true; + if (utf8Codec) { + *utf8Out = *out; + *isUtf8 = true; + } + *needs8Bit = false; +} bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) { @@ -543,10 +545,19 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) size_t numItems = offsetLength / (2 * sizeof(quint32)); //qDebug() << "NUMITEMS: " << numItems; - TranslatorMessage msg; - // FIXME: that's just a guess, the original locale data is lost... QTextCodec *codec = QTextCodec::codecForLocale(); + QTextCodec *utf8Codec = 0; + if (codec->name() != "UTF-8") + utf8Codec = QTextCodec::codecForName("UTF-8"); + + QString context, contextUtf8; + bool contextIsSystem, contextIsUtf8, contextNeeds8Bit; + QString sourcetext, sourcetextUtf8; + bool sourcetextIsSystem, sourcetextIsUtf8, sourcetextNeeds8Bit; + QString comment, commentUtf8; + bool commentIsSystem, commentIsUtf8, commentNeeds8Bit; + QStringList translations; for (const uchar *start = offsetArray; start != offsetArray + (numItems << 3); start += 8) { //quint32 hash = read32(start); @@ -575,7 +586,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) } str.replace(QChar(Translator::InternalVariantSeparator), QChar(Translator::DefaultVariantSeparator)); - msg.appendTranslation(str); + translations << str; m += len; break; } @@ -588,7 +599,9 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) m += 4; //qDebug() << "SOURCE LEN: " << len; //qDebug() << "SOURCE: " << QByteArray((const char*)m, len); - msg.setSourceText(codec->toUnicode(QByteArray((const char*)m, len))); + fromBytes((const char*)m, len, codec, utf8Codec, + &sourcetext, &sourcetextUtf8, + &sourcetextIsSystem, &sourcetextIsUtf8, &sourcetextNeeds8Bit); m += len; break; } @@ -597,7 +610,9 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) m += 4; //qDebug() << "CONTEXT LEN: " << len; //qDebug() << "CONTEXT: " << QByteArray((const char*)m, len); - msg.setContext(codec->toUnicode(QByteArray((const char*)m, len))); + fromBytes((const char*)m, len, codec, utf8Codec, + &context, &contextUtf8, + &contextIsSystem, &contextIsUtf8, &contextNeeds8Bit); m += len; break; } @@ -606,7 +621,9 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) m += 4; //qDebug() << "COMMENT LEN: " << len; //qDebug() << "COMMENT: " << QByteArray((const char*)m, len); - msg.setComment(codec->toUnicode(QByteArray((const char*)m, len))); + fromBytes((const char*)m, len, codec, utf8Codec, + &comment, &commentUtf8, + &commentIsSystem, &commentIsUtf8, &commentNeeds8Bit); m += len; break; } @@ -616,10 +633,31 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) } } end:; + TranslatorMessage msg; msg.setType(TranslatorMessage::Finished); + msg.setTranslations(translations); + translations.clear(); + if (contextNeeds8Bit || sourcetextNeeds8Bit || commentNeeds8Bit) { + if (utf8Codec && contextIsUtf8 && sourcetextIsUtf8 && commentIsUtf8) { + // The message is utf-8, but file is not. + msg.setUtf8(true); + msg.setContext(contextUtf8); + msg.setSourceText(sourcetextUtf8); + msg.setComment(commentUtf8); + translator.append(msg); + continue; + } + if (!(contextIsSystem && sourcetextIsSystem && commentIsSystem)) { + cd.appendError(QLatin1String( + "Cannot read file with current system character codec")); + return false; + } + // The message is 8-bit in the file's encoding (utf-8 or not). + } + msg.setContext(context); + msg.setSourceText(sourcetext); + msg.setComment(comment); translator.append(msg); - //qDebug() << "\nHASH:" << hash << msg.sourceText() << msg.context(); - msg.setTranslations(QStringList()); } return ok; } @@ -646,39 +684,27 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData TranslatorMessage::Type typ = msg.type(); if (typ != TranslatorMessage::Obsolete) { if (typ == TranslatorMessage::Unfinished) { - if (msg.translation().isEmpty()) + if (msg.translation().isEmpty()) { ++untranslated; - else + continue; + } else { + if (cd.ignoreUnfinished()) + continue; ++unfinished; + } } else { ++finished; } - QString context = msg.context(); - QString sourceText = msg.sourceText(); - QString comment = msg.comment(); - QStringList translations = msg.translations(); - - if (!cd.ignoreUnfinished() || typ != TranslatorMessage::Unfinished) { - /* - Drop the comment in (context, sourceText, comment), - unless the context is empty, - unless (context, sourceText, "") already exists or - unless we already dropped the comment of (context, - sourceText, comment0). - */ - if (comment.isEmpty() - || context.isEmpty() - || translator.contains(context, sourceText, QString()) - || !releaser.findMessage(context, sourceText, QString()).translation() - .isNull() ) { - releaser.insert(msg); - } else { - TranslatorMessage tm(context, sourceText, QString(), - QString(), QString(), -1, translations); - //filename and lineNumbers will be ignored from now. - releaser.insert(tm); - } - } + // Drop the comment in (context, sourceText, comment), + // unless the context is empty, + // unless (context, sourceText, "") already exists or + // unless we already dropped the comment of (context, + // sourceText, comment0). + bool forceComment = + msg.comment().isEmpty() + || msg.context().isEmpty() + || translator.contains(msg.context(), msg.sourceText(), QString()); + releaser.insert(msg, forceComment); } } diff --git a/tools/linguist/shared/qph.cpp b/tools/linguist/shared/qph.cpp index 45d3a20..799bf7d 100644 --- a/tools/linguist/shared/qph.cpp +++ b/tools/linguist/shared/qph.cpp @@ -101,7 +101,7 @@ bool QPHReader::read(Translator &translator) m_currentField = TargetField; else if (name() == QLatin1String("definition")) m_currentField = DefinitionField; - else + else m_currentField = NoField; } else if (isWhiteSpace()) { // ignore these @@ -133,14 +133,47 @@ static bool loadQPH(Translator &translator, QIODevice &dev, ConversionData &cd) return reader.read(translator); } -static bool saveQPH(const Translator &translator, QIODevice &dev, ConversionData &cd) +static QString protect(const QString &str) +{ + QString result; + result.reserve(str.length() * 12 / 10); + for (int i = 0; i != str.size(); ++i) { + uint c = str.at(i).unicode(); + switch (c) { + case '\"': + result += QLatin1String("""); + break; + case '&': + result += QLatin1String("&"); + break; + case '>': + result += QLatin1String(">"); + break; + case '<': + result += QLatin1String("<"); + break; + case '\'': + result += QLatin1String("'"); + break; + default: + if (c < 0x20 && c != '\r' && c != '\n' && c != '\t') + result += QString(QLatin1String("&#%1;")).arg(c); + else // this also covers surrogates + result += QChar(c); + } + } + return result; +} + +static bool saveQPH(const Translator &translator, QIODevice &dev, ConversionData &) { QTextStream t(&dev); - t << "<!DOCTYPE QPH><QPH>\n"; + t.setCodec(QTextCodec::codecForName("UTF-8")); + t << "<!DOCTYPE QPH>\n<QPH>\n"; foreach (const TranslatorMessage &msg, translator.messages()) { t << "<phrase>\n"; - t << " <source>" << msg.sourceText() << "</source>\n"; - t << " <target>" << msg.translations().join(QLatin1String("@")) + t << " <source>" << protect(msg.sourceText()) << "</source>\n"; + t << " <target>" << protect(msg.translations().join(QLatin1String("@"))) << "</target>\n"; if (!msg.context().isEmpty() || !msg.comment().isEmpty()) t << " <definition>" << msg.context() << msg.comment() diff --git a/tools/linguist/shared/qscript.cpp b/tools/linguist/shared/qscript.cpp index 9ab5e16..7377cba 100644 --- a/tools/linguist/shared/qscript.cpp +++ b/tools/linguist/shared/qscript.cpp @@ -2382,7 +2382,7 @@ bool loadQScript(Translator &translator, QIODevice &dev, ConversionData &cd) return true; } -bool saveQScript(const Translator &translator, QIODevice &dev, ConversionData &cd) +bool saveQScript(const Translator &translator, QIODevice &dev, ConversionData &cd) { Q_UNUSED(dev); Q_UNUSED(translator); diff --git a/tools/linguist/shared/qscript.g b/tools/linguist/shared/qscript.g index c7ee80d..8d33277 100644 --- a/tools/linguist/shared/qscript.g +++ b/tools/linguist/shared/qscript.g @@ -2012,7 +2012,7 @@ bool loadQScript(Translator &translator, QIODevice &dev, ConversionData &cd) return true; } -bool saveQScript(const Translator &translator, QIODevice &dev, ConversionData &cd) +bool saveQScript(const Translator &translator, QIODevice &dev, ConversionData &cd) { Q_UNUSED(dev); Q_UNUSED(translator); diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index a5cb4d0..312bb71 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -105,13 +105,18 @@ void Translator::extend(const TranslatorMessage &msg) if (index == -1) { m_messages.append(msg); } else { - m_messages[index].addReferenceUniq(msg.fileName(), msg.lineNumber()); + TranslatorMessage &emsg = m_messages[index]; + emsg.addReferenceUniq(msg.fileName(), msg.lineNumber()); if (!msg.extraComment().isEmpty()) { - QString cmt = m_messages[index].extraComment(); + QString cmt = emsg.extraComment(); if (!cmt.isEmpty()) cmt.append(QLatin1String("\n----------\n")); cmt.append(msg.extraComment()); - m_messages[index].setExtraComment(cmt); + emsg.setExtraComment(cmt); + } + if (msg.isUtf8() != emsg.isUtf8()) { + emsg.setUtf8(true); + emsg.setNonUtf8(true); } } } @@ -259,7 +264,7 @@ bool Translator::save(const QString &filename, ConversionData &cd, const QString if (fmt == format.extension) { if (format.saver) return (*format.saver)(*this, file, cd); - cd.appendError(QString(QLatin1String("Cannit save %1 files")).arg(fmt)); + cd.appendError(QString(QLatin1String("Cannot save %1 files")).arg(fmt)); return false; } } @@ -411,17 +416,53 @@ void Translator::dropTranslations() } } -QList<TranslatorMessage> Translator::findDuplicates() const +QSet<TranslatorMessagePtr> Translator::resolveDuplicates() +{ + QSet<TranslatorMessagePtr> dups; + QHash<TranslatorMessagePtr, int> refs; + for (int i = 0; i < m_messages.count();) { + const TranslatorMessage &msg = m_messages.at(i); + QHash<TranslatorMessagePtr, int>::ConstIterator it = refs.constFind(msg); + if (it != refs.constEnd()) { + TranslatorMessage &omsg = m_messages[*it]; + if (omsg.isUtf8() != msg.isUtf8() && !omsg.isNonUtf8()) { + // Dual-encoded message + omsg.setUtf8(true); + omsg.setNonUtf8(true); + } else { + // Duplicate + dups.insert(omsg); + } + if (!omsg.isTranslated() && msg.isTranslated()) + omsg.setTranslations(msg.translations()); + m_messages.removeAt(i); + } else { + refs[msg] = i; + ++i; + } + } + return dups; +} + +void Translator::reportDuplicates(const QSet<TranslatorMessagePtr> &dupes, + const QString &fileName, bool verbose) { - QHash<TranslatorMessage, int> dups; - foreach (const TranslatorMessage &msg, m_messages) - dups[msg]++; - QList<TranslatorMessage> ret; - QHash<TranslatorMessage, int>::ConstIterator it = dups.constBegin(), end = dups.constEnd(); - for (; it != end; ++it) - if (it.value() > 1) - ret.append(it.key()); - return ret; + if (!dupes.isEmpty()) { + if (!verbose) { + qWarning("Warning: dropping duplicate messages in '%s'\n(try -verbose for more info).", + qPrintable(fileName)); + } else { + qWarning("Warning: dropping duplicate messages in '%s':", qPrintable(fileName)); + foreach (const TranslatorMessagePtr &msg, dupes) { + qWarning("\n* Context: %s\n* Source: %s", + qPrintable(msg->context()), + qPrintable(msg->sourceText())); + if (!msg->comment().isEmpty()) + qWarning("* Comment: %s", qPrintable(msg->comment())); + } + qWarning(); + } + } } // Used by lupdate to be able to search using absolute paths during merging @@ -464,8 +505,8 @@ QStringList Translator::normalizedTranslations(const TranslatorMessage &msg, int numTranslations = 1; if (msg.isPlural() && language != QLocale::C) { QStringList forms; - getNumerusInfo(language, country, 0, &forms); - numTranslations = forms.count(); // includes singular + if (getNumerusInfo(language, country, 0, &forms)) + numTranslations = forms.count(); // includes singular } // make sure that the stringlist always have the size of the @@ -544,7 +585,7 @@ void Translator::setCodecName(const QByteArray &name) if (!codec) { if (!name.isEmpty()) qWarning("No QTextCodec for %s available. Using Latin1\n", name.constData()); - m_codecName.clear(); + m_codecName = "ISO-8859-1"; } else { m_codecName = codec->name(); } diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index f4279da..6b88b23 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE -Q_DECLARE_TYPEINFO(TranslatorMessage, Q_MOVABLE_TYPE); - class QIODevice; // A struct of "interesting" data passed to and from the load and save routines @@ -88,7 +86,7 @@ public: QString m_targetFileName; QDir m_sourceDir; QDir m_targetDir; // FIXME: TS spefic - QStringList m_dropTags; // tags to be dropped + QStringList m_dropTags; // tags to be dropped QStringList m_errors; bool m_verbose; bool m_ignoreUnfinished; @@ -129,8 +127,10 @@ public: void stripNonPluralForms(); void stripIdenticalSourceTranslations(); void dropTranslations(); - QList<TranslatorMessage> findDuplicates() const; void makeFileNamesAbsolute(const QDir &originalPath); + QSet<TranslatorMessagePtr> resolveDuplicates(); + static void reportDuplicates(const QSet<TranslatorMessagePtr> &dupes, + const QString &fileName, bool verbose); void setCodecName(const QByteArray &name); QByteArray codecName() const { return m_codecName; } diff --git a/tools/linguist/shared/translatormessage.cpp b/tools/linguist/shared/translatormessage.cpp index ab4301f..afe66fe 100644 --- a/tools/linguist/shared/translatormessage.cpp +++ b/tools/linguist/shared/translatormessage.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE TranslatorMessage::TranslatorMessage() - : m_lineNumber(-1), m_type(Unfinished), m_utf8(false), m_plural(false) + : m_lineNumber(-1), m_type(Unfinished), m_utf8(false), m_nonUtf8(false), m_plural(false) { } @@ -66,7 +66,7 @@ TranslatorMessage::TranslatorMessage(const QString &context, : m_context(context), m_sourcetext(sourceText), m_comment(comment), m_userData(userData), m_translations(translations), m_fileName(fileName), m_lineNumber(lineNumber), - m_type(type), m_utf8(false), m_plural(plural) + m_type(type), m_utf8(false), m_nonUtf8(false), m_plural(plural) { } diff --git a/tools/linguist/shared/translatormessage.h b/tools/linguist/shared/translatormessage.h index fa37ff5..9f847b0 100644 --- a/tools/linguist/shared/translatormessage.h +++ b/tools/linguist/shared/translatormessage.h @@ -136,6 +136,8 @@ public: void setType(Type t) { m_type = t; } bool isUtf8() const { return m_utf8; } // codecForTr override void setUtf8(bool on) { m_utf8 = on; } + bool isNonUtf8() const { return m_nonUtf8; } // codecForTr override + void setNonUtf8(bool on) { m_nonUtf8 = on; } bool isPlural() const { return m_plural; } void setPlural(bool isplural) { m_plural = isplural; } @@ -169,11 +171,40 @@ private: Type m_type; bool m_utf8; + bool m_nonUtf8; bool m_plural; }; +Q_DECLARE_TYPEINFO(TranslatorMessage, Q_MOVABLE_TYPE); + int qHash(const TranslatorMessage &msg); +struct TranslatorMessagePtr { + TranslatorMessagePtr(const TranslatorMessage &tm) + { + ptr = &tm; + } + + inline const TranslatorMessage *operator->() const + { + return ptr; + } + + const TranslatorMessage *ptr; +}; + +Q_DECLARE_TYPEINFO(TranslatorMessagePtr, Q_MOVABLE_TYPE); + +inline int qHash(TranslatorMessagePtr tmp) +{ + return qHash(*tmp.ptr); +} + +inline bool operator==(TranslatorMessagePtr tmp1, TranslatorMessagePtr tmp2) +{ + return *tmp1.ptr == *tmp2.ptr; +} + QT_END_NAMESPACE #endif // QT_NO_TRANSLATION diff --git a/tools/linguist/shared/translatortools.cpp b/tools/linguist/shared/translatortools.cpp index dcff546..96301d5 100644 --- a/tools/linguist/shared/translatortools.cpp +++ b/tools/linguist/shared/translatortools.cpp @@ -69,7 +69,7 @@ static int numberLength(const QString &s, int i) int pos = i; do { ++i; - } while (i < s.size() + } while (i < s.size() && (s.at(i).isDigit() || (isDigitFriendly(s[i]) && i + 1 < s.size() @@ -445,7 +445,7 @@ Translator merge(const Translator &tor, const Translator &virginTor, if (mv.sourceText().isEmpty()) { if (tor.contains(mv.context())) continue; - } else { + } else { if (tor.contains(mv.context(), mv.sourceText(), mv.comment())) continue; if (options & HeuristicSimilarText) { diff --git a/tools/linguist/shared/ts.cpp b/tools/linguist/shared/ts.cpp index 2e7d40f..22f2a1b 100644 --- a/tools/linguist/shared/ts.cpp +++ b/tools/linguist/shared/ts.cpp @@ -212,6 +212,7 @@ QString TSReader::readTransContents() bool TSReader::read(Translator &translator) { + STRING(both); STRING(byte); STRING(comment); STRING(context); @@ -241,7 +242,7 @@ bool TSReader::read(Translator &translator) STRING(userdata); STRING(utf8); STRING(value); - STRING(version); + //STRING(version); STRING(yes); static const QString strextrans(QLatin1String("extra-")); @@ -277,7 +278,9 @@ bool TSReader::read(Translator &translator) // ignore these, just whitespace } else if (elementStarts(strdefaultcodec)) { // <defaultcodec> - translator.setCodecName(readElementText().toLatin1()); + const QString &codec = readElementText(); + if (!codec.isEmpty()) + translator.setCodecName(codec.toLatin1()); // </defaultcodec> } else if (isStartElement() && name().toString().startsWith(strextrans)) { @@ -309,7 +312,9 @@ bool TSReader::read(Translator &translator) msg.setContext(context); msg.setType(TranslatorMessage::Finished); msg.setPlural(attributes().value(strnumerus) == stryes); - msg.setUtf8(attributes().value(strutf8) == strtrue + const QStringRef &utf8Attr = attributes().value(strutf8); + msg.setNonUtf8(utf8Attr == strboth); + msg.setUtf8(msg.isNonUtf8() || utf8Attr == strtrue || attributes().value(strencoding) == strUtf8); while (!atEnd()) { readNext(); @@ -373,7 +378,7 @@ bool TSReader::read(Translator &translator) } else if (elementStarts(strtranslation)) { // <translation> QXmlStreamAttributes atts = attributes(); - QStringRef type = atts.value(strtype); + QStringRef type = atts.value(strtype); if (type == strunfinished) msg.setType(TranslatorMessage::Unfinished); else if (type == strobsolete) @@ -440,7 +445,7 @@ static QString protect(const QString &str) QString result; result.reserve(str.length() * 12 / 10); for (int i = 0; i != str.size(); ++i) { - uint c = str.at(i).unicode(); + uint c = str.at(i).unicode(); switch (c) { case '\"': result += QLatin1String("""); @@ -592,107 +597,126 @@ bool saveTS(const Translator &translator, QIODevice &dev, ConversionData &cd, in foreach (const TranslatorMessage &msg, messageOrder[context]) { //msg.dump(); - t << " <message"; - if (!msg.id().isEmpty()) - t << " id=\"" << msg.id() << "\""; - if (format == 11 && !trIsUtf8 && msg.isUtf8()) - t << " encoding=\"UTF-8\""; - if (format == 20 && !trIsUtf8 && msg.isUtf8()) - t << " utf8=\"true\""; - if (msg.isPlural()) - t << " numerus=\"yes\""; - t << ">\n"; - if (translator.locationsType() != Translator::NoLocations) { - QString cfile = currentFile; - bool first = true; - foreach (const TranslatorMessage::Reference &ref, msg.allReferences()) { - QString fn = cd.m_targetDir.relativeFilePath(ref.fileName()) - .replace(QLatin1Char('\\'),QLatin1Char('/')); - int ln = ref.lineNumber(); - QString ld; - if (translator.locationsType() == Translator::RelativeLocations) { - if (ln != -1) { - int dlt = ln - currentLine[fn]; - if (dlt >= 0) - ld.append(QLatin1Char('+')); - ld.append(QString::number(dlt)); - currentLine[fn] = ln; + bool isUtf8 = msg.isUtf8(); + bool second = false; + forever { + + t << " <message"; + if (!msg.id().isEmpty()) + t << " id=\"" << msg.id() << "\""; + if (!trIsUtf8) { + if (format == 11) { + if (isUtf8) + t << " encoding=\"UTF-8\""; + } else { + if (msg.isUtf8()) { + if (msg.isNonUtf8()) + t << " utf8=\"both\""; + else + t << " utf8=\"true\""; } + } + } + if (msg.isPlural()) + t << " numerus=\"yes\""; + t << ">\n"; + if (translator.locationsType() != Translator::NoLocations) { + QString cfile = currentFile; + bool first = true; + foreach (const TranslatorMessage::Reference &ref, msg.allReferences()) { + QString fn = cd.m_targetDir.relativeFilePath(ref.fileName()) + .replace(QLatin1Char('\\'),QLatin1Char('/')); + int ln = ref.lineNumber(); + QString ld; + if (translator.locationsType() == Translator::RelativeLocations) { + if (ln != -1) { + int dlt = ln - currentLine[fn]; + if (dlt >= 0) + ld.append(QLatin1Char('+')); + ld.append(QString::number(dlt)); + currentLine[fn] = ln; + } - if (fn != cfile) { - if (first) - currentFile = fn; - cfile = fn; + if (fn != cfile) { + if (first) + currentFile = fn; + cfile = fn; + } else { + fn.clear(); + } + first = false; } else { - fn.clear(); + if (ln != -1) + ld = QString::number(ln); } - first = false; - } else { - if (ln != -1) - ld = QString::number(ln); + t << " <location"; + if (!fn.isEmpty()) + t << " filename=\"" << fn << "\""; + if (!ld.isEmpty()) + t << " line=\"" << ld << "\""; + t << "/>\n"; } - t << " <location"; - if (!fn.isEmpty()) - t << " filename=\"" << fn << "\""; - if (!ld.isEmpty()) - t << " line=\"" << ld << "\""; - t << "/>\n"; } - } - t << " <source>" - << evilBytes(msg.sourceText(), msg.isUtf8(), format, codecName) - << "</source>\n"; + t << " <source>" + << evilBytes(msg.sourceText(), isUtf8, format, codecName) + << "</source>\n"; - if (format != 11 && !msg.oldSourceText().isEmpty()) - t << " <oldsource>" << protect(msg.oldSourceText()) << "</oldsource>\n"; + if (format != 11 && !msg.oldSourceText().isEmpty()) + t << " <oldsource>" << protect(msg.oldSourceText()) << "</oldsource>\n"; - if (!msg.comment().isEmpty()) { - t << " <comment>" - << evilBytes(msg.comment(), msg.isUtf8(), format, codecName) - << "</comment>\n"; - } + if (!msg.comment().isEmpty()) { + t << " <comment>" + << evilBytes(msg.comment(), isUtf8, format, codecName) + << "</comment>\n"; + } - if (format != 11) { + if (format != 11) { - if (!msg.oldComment().isEmpty()) - t << " <oldcomment>" << protect(msg.oldComment()) << "</oldcomment>\n"; + if (!msg.oldComment().isEmpty()) + t << " <oldcomment>" << protect(msg.oldComment()) << "</oldcomment>\n"; - if (!msg.extraComment().isEmpty()) - t << " <extracomment>" << protect(msg.extraComment()) - << "</extracomment>\n"; + if (!msg.extraComment().isEmpty()) + t << " <extracomment>" << protect(msg.extraComment()) + << "</extracomment>\n"; - if (!msg.translatorComment().isEmpty()) - t << " <translatorcomment>" << protect(msg.translatorComment()) - << "</translatorcomment>\n"; + if (!msg.translatorComment().isEmpty()) + t << " <translatorcomment>" << protect(msg.translatorComment()) + << "</translatorcomment>\n"; - } + } - t << " <translation"; - if (msg.type() == TranslatorMessage::Unfinished) - t << " type=\"unfinished\""; - else if (msg.type() == TranslatorMessage::Obsolete) - t << " type=\"obsolete\""; - if (msg.isPlural()) { - t << ">"; - QStringList translns = translator.normalizedTranslations(msg, cd, &result); - for (int j = 0; j < qMax(1, translns.count()); ++j) { - t << "\n <numerusform"; - writeVariants(t, " ", translns[j]); - t << "</numerusform>"; + t << " <translation"; + if (msg.type() == TranslatorMessage::Unfinished) + t << " type=\"unfinished\""; + else if (msg.type() == TranslatorMessage::Obsolete) + t << " type=\"obsolete\""; + if (msg.isPlural()) { + t << ">"; + QStringList translns = translator.normalizedTranslations(msg, cd, &result); + for (int j = 0; j < qMax(1, translns.count()); ++j) { + t << "\n <numerusform"; + writeVariants(t, " ", translns[j]); + t << "</numerusform>"; + } + t << "\n "; + } else { + writeVariants(t, " ", msg.translation()); } - t << "\n "; - } else { - writeVariants(t, " ", msg.translation()); - } - t << "</translation>\n"; + t << "</translation>\n"; + + if (format != 11) + writeExtras(t, " ", msg.extras(), drops); - if (format != 11) - writeExtras(t, " ", msg.extras(), drops); + if (!msg.userData().isEmpty()) + t << " <userdata>" << msg.userData() << "</userdata>\n"; + t << " </message>\n"; - if (!msg.userData().isEmpty()) - t << " <userdata>" << msg.userData() << "</userdata>\n"; - t << " </message>\n"; + if (format != 11 || second || !msg.isUtf8() || !msg.isNonUtf8()) + break; + isUtf8 = false; + second = true; + } } t << "</context>\n"; } @@ -708,12 +732,12 @@ bool loadTS(Translator &translator, QIODevice &dev, ConversionData &cd) return reader.read(translator); } -bool saveTS11(const Translator &translator, QIODevice &dev, ConversionData &cd) +bool saveTS11(const Translator &translator, QIODevice &dev, ConversionData &cd) { return saveTS(translator, dev, cd, 11); } -bool saveTS20(const Translator &translator, QIODevice &dev, ConversionData &cd) +bool saveTS20(const Translator &translator, QIODevice &dev, ConversionData &cd) { return saveTS(translator, dev, cd, 20); } diff --git a/tools/linguist/shared/ts.dtd b/tools/linguist/shared/ts.dtd index d979f0b..ab77f64 100644 --- a/tools/linguist/shared/ts.dtd +++ b/tools/linguist/shared/ts.dtd @@ -4,6 +4,8 @@ ! ! The location element is set as optional since it was introduced first in Qt 4.2. ! The userdata element is set as optional since it was introduced first in Qt 4.4. + ! The source and translation elements are optional starting with version 3.0 + ! (Qt 4.6) to support S60 blank messages. ! --> <!-- @@ -12,39 +14,100 @@ --> <!ENTITY % evilstring '(#PCDATA | byte)*' > <!ELEMENT byte EMPTY> +<!-- value contains decimal (e.g. 1000) or hex (e.g. x3e8) unicode encoding of one char --> <!ATTLIST byte value CDATA #REQUIRED> -<!ELEMENT TS (defaultcodec?, context+) > +<!-- + ! This element wildcard is no valid DTD. No better solution available. + ! extra elements may appear in TS and message elements. Each element may appear + ! only once within each scope. The contents are preserved verbatim; any + ! attributes are dropped. Currently recognized extra tags include: + ! extra-po-msgid_plural, extra-po-old_msgid_plural + ! extra-po-flags (comma-space separated list) + ! extra-loc-layout_id + ! extra-loc-feature + ! extra-loc-blank + --> +<!ELEMENT extra-* %evilstring; > +<!ELEMENT TS (defaultcodec?, extra-**, (context|message)+) > <!ATTLIST TS version CDATA #IMPLIED + sourcelanguage CDATA #IMPLIED language CDATA #IMPLIED> +<!-- The encoding to use in the .qm file by default. Default is ISO-8859-1. --> <!ELEMENT defaultcodec (#PCDATA) > -<!ELEMENT context (name, comment?, extracomment?, message+) > +<!ELEMENT context (name?, comment?, (context|message)+) > <!ATTLIST context encoding CDATA #IMPLIED> <!ELEMENT name %evilstring; > +<!-- If "no", then the context nesting is for informational puposes only --> +<!ATTLIST name + nest (yes|no) "yes"> +<!-- This is "disambiguation" in the (new) API, or "msgctxt" in gettext speak --> <!ELEMENT comment %evilstring; > +<!-- Previous content of comment (result of merge) --> <!ELEMENT oldcomment %evilstring; > -<!ELEMENT translatorcomment %evilstring; > +<!-- The real comment (added by developer/designer) --> <!ELEMENT extracomment %evilstring; > -<!ELEMENT message (location*, source, oldsource?, comment?, oldcomment?, extracomment?, translatorcomment?, translation, userdata?) > +<!-- Comment added by translator --> +<!ELEMENT translatorcomment %evilstring; > +<!ELEMENT message (location*, source?, oldsource?, comment?, oldcomment?, extracomment?, translatorcomment?, translation?, userdata?, extra-**) > +<!-- + ! If utf8 is true, the defaultcodec is overridden and the message is encoded + ! in UTF-8 in the .qm file. + --> <!ATTLIST message - encoding CDATA #IMPLIED + id CDATA #IMPLIED + utf8 (true|false) "false" numerus (yes|no) "no"> <!ELEMENT location EMPTY> +<!-- + ! If the line is omitted, the location specifies only a file. + ! + ! location supports relative specifications as well. Line numbers are + ! relative (explicitly positive or negative) to the last reference to a + ! given filename; each file starts with current line 0. If the filename + ! is omitted, the "current" one is used. For the 1st location in a message, + ! "current" is the filename used for the 1st location of the previous message. + ! For subsequent locations, it is the filename used for the previous location. + ! A single .ts file has either all absolute or all relative locations. + --> <!ATTLIST location - filename CDATA #REQUIRED - line CDATA #REQUIRED> + filename CDATA #IMPLIED + line CDATA #IMPLIED> <!ELEMENT source %evilstring;> -<!-- - ! The following should really say one evilstring macro or several numerusform elements, - ! but the DTD can't express this. +<!-- Previous content of source (result of merge) --> +<!ELEMENT oldsource %evilstring;> +<!-- + ! The following should really say one evilstring macro or several + ! numerusform or lengthvariant elements, but the DTD can't express this. + --> +<!ELEMENT translation (#PCDATA|byte|numerusform|lengthvariant)* > +<!-- + ! If no type is set, the message is "finished". + ! Length variants must be ordered by falling display length. + ! variants may not be yes if the message has numerus yes. --> -<!ELEMENT translation (#PCDATA|byte|numerusform)* > <!ATTLIST translation type (unfinished|obsolete) #IMPLIED - encoding CDATA #IMPLIED> + variants (yes|no) "no"> +<!-- Deprecated. Use extra-* --> <!ELEMENT userdata (#PCDATA)* > -<!ELEMENT numerusform %evilstring; > - - +<!-- + ! The following should really say one evilstring macro or several + ! lengthvariant elements, but the DTD can't express this. + ! Length variants must be ordered by falling display length. + --> +<!ELEMENT numerusform (#PCDATA|byte|lengthvariant)* > +<!ATTLIST numerusform + plurality (nullar|singular|dual|trial|paucal|greaterpaucal|plural|greaterplural) #IMPLIED> + variants (yes|no) "no"> +<!ELEMENT lengthvariant %evilstring; > +<!-- + ! The translation variants have a priority between 1 ("highest") and 9 ("lowest") + ! Typically longer translations get a higher priority. + ! If omitted, the order of appearance of the variants in the .ts files is used. + --> +<!ATTLIST lengthvariant + priority (1|2|3|4|5|6|7|8|9) #IMPLIED> + diff --git a/tools/linguist/shared/ui.cpp b/tools/linguist/shared/ui.cpp index d562285..ff98a90 100644 --- a/tools/linguist/shared/ui.cpp +++ b/tools/linguist/shared/ui.cpp @@ -60,7 +60,8 @@ class UiReader : public QXmlDefaultHandler { public: UiReader(Translator &translator, ConversionData &cd) - : m_translator(translator), m_cd(cd), m_lineNumber(-1) + : m_translator(translator), m_cd(cd), m_lineNumber(-1), m_isTrString(false), + m_needUtf8(translator.codecName() != "UTF-8") {} bool startElement(const QString &namespaceURI, const QString &localName, @@ -80,11 +81,13 @@ private: QString m_context; QString m_source; QString m_comment; + QString m_extracomment; QXmlLocator *m_locator; QString m_accum; int m_lineNumber; bool m_isTrString; + bool m_needUtf8; }; bool UiReader::startElement(const QString &namespaceURI, @@ -93,22 +96,27 @@ bool UiReader::startElement(const QString &namespaceURI, Q_UNUSED(namespaceURI); Q_UNUSED(localName); - if (qName == QLatin1String("item")) { + if (qName == QLatin1String("item")) { // UI3 menu entries flush(); - if (!atts.value(QLatin1String("text")).isEmpty()) + if (!atts.value(QLatin1String("text")).isEmpty()) { m_source = atts.value(QLatin1String("text")); + m_isTrString = true; + if (!m_cd.m_noUiLines) + m_lineNumber = m_locator->lineNumber(); + } } else if (qName == QLatin1String("string")) { flush(); if (atts.value(QLatin1String("notr")).isEmpty() || atts.value(QLatin1String("notr")) != QLatin1String("true")) { m_isTrString = true; m_comment = atts.value(QLatin1String("comment")); + m_extracomment = atts.value(QLatin1String("extracomment")); + if (!m_cd.m_noUiLines) + m_lineNumber = m_locator->lineNumber(); } else { m_isTrString = false; } } - if (m_isTrString && !m_cd.m_noUiLines) - m_lineNumber = m_locator->lineNumber(); m_accum.clear(); return true; } @@ -121,15 +129,15 @@ bool UiReader::endElement(const QString &namespaceURI, m_accum.replace(QLatin1String("\r\n"), QLatin1String("\n")); - if (qName == QLatin1String("class")) { + if (qName == QLatin1String("class")) { // UI "header" if (m_context.isEmpty()) m_context = m_accum; } else if (qName == QLatin1String("string") && m_isTrString) { m_source = m_accum; - } else if (qName == QLatin1String("comment")) { + } else if (qName == QLatin1String("comment")) { // FIXME: what's that? m_comment = m_accum; flush(); - } else if (qName == QLatin1String("function")) { + } else if (qName == QLatin1String("function")) { // UI3 embedded code fetchtrInlinedCpp(m_accum, m_translator, m_context); } else { flush(); @@ -149,7 +157,7 @@ bool UiReader::fatalError(const QXmlParseException &exception) msg.sprintf("XML error: Parse error at line %d, column %d (%s).", exception.lineNumber(), exception.columnNumber(), exception.message().toLatin1().data()); - m_cd.appendError(msg); + m_cd.appendError(msg); return false; } @@ -159,10 +167,14 @@ void UiReader::flush() TranslatorMessage msg(m_context, m_source, m_comment, QString(), m_cd.m_sourceFileName, m_lineNumber, QStringList()); + msg.setExtraComment(m_extracomment); + if (m_needUtf8 && msg.needs8Bit()) + msg.setUtf8(true); m_translator.extend(msg); } m_source.clear(); m_comment.clear(); + m_extracomment.clear(); } bool loadUI(Translator &translator, QIODevice &dev, ConversionData &cd) @@ -184,7 +196,7 @@ bool loadUI(Translator &translator, QIODevice &dev, ConversionData &cd) return result; } -bool saveUI(const Translator &translator, QIODevice &dev, ConversionData &cd) +bool saveUI(const Translator &translator, QIODevice &dev, ConversionData &cd) { Q_UNUSED(dev); Q_UNUSED(translator); diff --git a/tools/linguist/shared/xliff.cpp b/tools/linguist/shared/xliff.cpp index 115e1f4..6acf67a 100644 --- a/tools/linguist/shared/xliff.cpp +++ b/tools/linguist/shared/xliff.cpp @@ -744,7 +744,7 @@ bool saveXLIFF(const Translator &translator, QIODevice &dev, ConversionData &cd) int indent = 0; QTextStream ts(&dev); - //ts.setCodec( QTextCodec::codecForName("ISO-8859-1") ); // FIXME: Huh? + ts.setCodec(QTextCodec::codecForName("UTF-8")); QStringList dtgs = cd.dropTags(); dtgs << QLatin1String("po-(old_)?msgid_plural"); diff --git a/tools/macdeployqt/macdeployqt/main.cpp b/tools/macdeployqt/macdeployqt/main.cpp index 24ab9a3..0026c40 100644 --- a/tools/macdeployqt/macdeployqt/main.cpp +++ b/tools/macdeployqt/macdeployqt/main.cpp @@ -63,7 +63,7 @@ int main(int argc, char **argv) qDebug() << "framework. The accessibilty, image formats, and text codec"; qDebug() << "plugins are always copied, unless \"-no-plugins\" is specified."; qDebug() << ""; - qDebug() << "See the \"Deploying an Application on Qt/Mac\" typic in the"; + qDebug() << "See the \"Deploying an Application on Qt/Mac\" topic in the"; qDebug() << "documentation for more information about deployment on Mac OS X."; return 0; @@ -76,22 +76,26 @@ int main(int argc, char **argv) qDebug() << "Error: Could not find app bundle" << appBundlePath; return 0; } - - DeploymentInfo deploymentInfo = deployQtFrameworks(appBundlePath); - + bool plugins = true; bool dmg = false; extern bool runStripEnabled; - + for (int i = 2; i < argc; ++i) { QByteArray argument = QByteArray(argv[i]); - if (argument == QByteArray("-no-plugins")) + if (argument == QByteArray("-no-plugins")) { plugins = false; - if (argument == QByteArray("-dmg")) + } else if (argument == QByteArray("-dmg")) { dmg = true; - if (argument == QByteArray("-no-strip")) + } else if (argument == QByteArray("-no-strip")) { runStripEnabled = false; - } + } else if (argument.startsWith("-")) { + qDebug() << "Error: Unknown option" << argument << "\n"; + return 0; + } + } + + DeploymentInfo deploymentInfo = deployQtFrameworks(appBundlePath); if (plugins) { if (deploymentInfo.qtPath.isEmpty()) diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index a764653..f341862 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -106,6 +106,7 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value CodeOld \value CodeQuoteArgument \value CodeQuoteCommand + \value EndQmlText \value FormatElse \value FormatEndif \value FormatIf @@ -131,6 +132,7 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value ParaLeft \value ParaRight \value Qml + \value QmlText \value QuotationLeft \value QuotationRight \value RawString @@ -174,6 +176,9 @@ static const struct { { "CodeOld", Atom::CodeOld }, { "CodeQuoteArgument", Atom::CodeQuoteArgument }, { "CodeQuoteCommand", Atom::CodeQuoteCommand }, +#ifdef QDOC_QML + { "EndQmlText", Atom::EndQmlText }, +#endif { "FootnoteLeft", Atom::FootnoteLeft }, { "FootnoteRight", Atom::FootnoteRight }, { "FormatElse", Atom::FormatElse }, @@ -202,6 +207,7 @@ static const struct { { "ParaRight", Atom::ParaRight }, #ifdef QDOC_QML { "Qml", Atom::Qml}, + { "QmlText", Atom::QmlText }, #endif { "QuotationLeft", Atom::QuotationLeft }, { "QuotationRight", Atom::QuotationRight }, diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 0d2a924..178d9ed 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -71,6 +71,9 @@ class Atom CodeOld, CodeQuoteArgument, CodeQuoteCommand, +#ifdef QDOC_QML + EndQmlText, +#endif FootnoteLeft, FootnoteRight, FormatElse, @@ -99,6 +102,7 @@ class Atom ParaRight, #ifdef QDOC_QML Qml, + QmlText, #endif QuotationLeft, QuotationRight, diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index 63b6865..9a58bc6 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -177,6 +177,11 @@ QSet<QString> CodeParser::commonMetaCommands() << COMMAND_TITLE; } +/*! + The topic command has been processed. Now process the other + metacommands that were found. These are not the text markup + commands. + */ void CodeParser::processCommonMetaCommand(const Location &location, const QString &command, const QString &arg, @@ -185,31 +190,43 @@ void CodeParser::processCommonMetaCommand(const Location &location, { if (command == COMMAND_COMPAT) { node->setStatus(Node::Compat); - } else if (command == COMMAND_DEPRECATED) { + } + else if (command == COMMAND_DEPRECATED) { node->setStatus(Node::Deprecated); - } else if (command == COMMAND_INGROUP) { + } + else if (command == COMMAND_INGROUP) { tree->addToGroup(node, arg); - } else if (command == COMMAND_INPUBLICGROUP) { + } + else if (command == COMMAND_INPUBLICGROUP) { tree->addToPublicGroup(node, arg); - } else if (command == COMMAND_INMODULE) { + } + else if (command == COMMAND_INMODULE) { node->setModuleName(arg); - } else if (command == COMMAND_MAINCLASS) { + } + else if (command == COMMAND_MAINCLASS) { node->setStatus(Node::Main); - } else if (command == COMMAND_OBSOLETE) { + } + else if (command == COMMAND_OBSOLETE) { if (node->status() != Node::Compat) node->setStatus(Node::Obsolete); - } else if (command == COMMAND_NONREENTRANT) { + } + else if (command == COMMAND_NONREENTRANT) { node->setThreadSafeness(Node::NonReentrant); - } else if (command == COMMAND_PRELIMINARY) { + } + else if (command == COMMAND_PRELIMINARY) { node->setStatus(Node::Preliminary); - } else if (command == COMMAND_INTERNAL) { + } + else if (command == COMMAND_INTERNAL) { node->setAccess(Node::Private); node->setStatus(Node::Internal); - } else if (command == COMMAND_REENTRANT) { + } + else if (command == COMMAND_REENTRANT) { node->setThreadSafeness(Node::Reentrant); - } else if (command == COMMAND_SINCE) { + } + else if (command == COMMAND_SINCE) { node->setSince(arg); - } else if (command == COMMAND_SUBTITLE) { + } + else if (command == COMMAND_SUBTITLE) { if (node->type() == Node::Fake) { FakeNode *fake = static_cast<FakeNode *>(node); fake->setSubTitle(arg); diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index fcf77f5..1ad5843 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -672,11 +672,13 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, else if (command == COMMAND_QMLCLASS) { const ClassNode* classNode = 0; QStringList names = arg.split(" "); - qDebug() << "QMLCLASS" << names; - Node* n = tre->findNode(names[1].split("::"),Node::Class); - if (n) { - classNode = static_cast<const ClassNode*>(n); - qDebug() << "FOUND IT!" << classNode->name(); + //qDebug() << "QMLCLASS" << names; + if (names.size() > 1) { + Node* n = tre->findNode(names[1].split("::"),Node::Class); + if (n) { + classNode = static_cast<const ClassNode*>(n); + //qDebug() << "FOUND IT!" << classNode->name(); + } } return new QmlNode(tre->root(), names[0], classNode); } diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 1d3a7d4..61d0ed6 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -311,7 +311,8 @@ bool DocPrivate::isEnumDocSimplifiable() const while (atom) { if (atom->type() == Atom::AutoLink || atom->type() == Atom::String) { justMetColon = atom->string().endsWith(":"); - } else if ((atom->type() == Atom::ListLeft) && + } + else if ((atom->type() == Atom::ListLeft) && (atom->string() == ATOM_LIST_VALUE)) { if (justMetColon || numValueTables > 0) return false; @@ -478,7 +479,8 @@ void DocParser::parse(const QString& source, if (ch.isLetterOrNumber()) { cmdStr += ch; pos++; - } else { + } + else { break; } } @@ -488,7 +490,8 @@ void DocParser::parse(const QString& source, if (in.at(pos).isSpace()) { skipAllSpaces(); appendChar(QLatin1Char(' ')); - } else { + } + else { appendChar(in.at(pos++)); } } @@ -570,6 +573,9 @@ void DocParser::parse(const QString& source, leavePara(); append(Atom::Qml, getCode(CMD_QML, marker)); break; + case CMD_QMLTEXT: + append(Atom::QmlText); + break; #endif case CMD_CODELINE: { @@ -579,7 +585,7 @@ void DocParser::parse(const QString& source, && priv->text.lastAtom()->string().endsWith("\n\n")) priv->text.lastAtom()->chopString(); appendToCode("\n"); - } else { + } lse { append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, " "); } @@ -589,7 +595,8 @@ void DocParser::parse(const QString& source, && priv->text.lastAtom()->string().endsWith("\n\n")) priv->text.lastAtom()->chopString(); appendToCode("\n"); - } else { + } + else { append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, " "); } @@ -651,14 +658,16 @@ void DocParser::parse(const QString& source, if (preprocessorSkipping.size() > 0) { if (preprocessorSkipping.top()) { --numPreprocessorSkipping; - } else { + } + else { ++numPreprocessorSkipping; } preprocessorSkipping.top() = !preprocessorSkipping.top(); (void)getRestOfLine(); // ### should ensure that it's empty if (numPreprocessorSkipping) skipToNextPreprocessorCommand(); - } else { + } + else { location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ELSE))); } break; @@ -678,6 +687,9 @@ void DocParser::parse(const QString& source, case CMD_ENDQML: closeCommand(cmd); break; + case CMD_ENDQMLTEXT: + append(Atom::EndQmlText); + break; #endif case CMD_ENDFOOTNOTE: if (closeCommand(cmd)) { @@ -693,7 +705,8 @@ void DocParser::parse(const QString& source, (void)getRestOfLine(); // ### should ensure that it's empty if (numPreprocessorSkipping) skipToNextPreprocessorCommand(); - } else { + } + else { location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ENDIF))); } break; @@ -784,12 +797,14 @@ void DocParser::parse(const QString& source, leaveTableRow(); append(Atom::TableHeaderLeft); inTableHeader = true; - } else { + } + else { if (openedCommands.contains(CMD_TABLE)) { location().warning(tr("Cannot use '\\%1' within '\\%2'") .arg(cmdName(CMD_HEADER)) .arg(cmdName(openedCommands.top()))); - } else { + } + else { location().warning(tr("Cannot use '\\%1' outside of '\\%2'") .arg(cmdName(CMD_HEADER)) .arg(cmdName(CMD_TABLE))); @@ -824,7 +839,8 @@ void DocParser::parse(const QString& source, if (paraState == OutsidePara) { enterPara(); indexStartedPara = true; - } else { + } + else { const Atom *last = priv->text.lastAtom(); if (indexStartedPara && (last->type() != Atom::FormattingRight || @@ -844,12 +860,14 @@ void DocParser::parse(const QString& source, if (isLeftBraceAhead()) { currentLinkAtom = priv->text.lastAtom(); startFormat(ATOM_FORMATTING_LINK, cmd); - } else { + } + else { append(Atom::FormattingLeft, ATOM_FORMATTING_LINK); append(Atom::String, cleanLink(x)); append(Atom::FormattingRight, ATOM_FORMATTING_LINK); } - } else { + } + else { x = getArgument(); append(Atom::Link, x); append(Atom::FormattingLeft, ATOM_FORMATTING_LINK); @@ -893,7 +911,8 @@ void DocParser::parse(const QString& source, if (openedLists.top().isStarted()) { append(Atom::ListItemRight, openedLists.top().styleString()); - } else { + } + else { append(Atom::ListLeft, openedLists.top().styleString()); } @@ -903,7 +922,8 @@ void DocParser::parse(const QString& source, append(Atom::ListItemLeft, openedLists.top().styleString()); enterPara(); - } else if (openedCommands.top() == CMD_TABLE) { + } + else if (openedCommands.top() == CMD_TABLE) { x = "1,1"; if (isLeftBraceAhead()) x = getArgument(); @@ -915,14 +935,16 @@ void DocParser::parse(const QString& source, .arg(cmdName(CMD_O))); append(Atom::TableRowLeft); inTableRow = true; - } else if (inTableItem) { + } + else if (inTableItem) { append(Atom::TableItemRight); inTableItem = false; } append(Atom::TableItemLeft, x); inTableItem = true; - } else { + } + else { location().warning(tr("Command '\\%1' outside of '\\%2' and '\\%3'") .arg(cmdName(cmd)) .arg(cmdName(CMD_LIST)) @@ -1003,7 +1025,8 @@ void DocParser::parse(const QString& source, append(Atom::Code, quoter.quoteTo(location(), cmdStr, "")); quoter.reset(); - } else { + } + else { append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, fileName); } @@ -1029,7 +1052,8 @@ void DocParser::parse(const QString& source, quoter.quoteUntil(location(), cmdStr, slashed(marker->functionEndRegExp(x)))); quoter.reset(); - } else { + } + else { append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, slashed(marker->functionEndRegExp(x))); } @@ -1050,12 +1074,14 @@ void DocParser::parse(const QString& source, leaveTableRow(); append(Atom::TableRowLeft); inTableRow = true; - } else { + } + else { if (openedCommands.contains(CMD_TABLE)) { location().warning(tr("Cannot use '\\%1' within '\\%2'") .arg(cmdName(CMD_ROW)) .arg(cmdName(openedCommands.top()))); - } else { + } + else { location().warning(tr("Cannot use '\\%1' outside of '\\%2'") .arg(cmdName(CMD_ROW)) .arg(cmdName(CMD_TABLE))); @@ -1126,7 +1152,8 @@ void DocParser::parse(const QString& source, append(Atom::SnippetCommand, cmdStr); append(Atom::SnippetLocation, snippet); append(Atom::SnippetIdentifier, identifier); - } else { + } + else { Doc::quoteFromFile(location(),quoter,snippet); appendToCode(quoter.quoteSnippet(location(), identifier)); @@ -1136,7 +1163,8 @@ void DocParser::parse(const QString& source, append(Atom::SnippetCommand, cmdStr); append(Atom::SnippetLocation, snippet); append(Atom::SnippetIdentifier, identifier); - } else { + } + else { Doc::quoteFromFile(location(),quoter,snippet); appendToCode(quoter.quoteSnippet(location(), identifier)); @@ -1189,7 +1217,8 @@ void DocParser::parse(const QString& source, location().warning(tr("Invalid Unicode character '%1' specified " "with '%2'") .arg(x, cmdName(CMD_UNICODE))); - } else { + } + else { append(Atom::String, QChar(unicodeChar)); } } @@ -1210,7 +1239,8 @@ void DocParser::parse(const QString& source, skipSpacesOrOneEndl(); if (isBlankLine()) append(Atom::Nop); - } else { + } + else { // ### problems } break; @@ -1349,7 +1379,8 @@ void DocParser::parse(const QString& source, if (ch.isSpace()) { ++pos; newWord = false; - } else { + } + else { enterPara(); newWord = true; } @@ -1461,7 +1492,8 @@ void DocParser::parse(const QString& source, if (openedCommands.top() != CMD_OMIT) { location().warning(tr("Missing '\\%1'").arg(endCmdName(openedCommands.top()))); - } else if (preprocessorSkipping.count() > 0) { + } + else if (preprocessorSkipping.count() > 0) { location().warning(tr("Missing '\\%1'").arg(cmdName(CMD_ENDIF))); } @@ -1526,16 +1558,20 @@ void DocParser::checkExpiry(const QString& date) int days = expiryDate.daysTo(QDate::currentDate()); if (days == 0) { location().warning(tr("Documentation expires today")); - } else if (days == 1) { + } + else if (days == 1) { location().warning(tr("Documentation expired yesterday")); - } else if (days >= 2) { + } + else if (days >= 2) { location().warning(tr("Documentation expired %1 days ago") .arg(days)); } - } else { + } + else { location().warning(tr("Date '%1' invalid").arg(date)); } - } else { + } + else { location().warning(tr("Date '%1' not in YYYY-MM-DD format") .arg(date)); } @@ -1546,7 +1582,8 @@ void DocParser::insertBaseName(const QString &baseName) priv->constructExtra(); if (currentSectioningUnit == priv->extra->sectioningUnit) { priv->extra->baseName = baseName; - } else { + } + else { Atom *atom = priv->text.firstAtom(); Atom *sectionLeft = 0; @@ -1568,7 +1605,8 @@ void DocParser::insertTarget(const QString &target, bool keyword) if (targetMap.contains(target)) { location().warning(tr("Duplicate target name '%1'").arg(target)); targetMap[target].warning(tr("(The previous occurrence is here)")); - } else { + } + else { targetMap.insert(target, location()); append(Atom::Target, target); priv->constructExtra(); @@ -1594,12 +1632,14 @@ void DocParser::include(const QString& fileName) userFriendlyFilePath); if (filePath.isEmpty()) { location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); - } else { + } + else { QFile inFile(filePath); if (!inFile.open(QFile::ReadOnly)) { location().warning(tr("Cannot open leaf file '%1'") .arg(userFriendlyFilePath)); - } else { + } + else { location().push(userFriendlyFilePath); QTextStream inStream(&inFile); @@ -1634,7 +1674,8 @@ void DocParser::startFormat(const QString& format, int cmd) pendingFormats.insert(braceDepth, format); ++braceDepth; ++pos; - } else { + } + else { append(Atom::String, getArgument()); append(Atom::FormattingRight, format); if (format == ATOM_FORMATTING_INDEX && indexStartedPara) { @@ -1652,28 +1693,34 @@ bool DocParser::openCommand(int cmd) if (cmd != CMD_LINK) { if (outer == CMD_LIST) { ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST); - } else if (outer == CMD_ABSTRACT) { + } + else if (outer == CMD_ABSTRACT) { ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_TABLE); - } else if (outer == CMD_SIDEBAR) { + } + else if (outer == CMD_SIDEBAR) { ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_SIDEBAR); - } else if (outer == CMD_QUOTATION) { + } + else if (outer == CMD_QUOTATION) { ok = (cmd == CMD_LIST); - } else if (outer == CMD_TABLE) { + } + else if (outer == CMD_TABLE) { ok = (cmd == CMD_LIST || cmd == CMD_FOOTNOTE || cmd == CMD_QUOTATION); - } else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) { + } + else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) { ok = false; } } if (ok) { openedCommands.push(cmd); - } else { + } + else { location().warning(tr("Cannot use '\\%1' within '\\%2'") .arg(cmdName(cmd)).arg(cmdName(outer))); } @@ -1685,7 +1732,8 @@ bool DocParser::closeCommand(int endCmd) if (endCmdFor(openedCommands.top()) == endCmd && openedCommands.size() > 1) { openedCommands.pop(); return true; - } else { + } + else { bool contains = false; QStack<int> opened2 = openedCommands; while (opened2.size() > 1) { @@ -1703,7 +1751,8 @@ bool DocParser::closeCommand(int endCmd) .arg(cmdName(endCmd))); openedCommands.pop(); } - } else { + } + else { location().warning(tr("Unexpected '\\%1'") .arg(cmdName(endCmd))); } @@ -1728,10 +1777,12 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd) if (unit <= priv->extra->sectioningUnit) { location().warning(tr("Unexpected '\\%1' in this documentation") .arg(cmdName(cmd))); - } else if (unit - currentSectioningUnit > 1) { + } + else if (unit - currentSectioningUnit > 1) { location().warning(tr("Unexpected '\\%1' at this point") .arg(cmdName(cmd))); - } else { + } + else { if (currentSectioningUnit >= unit) endSection(unit, cmd); @@ -1754,10 +1805,12 @@ void DocParser::endSection(int unit, int endCmd) if (unit < priv->extra->sectioningUnit) { location().warning(tr("Unexpected '\\%1' in this documentation") .arg(cmdName(endCmd))); - } else if (unit > currentSectioningUnit) { + } + else if (unit > currentSectioningUnit) { location().warning(tr("Unexpected '\\%1' at this point") .arg(cmdName(endCmd))); - } else { + } + else { while (currentSectioningUnit >= unit) { int delta = currentSectioningUnit - priv->extra->sectioningUnit; append(Atom::SectionRight, QString::number(delta)); @@ -1895,7 +1948,8 @@ void DocParser::enterPara(Atom::Type leftType, #endif leftType == Atom::SectionHeadingLeft) { paraState = InsideSingleLinePara; - } else { + } + else { paraState = InsideMultiLinePara; } skipSpacesOrOneEndl(); @@ -1912,7 +1966,8 @@ void DocParser::leavePara() if (priv->text.lastAtom()->type() == pendingParaLeftType) { priv->text.stripLastAtom(); - } else { + } + else { if (priv->text.lastAtom()->type() == Atom::String && priv->text.lastAtom()->string().endsWith(" ")) { priv->text.lastAtom()->chopString(); @@ -1932,7 +1987,8 @@ void DocParser::leaveValue() if (openedLists.isEmpty()) { openedLists.push(OpenedList(OpenedList::Value)); append(Atom::ListLeft, ATOM_LIST_VALUE); - } else { + } + else { if (priv->text.lastAtom()->type() == Atom::Nop) priv->text.stripLastAtom(); append(Atom::ListItemRight, ATOM_LIST_VALUE); @@ -1980,14 +2036,16 @@ void DocParser::expandMacro(const QString &name, { if (numParams == 0) { append(Atom::RawString, def); - } else { + } + else { QStringList args; QString rawString; for (int i = 0; i < numParams; i++) { if (numParams == 1 || isLeftBraceAhead()) { args << getArgument(true); - } else { + } + else { location().warning(tr("Macro '\\%1' invoked with too few" " arguments (expected %2, got %3)") .arg(name).arg(numParams).arg(i)); @@ -2007,7 +2065,8 @@ void DocParser::expandMacro(const QString &name, } append(Atom::String, args[paramNo - 1]); j += 2; - } else { + } + else { rawString += def[j++]; } } @@ -2022,19 +2081,26 @@ Doc::SectioningUnit DocParser::getSectioningUnit() if (name == "part") { return Doc::Part; - } else if (name == "chapter") { + } + else if (name == "chapter") { return Doc::Chapter; - } else if (name == "section1") { + } + else if (name == "section1") { return Doc::Section1; - } else if (name == "section2") { + } + else if (name == "section2") { return Doc::Section2; - } else if (name == "section3") { + } + else if (name == "section3") { return Doc::Section3; - } else if (name == "section4") { + } + else if (name == "section4") { return Doc::Section4; - } else if (name.isEmpty()) { + } + else if (name.isEmpty()) { return Doc::Section4; - } else { + } + else { location().warning(tr("Invalid sectioning unit '%1'").arg(name)); return Doc::Book; } @@ -2081,7 +2147,8 @@ QString DocParser::getArgument(bool verbatim) if (verbatim) { arg += in[pos]; pos++; - } else { + } + else { pos++; if (pos < (int) in.length()) { if (in[pos].isLetterOrNumber()) @@ -2089,7 +2156,8 @@ QString DocParser::getArgument(bool verbatim) arg += in[pos]; if (in[pos].isSpace()) { skipAllSpaces(); - } else { + } + else { pos++; } } @@ -2102,7 +2170,8 @@ QString DocParser::getArgument(bool verbatim) } if (delimDepth > 0) location().warning(tr("Missing '}'")); - } else { + } + else { while (pos < in.length() && ((delimDepth > 0) || ((delimDepth == 0) && @@ -2128,7 +2197,8 @@ QString DocParser::getArgument(bool verbatim) if (verbatim) { arg += in[pos]; pos++; - } else { + } + else { pos++; if (pos < (int) in.length()) { if (in[pos].isLetterOrNumber()) @@ -2136,7 +2206,8 @@ QString DocParser::getArgument(bool verbatim) arg += in[pos]; if (in[pos].isSpace()) { skipAllSpaces(); - } else { + } + else { pos++; } } @@ -2167,7 +2238,8 @@ QString DocParser::getOptionalArgument() if (pos + 1 < (int) in.length() && in[pos] == '\\' && in[pos + 1].isLetterOrNumber()) { return ""; - } else { + } + else { return getArgument(); } } @@ -2191,7 +2263,8 @@ QString DocParser::getRestOfLine() in[pos].isSpace() && (in[pos] != '\n')) ++pos; - } else { + } + else { trailingSlash = false; ++pos; } @@ -2252,7 +2325,8 @@ QString DocParser::getUntilEnd(int cmd) if (end == -1) { location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd))); pos = in.length(); - } else { + } + else { t = in.mid(pos, end - pos); pos = end + rx.matchedLength(); } @@ -2327,7 +2401,8 @@ void DocParser::skipSpacesOrOneEndl() if (ch == '\n') { if (firstEndl == -1) { firstEndl = pos; - } else { + } + else { pos = firstEndl; break; } @@ -2369,6 +2444,8 @@ int DocParser::endCmdFor(int cmd) #ifdef QDOC_QML case CMD_QML: return CMD_ENDQML; + case CMD_QMLTEXT: + return CMD_ENDQMLTEXT; #endif case CMD_FOOTNOTE: return CMD_ENDFOOTNOTE; @@ -2459,7 +2536,8 @@ int DocParser::indentLevel(const QString& str) for (int i = 0; i < (int) str.length(); i++) { if (str[i] == '\n') { column = 0; - } else { + } + else { if (str[i] != ' ' && column < minIndent) minIndent = column; column++; @@ -2480,7 +2558,8 @@ QString DocParser::unindent(int level, const QString& str) if (str[i] == QLatin1Char('\n')) { t += '\n'; column = 0; - } else { + } + else { if (column >= level) t += str[i]; column++; @@ -2615,7 +2694,8 @@ void Doc::simplifyEnumDoc() atom = atom->next(); if (atom) atom = atom->next(); - } else { + } + else { newText << *atom; atom = atom->next(); } @@ -2730,7 +2810,8 @@ Text Doc::trimmedBriefText(const QString &className) const tr("Nonstandard wording in '\\%1' text for '%2' (expected more text)") .arg(COMMAND_BRIEF).arg(className)); standardWording = false; - } else + } + else whats[0] = whats[0].toUpper(); // ### move this once \brief is abolished for properties @@ -2753,7 +2834,8 @@ const QString& Doc::baseName() const static QString null; if (priv == 0 || priv->extra == 0) { return null; - } else { + } + else { return priv->extra->baseName; } } @@ -2762,7 +2844,8 @@ Doc::SectioningUnit Doc::granularity() const { if (priv == 0 || priv->extra == 0) { return DocPrivateExtra().granularity; - } else { + } + else { return priv->extra->granularity; } } @@ -2772,7 +2855,8 @@ Doc::SectioningUnit Doc::sectioningUnit() const { if (priv == 0 || priv->extra == 0) { return DocPrivateExtra().sectioningUnit; - } else { + } + else { return priv->extra->sectioningUnit; } } @@ -2873,7 +2957,8 @@ void Doc::initialize(const Config& config) .arg(alias) .arg(reverseAliasMap[alias]) .arg(*c)); - } else { + } + else { reverseAliasMap.insert(alias, *c); } aliasMap()->insert(*c, alias); @@ -2912,7 +2997,8 @@ void Doc::initialize(const Config& config) int m = Config::numParams(macro.defaultDef); if (macro.numParams == -1) { macro.numParams = m; - } else if (macro.numParams != m) { + } + else if (macro.numParams != m) { if (!silent) { QString other = tr("default"); if (macro.defaultDef.isEmpty()) @@ -3016,11 +3102,13 @@ CodeMarker *Doc::quoteFromFile(const Location &location, fileName, userFriendlyFilePath); if (filePath.isEmpty()) { location.warning(tr("Cannot find example file '%1'").arg(fileName)); - } else { + } + else { QFile inFile(filePath); if (!inFile.open(QFile::ReadOnly)) { location.warning(tr("Cannot open example file '%1'").arg(userFriendlyFilePath)); - } else { + } + else { QTextStream inStream(&inFile); code = DocParser::untabifyEtc(inStream.readAll()); } @@ -3061,11 +3149,13 @@ QString Doc::canonicalTitle(const QString &title) begun = true; slurping = false; lastAlnum = result.size(); - } else if (!slurping) { + } + else if (!slurping) { if (begun) result += QLatin1Char('-'); slurping = true; - } else { + } + else { // !alnum && slurping -> nothin } } diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 8a90636..d89d6af 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -96,21 +96,22 @@ void Generator::terminateGenerator() void Generator::initialize(const Config &config) { outputFormats = config.getStringSet(CONFIG_OUTPUTFORMATS); - if ( !outputFormats.isEmpty() ) { + if (!outputFormats.isEmpty()) { outDir = config.getString(CONFIG_OUTPUTDIR); - if ( outDir.isEmpty() ) + if (outDir.isEmpty()) config.lastLocation().fatal(tr("No output directory specified in configuration file")); QDir dirInfo; - if ( dirInfo.exists(outDir) ) { - if ( !Config::removeDirContents(outDir) ) + if (dirInfo.exists(outDir)) { + if (!Config::removeDirContents(outDir)) config.lastLocation().error(tr("Cannot empty output directory '%1'").arg(outDir)); - } else { - if ( !dirInfo.mkpath(outDir) ) + } + else { + if (!dirInfo.mkpath(outDir)) config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir)); } - if ( !dirInfo.mkdir(outDir + "/images") ) + if (!dirInfo.mkdir(outDir + "/images")) config.lastLocation().fatal(tr("Cannot create output directory '%1'") .arg(outDir + "/images")); } @@ -119,9 +120,9 @@ void Generator::initialize(const Config &config) imageDirs = config.getStringList(CONFIG_IMAGEDIRS); QString imagesDotFileExtensions = CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS; - QSet<QString> formats = config.subVars( imagesDotFileExtensions ); + QSet<QString> formats = config.subVars(imagesDotFileExtensions); QSet<QString>::ConstIterator f = formats.begin(); - while ( f != formats.end() ) { + while (f != formats.end()) { imgFileExts[*f] = config.getStringList(imagesDotFileExtensions + Config::dot + *f); ++f; } @@ -146,33 +147,35 @@ void Generator::initialize(const Config &config) ++g; } - QRegExp secondParamAndAbove( "[\2-\7]" ); - QSet<QString> formattingNames = config.subVars( CONFIG_FORMATTING ); + QRegExp secondParamAndAbove("[\2-\7]"); + QSet<QString> formattingNames = config.subVars(CONFIG_FORMATTING); QSet<QString>::ConstIterator n = formattingNames.begin(); - while ( n != formattingNames.end() ) { + while (n != formattingNames.end()) { QString formattingDotName = CONFIG_FORMATTING + Config::dot + *n; - QSet<QString> formats = config.subVars( formattingDotName ); + QSet<QString> formats = config.subVars(formattingDotName); QSet<QString>::ConstIterator f = formats.begin(); - while ( f != formats.end() ) { - QString def = config.getString( formattingDotName + Config::dot + - *f ); - if ( !def.isEmpty() ) { - int numParams = Config::numParams( def ); + while (f != formats.end()) { + QString def = config.getString(formattingDotName + Config::dot + + *f); + if (!def.isEmpty()) { + int numParams = Config::numParams(def); int numOccs = def.count("\1"); - if ( numParams != 1 ) { + if (numParams != 1) { config.lastLocation().warning(tr("Formatting '%1' must have exactly one" " parameter (found %2)") .arg(*n).arg(numParams)); - } else if ( numOccs > 1 ) { + } + else if (numOccs > 1) { config.lastLocation().fatal(tr("Formatting '%1' must contain exactly one" " occurrence of '\\1' (found %2)") .arg(*n).arg(numOccs)); - } else { - int paramPos = def.indexOf( "\1" ); - fmtLeftMaps[*f].insert( *n, def.left(paramPos) ); - fmtRightMaps[*f].insert( *n, def.mid(paramPos + 1) ); + } + else { + int paramPos = def.indexOf("\1"); + fmtLeftMaps[*f].insert(*n, def.left(paramPos)); + fmtRightMaps[*f].insert(*n, def.mid(paramPos + 1)); } } ++f; @@ -186,7 +189,7 @@ void Generator::initialize(const Config &config) void Generator::terminate() { QList<Generator *>::ConstIterator g = generators.begin(); - while ( g != generators.end() ) { + while (g != generators.end()) { if (outputFormats.contains((*g)->format())) (*g)->terminateGenerator(); ++g; @@ -200,65 +203,97 @@ void Generator::terminate() outDir = ""; } -Generator *Generator::generatorForFormat( const QString& format ) +Generator *Generator::generatorForFormat(const QString& format) { QList<Generator *>::ConstIterator g = generators.begin(); - while ( g != generators.end() ) { - if ( (*g)->format() == format ) + while (g != generators.end()) { + if ((*g)->format() == format) return *g; ++g; } return 0; } -void Generator::startText( const Node * /* relative */, - CodeMarker * /* marker */ ) +void Generator::startText(const Node * /* relative */, + CodeMarker * /* marker */) { } -void Generator::endText( const Node * /* relative */, - CodeMarker * /* marker */ ) +void Generator::endText(const Node * /* relative */, + CodeMarker * /* marker */) { } -int Generator::generateAtom( const Atom * /* atom */, - const Node * /* relative */, - CodeMarker * /* marker */ ) +int Generator::generateAtom(const Atom * /* atom */, + const Node * /* relative */, + CodeMarker * /* marker */) { return 0; } -void Generator::generateClassLikeNode(const InnerNode * /* classe */, CodeMarker * /* marker */) +void Generator::generateClassLikeNode(const InnerNode * /* classe */, + CodeMarker * /* marker */) { } -void Generator::generateFakeNode( const FakeNode * /* fake */, - CodeMarker * /* marker */ ) +void Generator::generateFakeNode(const FakeNode * /* fake */, + CodeMarker * /* marker */) { } -void Generator::generateText( const Text& text, const Node *relative, - CodeMarker *marker ) +void Generator::generateText(const Text& text, + const Node *relative, + CodeMarker *marker) { - if ( text.firstAtom() != 0 ) { + if (text.firstAtom() != 0) { int numAtoms = 0; - startText( relative, marker ); - generateAtomList( text.firstAtom(), relative, marker, true, numAtoms ); - endText( relative, marker ); + startText(relative, marker); + generateAtomList(text.firstAtom(), + relative, + marker, + true, + numAtoms); + endText(relative, marker); } } -void Generator::generateBody( const Node *node, CodeMarker *marker ) +#ifdef QDOC_QML +void Generator::generateQmlText(const Text& text, + const Node *relative, + CodeMarker *marker) +{ + if (text.firstAtom() != 0) { + startText(relative, marker); + const Atom *atom = text.firstAtom(); + while (atom) { + if (atom->type() != Atom::QmlText) + atom = atom->next(); + else { + atom = atom->next(); + while (atom && (atom->type() != Atom::EndQmlText)) { + int n = 1 + generateAtom(atom, relative, marker); + while (n-- > 0) + atom = atom->next(); + } + } + } + endText(relative, marker); + } +} +#endif + +void Generator::generateBody(const Node *node, CodeMarker *marker) { bool quiet = false; - if ( node->type() == Node::Function ) { + if (node->type() == Node::Function) { #if 0 const FunctionNode *func = (const FunctionNode *) node; - if ( func->isOverload() && func->metaness() != FunctionNode::Ctor ) - generateOverload( node, marker ); + if (func->isOverload() && func->metaness() != FunctionNode::Ctor) + generateOverload(node, marker); #endif - } else if (node->type() == Node::Fake) { + } + else if (node->type() == Node::Fake) { const FakeNode *fake = static_cast<const FakeNode *>(node); if (fake->subType() == FakeNode::Example) generateExampleFiles(fake, marker); @@ -270,42 +305,45 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) if (!quiet) // ### might be unnecessary node->location().warning(tr("No documentation for '%1'") .arg(marker->plainFullName(node))); - } else { + } + else { generateText(node->doc().body(), node, marker); - if ( node->type() == Node::Enum ) { + if (node->type() == Node::Enum) { const EnumNode *enume = (const EnumNode *) node; QSet<QString> definedItems; QList<EnumItem>::ConstIterator it = enume->items().begin(); - while ( it != enume->items().end() ) { - definedItems.insert( (*it).name() ); + while (it != enume->items().end()) { + definedItems.insert((*it).name()); ++it; } QSet<QString> documentedItems = enume->doc().enumItemNames().toSet(); QSet<QString> allItems = definedItems + documentedItems; - if ( allItems.count() > definedItems.count() || - allItems.count() > documentedItems.count() ) { + if (allItems.count() > definedItems.count() || + allItems.count() > documentedItems.count()) { QSet<QString>::ConstIterator a = allItems.begin(); - while ( a != allItems.end() ) { - if ( !definedItems.contains(*a) ) { + while (a != allItems.end()) { + if (!definedItems.contains(*a)) { QString details; - QString best = nearestName( *a, definedItems ); - if ( !best.isEmpty() && !documentedItems.contains(best) ) - details = tr( "Maybe you meant '%1'?" ).arg( best ); + QString best = nearestName(*a, definedItems); + if (!best.isEmpty() && !documentedItems.contains(best)) + details = tr("Maybe you meant '%1'?").arg(best); node->doc().location().warning( tr("No such enum item '%1' in %2").arg(*a).arg(marker->plainFullName(node)), details); - } else if ( !documentedItems.contains(*a) ) { + } + else if (!documentedItems.contains(*a)) { node->doc().location().warning( tr("Undocumented enum item '%1' in %2").arg(*a).arg(marker->plainFullName(node))); } ++a; } } - } else if ( node->type() == Node::Function ) { + } + else if (node->type() == Node::Function) { const FunctionNode *func = static_cast<const FunctionNode *>(node); QSet<QString> definedParams; @@ -315,8 +353,9 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) && func->name() != QLatin1String("operator++") && func->name() != QLatin1String("operator--")) { node->doc().location().warning(tr("Missing parameter name")); - } else { - definedParams.insert( (*p).name() ); + } + else { + definedParams.insert((*p).name()); } ++p; } @@ -330,13 +369,14 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) if (!definedParams.contains(*a)) { QString details; QString best = nearestName(*a, definedParams); - if ( !best.isEmpty() ) + if (!best.isEmpty()) details = tr("Maybe you meant '%1'?").arg(best); node->doc().location().warning( tr("No such parameter '%1' in %2").arg(*a).arg(marker->plainFullName(node)), details); - } else if ( !(*a).isEmpty() && !documentedParams.contains(*a) ) { + } + else if (!(*a).isEmpty() && !documentedParams.contains(*a)) { bool needWarning = (func->status() > Node::Obsolete); if (func->overloadNumber() > 1) { FunctionNode *primaryFunc = @@ -365,8 +405,8 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) node->doc().location().warning(tr("Undocumented return value")); } - if ( func->reimplementedFrom() != 0 ) - generateReimplementedFrom( func, marker ); + if (func->reimplementedFrom() != 0) + generateReimplementedFrom(func, marker); } } @@ -383,7 +423,7 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) } } -void Generator::generateAlsoList( const Node *node, CodeMarker *marker ) +void Generator::generateAlsoList(const Node *node, CodeMarker *marker) { QList<Text> alsoList = node->doc().alsoList(); supplementAlsoList(node, alsoList); @@ -396,7 +436,7 @@ void Generator::generateAlsoList( const Node *node, CodeMarker *marker ) text << alsoList.at(i) << separator(i, alsoList.size()); text << Atom::ParaRight; - generateText( text, node, marker ); + generateText(text, node, marker); } } @@ -405,41 +445,41 @@ void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker) QList<RelatedClass>::ConstIterator r; int index; - if ( !classe->baseClasses().isEmpty() ) { + if (!classe->baseClasses().isEmpty()) { Text text; text << Atom::ParaLeft << "Inherits "; r = classe->baseClasses().begin(); index = 0; - while ( r != classe->baseClasses().end() ) { + while (r != classe->baseClasses().end()) { text << Atom(Atom::LinkNode, CodeMarker::stringForNode((*r).node)) << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) << Atom(Atom::String, (*r).dataTypeWithTemplateArgs) << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); - if ( (*r).access == Node::Protected ) { + if ((*r).access == Node::Protected) { text << " (protected)"; - } else if ( (*r).access == Node::Private ) { + } else if ((*r).access == Node::Private) { text << " (private)"; } - text << separator( index++, classe->baseClasses().count() ); + text << separator(index++, classe->baseClasses().count()); ++r; } text << Atom::ParaRight; - generateText( text, classe, marker ); + generateText(text, classe, marker); } } -void Generator::generateInheritedBy( const ClassNode *classe, - CodeMarker *marker ) +void Generator::generateInheritedBy(const ClassNode *classe, + CodeMarker *marker) { - if ( !classe->derivedClasses().isEmpty() ) { + if (!classe->derivedClasses().isEmpty()) { Text text; text << Atom::ParaLeft << "Inherited by "; appendSortedNames(text, classe, classe->derivedClasses(), marker); text << Atom::ParaRight; - generateText( text, classe, marker ); + generateText(text, classe, marker); } } @@ -480,17 +520,19 @@ void Generator::generateModuleWarning(const ClassNode *classe, CodeMarker *marke << "This class is not part of the Qt Console Edition." << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << Atom::ParaRight; - } else if (Tokenizer::isTrue("defined(desktoplightedition)") + } + else if (Tokenizer::isTrue("defined(desktoplightedition)") && !editionModuleMap["DesktopLight"].contains(module)) { text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "This class is not part of the Qt Desktop Light Edition." << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << Atom::ParaRight; - } else if (module == "Qt3Support" && Tokenizer::isTrue("defined(opensourceedition)")) { - text << Atom::ParaLeft << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ) + } + else if (module == "Qt3Support" && Tokenizer::isTrue("defined(opensourceedition)")) { + text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "Note to Qt Desktop Light Edition users:" - << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " This class is only available in the " << Atom(Atom::AutoLink, "Qt Desktop Edition") << "." << Atom::ParaRight; @@ -500,28 +542,28 @@ void Generator::generateModuleWarning(const ClassNode *classe, CodeMarker *marke } } -QString Generator::indent( int level, const QString& markedCode ) +QString Generator::indent(int level, const QString& markedCode) { - if ( level == 0 ) + if (level == 0) return markedCode; QString t; int column = 0; int i = 0; - while ( i < (int) markedCode.length() ) { - if ( markedCode.at(i) == QLatin1Char('<') ) { - while ( i < (int) markedCode.length() ) { + while (i < (int) markedCode.length()) { + if (markedCode.at(i) == QLatin1Char('<')) { + while (i < (int) markedCode.length()) { t += markedCode.at(i++); - if ( markedCode.at(i - 1) == QLatin1Char('>') ) + if (markedCode.at(i - 1) == QLatin1Char('>')) break; } } else { - if ( markedCode.at(i) == QLatin1Char('\n') ) { + if (markedCode.at(i) == QLatin1Char('\n')) { column = 0; } else { - if ( column == 0 ) { - for ( int j = 0; j < level; j++ ) + if (column == 0) { + for (int j = 0; j < level; j++) t += QLatin1Char(' '); } column++; @@ -532,20 +574,20 @@ QString Generator::indent( int level, const QString& markedCode ) return t; } -QString Generator::plainCode( const QString& markedCode ) +QString Generator::plainCode(const QString& markedCode) { QString t = markedCode; - t.replace( tag, QString() ); - t.replace( quot, QLatin1String("\"") ); - t.replace( gt, QLatin1String(">") ); - t.replace( lt, QLatin1String("<") ); - t.replace( amp, QLatin1String("&") ); + t.replace(tag, QString()); + t.replace(quot, QLatin1String("\"")); + t.replace(gt, QLatin1String(">")); + t.replace(lt, QLatin1String("<")); + t.replace(amp, QLatin1String("&")); return t; } -QString Generator::typeString( const Node *node ) +QString Generator::typeString(const Node *node) { - switch ( node->type() ) { + switch (node->type()) { case Node::Namespace: return "namespace"; case Node::Class: @@ -564,7 +606,7 @@ QString Generator::typeString( const Node *node ) } } -QString Generator::imageFileName( const Node *relative, const QString& fileBase ) +QString Generator::imageFileName(const Node *relative, const QString& fileBase) { QString userFriendlyFilePath; QString filePath = Config::findFile( @@ -580,18 +622,18 @@ QString Generator::imageFileName( const Node *relative, const QString& fileBase outputDir() + QLatin1String("/images")); } -void Generator::setImageFileExtensions( const QStringList& extensions ) +void Generator::setImageFileExtensions(const QStringList& extensions) { imgFileExts[format()] = extensions; } -void Generator::unknownAtom( const Atom *atom ) +void Generator::unknownAtom(const Atom *atom) { - Location::internalError( tr("unknown atom type '%1' in %2 generator") - .arg(atom->typeString()).arg(format()) ); + Location::internalError(tr("unknown atom type '%1' in %2 generator") + .arg(atom->typeString()).arg(format())); } -bool Generator::matchAhead( const Atom *atom, Atom::Type expectedAtomType ) +bool Generator::matchAhead(const Atom *atom, Atom::Type expectedAtomType) { return atom->next() != 0 && atom->next()->type() == expectedAtomType; } @@ -664,44 +706,44 @@ QString Generator::trimmedTrailing(const QString &string) return trimmed; } -void Generator::generateStatus( const Node *node, CodeMarker *marker ) +void Generator::generateStatus(const Node *node, CodeMarker *marker) { Text text; - switch ( node->status() ) { + switch (node->status()) { case Node::Commendable: case Node::Main: break; case Node::Preliminary: - text << Atom::ParaLeft << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ) << "This " - << typeString( node ) << " is under development and is subject to change." - << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ) << Atom::ParaRight; + text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "This " + << typeString(node) << " is under development and is subject to change." + << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << Atom::ParaRight; break; case Node::Deprecated: text << Atom::ParaLeft; if (node->isInnerNode()) - text << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ); - text << "This " << typeString( node ) << " is deprecated."; + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); + text << "This " << typeString(node) << " is deprecated."; if (node->isInnerNode()) - text << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD); text << Atom::ParaRight; break; case Node::Obsolete: text << Atom::ParaLeft; if (node->isInnerNode()) - text << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ); - text << "This " << typeString( node ) << " is obsolete."; + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); + text << "This " << typeString(node) << " is obsolete."; if (node->isInnerNode()) - text << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD); text << " It is provided to keep old source code working. We strongly advise against " << "using it in new code." << Atom::ParaRight; break; case Node::Compat: // reimplemented in HtmlGenerator subclass if (node->isInnerNode()) { - text << Atom::ParaLeft << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ) << "This " - << typeString( node ) << " is part of the Qt 3 compatibility layer." - << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ) + text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "This " + << typeString(node) << " is part of the Qt 3 compatibility layer." + << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " It is provided to keep old source code working. We strongly advise against " << "using it in new code. See " << Atom(Atom::AutoLink, "Porting to Qt 4") @@ -759,7 +801,8 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker) } if (except.isEmpty()) { text << "."; - } else { + } + else { text << ", except "; NodeList::ConstIterator e = except.begin(); @@ -770,7 +813,8 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker) ++e; } } - } else { + } + else { text << "This " << typeString(node) << " is " << theStockLink << "."; } text << Atom::ParaRight; @@ -796,7 +840,7 @@ void Generator::generateSince(const Node *node, CodeMarker *marker) /*! No longer in use. */ -void Generator::generateOverload( const Node *node, CodeMarker *marker ) +void Generator::generateOverload(const Node *node, CodeMarker *marker) { Text text; text << Atom::ParaLeft @@ -804,55 +848,71 @@ void Generator::generateOverload( const Node *node, CodeMarker *marker ) QString t = node->name() + "()"; text << Atom::AutoLink << t << Atom::ParaRight; - generateText( text, node, marker ); + generateText(text, node, marker); } -void Generator::generateReimplementedFrom( const FunctionNode *func, - CodeMarker *marker ) +void Generator::generateReimplementedFrom(const FunctionNode *func, + CodeMarker *marker) { - if ( func->reimplementedFrom() != 0 ) { + if (func->reimplementedFrom() != 0) { const FunctionNode *from = func->reimplementedFrom(); if (from->access() != Node::Private && from->parent()->access() != Node::Private) { Text text; text << Atom::ParaLeft << "Reimplemented from "; - appendFullName( text, from->parent(), func, marker, from ); + appendFullName(text, from->parent(), func, marker, from); text << "." << Atom::ParaRight; - generateText( text, func, marker ); + generateText(text, func, marker); } } } -const Atom *Generator::generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker, - bool generate, int &numAtoms) +const Atom *Generator::generateAtomList(const Atom *atom, + const Node *relative, + CodeMarker *marker, + bool generate, + int &numAtoms) { while (atom) { if (atom->type() == Atom::FormatIf) { int numAtoms0 = numAtoms; bool rightFormat = canHandleFormat(atom->string()); - atom = generateAtomList(atom->next(), relative, marker, generate && rightFormat, + atom = generateAtomList(atom->next(), + relative, + marker, + generate && rightFormat, numAtoms); if (!atom) return 0; if (atom->type() == Atom::FormatElse) { ++numAtoms; - atom = generateAtomList( atom->next(), relative, marker, - generate && !rightFormat, numAtoms ); + atom = generateAtomList(atom->next(), + relative, + marker, + generate && !rightFormat, + numAtoms); if (!atom) return 0; } if (atom->type() == Atom::FormatEndif) { if (generate && numAtoms0 == numAtoms) { - relative->location().warning(tr("Output format %1 not handled").arg(format())); + relative->location().warning(tr("Output format %1 not handled"). + arg(format())); Atom unhandledFormatAtom(Atom::UnhandledFormat, format()); - generateAtomList(&unhandledFormatAtom, relative, marker, generate, numAtoms); + generateAtomList(&unhandledFormatAtom, + relative, + marker, + generate, + numAtoms); } atom = atom->next(); } - } else if (atom->type() == Atom::FormatElse || atom->type() == Atom::FormatEndif) { + } + else if (atom->type() == Atom::FormatElse || atom->type() == Atom::FormatEndif) { return atom; - } else { + } + else { int n = 1; if (generate) { n += generateAtom(atom, relative, marker); @@ -865,11 +925,13 @@ const Atom *Generator::generateAtomList(const Atom *atom, const Node *relative, return 0; } -void Generator::appendFullName( Text& text, const Node *apparentNode, - const Node *relative, CodeMarker *marker, - const Node *actualNode ) +void Generator::appendFullName(Text& text, + const Node *apparentNode, + const Node *relative, + CodeMarker *marker, + const Node *actualNode) { - if ( actualNode == 0 ) + if (actualNode == 0) actualNode = apparentNode; text << Atom(Atom::LinkNode, CodeMarker::stringForNode(actualNode)) << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) @@ -877,7 +939,8 @@ void Generator::appendFullName( Text& text, const Node *apparentNode, << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); } -void Generator::appendSortedNames(Text& text, const ClassNode *classe, +void Generator::appendSortedNames(Text& text, + const ClassNode *classe, const QList<RelatedClass> &classes, CodeMarker *marker) { @@ -886,11 +949,11 @@ void Generator::appendSortedNames(Text& text, const ClassNode *classe, int index = 0; r = classes.begin(); - while ( r != classes.end() ) { + while (r != classes.end()) { if ((*r).node->access() == Node::Public && (*r).node->status() != Node::Internal && !(*r).node->doc().isEmpty()) { Text className; - appendFullName( className, (*r).node, classe, marker ); + appendFullName(className, (*r).node, classe, marker); classMap[className.toString().toLower()] = className; } ++r; @@ -901,7 +964,7 @@ void Generator::appendSortedNames(Text& text, const ClassNode *classe, foreach (const QString &className, classNames) { text << classMap[className]; - text << separator( index++, classNames.count() ); + text << separator(index++, classNames.count()); } } @@ -909,14 +972,15 @@ int Generator::skipAtoms(const Atom *atom, Atom::Type type) const { int skipAhead = 0; atom = atom->next(); - while ( atom != 0 && atom->type() != type ) { + while (atom != 0 && atom->type() != type) { skipAhead++; atom = atom->next(); } return skipAhead; } -QString Generator::fullName(const Node *node, const Node *relative, +QString Generator::fullName(const Node *node, + const Node *relative, CodeMarker *marker) const { if (node->type() == Node::Fake) diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 2c06480..3db2d8d 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -70,7 +70,7 @@ class Tree; class Generator { -public: + public: Generator(); virtual ~Generator(); @@ -80,47 +80,57 @@ public: virtual bool canHandleFormat(const QString &format) { return format == this->format(); } virtual void generateTree(const Tree *tree, CodeMarker *marker) = 0; - static void initialize( const Config& config ); + static void initialize(const Config& config); static void terminate(); - static Generator *generatorForFormat( const QString& format ); - -protected: - virtual void startText( const Node *relative, CodeMarker *marker ); - virtual void endText( const Node *relative, CodeMarker *marker ); - virtual int generateAtom( const Atom *atom, const Node *relative, - CodeMarker *marker ); + static Generator *generatorForFormat(const QString& format); + + protected: + virtual void startText(const Node *relative, CodeMarker *marker); + virtual void endText(const Node *relative, CodeMarker *marker); + virtual int generateAtom(const Atom *atom, + const Node *relative, + CodeMarker *marker); virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - - virtual void generateText( const Text& text, const Node *relative, - CodeMarker *marker ); - virtual void generateBody( const Node *node, CodeMarker *marker ); - virtual void generateAlsoList( const Node *node, CodeMarker *marker ); - virtual void generateInherits( const ClassNode *classe, - CodeMarker *marker ); - virtual void generateInheritedBy( const ClassNode *classe, - CodeMarker *marker ); - - void generateThreadSafeness( const Node *node, CodeMarker *marker ); + virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); + + virtual void generateText(const Text& text, + const Node *relative, + CodeMarker *marker); +#ifdef QDOC_QML + virtual void generateQmlText(const Text& text, + const Node *relative, + CodeMarker *marker); +#endif + virtual void generateBody(const Node *node, CodeMarker *marker); + virtual void generateAlsoList(const Node *node, CodeMarker *marker); + virtual void generateInherits(const ClassNode *classe, + CodeMarker *marker); + virtual void generateInheritedBy(const ClassNode *classe, + CodeMarker *marker); + + void generateThreadSafeness(const Node *node, CodeMarker *marker); void generateSince(const Node *node, CodeMarker *marker); - void generateStatus( const Node *node, CodeMarker *marker ); - const Atom *generateAtomList( const Atom *atom, const Node *relative, - CodeMarker *marker, bool generate, - int& numGeneratedAtoms ); + void generateStatus(const Node *node, CodeMarker *marker); + const Atom *generateAtomList(const Atom *atom, + const Node *relative, + CodeMarker *marker, + bool generate, + int& numGeneratedAtoms); void generateExampleFiles(const FakeNode *fake, CodeMarker *marker); - void generateModuleWarning( const ClassNode *classe, CodeMarker *marker); + void generateModuleWarning(const ClassNode *classe, CodeMarker *marker); virtual int skipAtoms(const Atom *atom, Atom::Type type) const; - virtual QString fullName(const Node *node, const Node *relative, + virtual QString fullName(const Node *node, + const Node *relative, CodeMarker *marker) const; const QString& outputDir() { return outDir; } - QString indent( int level, const QString& markedCode ); - QString plainCode( const QString& markedCode ); - virtual QString typeString( const Node *node ); - virtual QString imageFileName( const Node *relative, const QString& fileBase ); - void setImageFileExtensions( const QStringList& extensions ); - void unknownAtom( const Atom *atom ); + QString indent(int level, const QString& markedCode); + QString plainCode(const QString& markedCode); + virtual QString typeString(const Node *node); + virtual QString imageFileName(const Node *relative, const QString& fileBase); + void setImageFileExtensions(const QStringList& extensions); + void unknownAtom(const Atom *atom); QMap<QString, QString> &formattingLeftMap(); QMap<QString, QString> &formattingRightMap(); @@ -128,17 +138,20 @@ protected: QMap<QString, QStringList> editionGroupMap; static QString trimmedTrailing(const QString &string); - static bool matchAhead( const Atom *atom, Atom::Type expectedAtomType ); + static bool matchAhead(const Atom *atom, Atom::Type expectedAtomType); static void supplementAlsoList(const Node *node, QList<Text> &alsoList); private: - void generateOverload( const Node *node, CodeMarker *marker ); - void generateReimplementedFrom( const FunctionNode *func, - CodeMarker *marker ); - void appendFullName( Text& text, const Node *apparentNode, - const Node *relative, CodeMarker *marker, - const Node *actualNode = 0 ); - void appendSortedNames(Text& text, const ClassNode *classe, + void generateOverload(const Node *node, CodeMarker *marker); + void generateReimplementedFrom(const FunctionNode *func, + CodeMarker *marker); + void appendFullName(Text& text, + const Node *apparentNode, + const Node *relative, + CodeMarker *marker, + const Node *actualNode = 0); + void appendSortedNames(Text& text, + const ClassNode *classe, const QList<RelatedClass> &classes, CodeMarker *marker); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index a0fc743..13d52bf 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -319,7 +319,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << formattingLeftMap()[ATOM_FORMATTING_TELETYPE]; if (inLink) { out() << protect(plainCode(atom->string())); - } else { + } + else { out() << highlightedCode(atom->string(), marker, relative); } out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; @@ -382,22 +383,26 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::FormattingRight: if (atom->string() == ATOM_FORMATTING_LINK) { endLink(); - } else { + } + else { out() << formattingRightMap()[atom->string()]; } break; case Atom::GeneratedList: if (atom->string() == "annotatedclasses") { generateAnnotatedList(relative, marker, nonCompatClasses); - } else if (atom->string() == "classes") { + } + else if (atom->string() == "classes") { generateCompactList(relative, marker, nonCompatClasses); - } else if (atom->string().contains("classesbymodule")) { + } + else if (atom->string().contains("classesbymodule")) { QString arg = atom->string().trimmed(); QString moduleName = atom->string().mid(atom->string().indexOf( "classesbymodule") + 15).trimmed(); if (moduleClassMap.contains(moduleName)) generateAnnotatedList(relative, marker, moduleClassMap[moduleName]); - } else if (atom->string().contains("classesbyedition")) { + } + else if (atom->string().contains("classesbyedition")) { QString arg = atom->string().trimmed(); QString editionName = atom->string().mid(atom->string().indexOf( @@ -422,7 +427,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, groupClasses = groups.values(groupName.mid(1)); foreach (const Node *node, groupClasses) editionClasses.remove(node->name()); - } else { + } + else { groupClasses = groups.values(groupName); foreach (const Node *node, groupClasses) editionClasses.insert(node->name(), node); @@ -430,23 +436,32 @@ int HtmlGenerator::generateAtom(const Atom *atom, } generateAnnotatedList(relative, marker, editionClasses); } - } else if (atom->string() == "classhierarchy") { + } + else if (atom->string() == "classhierarchy") { generateClassHierarchy(relative, marker, nonCompatClasses); - } else if (atom->string() == "compatclasses") { + } + else if (atom->string() == "compatclasses") { generateCompactList(relative, marker, compatClasses); - } else if (atom->string() == "functionindex") { + } + else if (atom->string() == "functionindex") { generateFunctionIndex(relative, marker); - } else if (atom->string() == "legalese") { + } + else if (atom->string() == "legalese") { generateLegaleseList(relative, marker); - } else if (atom->string() == "mainclasses") { + } + else if (atom->string() == "mainclasses") { generateCompactList(relative, marker, mainClasses); - } else if (atom->string() == "services") { + } + else if (atom->string() == "services") { generateCompactList(relative, marker, serviceClasses); - } else if (atom->string() == "overviews") { + } + else if (atom->string() == "overviews") { generateOverviewList(relative, marker); - } else if (atom->string() == "namespaces") { + } + else if (atom->string() == "namespaces") { generateAnnotatedList(relative, marker, namespaceIndex); - } else if (atom->string() == "related") { + } + else if (atom->string() == "related") { const FakeNode *fake = static_cast<const FakeNode *>(relative); if (fake && !fake->groupMembers().isEmpty()) { QMap<QString, const Node *> groupMembersMap; @@ -456,7 +471,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, } generateAnnotatedList(fake, marker, groupMembersMap); } - } else if (atom->string() == "relatedinline") { + } + else if (atom->string() == "relatedinline") { const FakeNode *fake = static_cast<const FakeNode *>(relative); if (fake && !fake->groupMembers().isEmpty()) { // Reverse the list into the original scan order. @@ -482,7 +498,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (fileName.isEmpty()) { out() << "<font color=\"red\">[Missing image " << protect(atom->string()) << "]</font>"; - } else { + } + else { out() << "<img src=\"" << protect(fileName) << "\""; if (!text.isEmpty()) out() << " alt=\"" << protect(text) << "\""; @@ -530,29 +547,37 @@ int HtmlGenerator::generateAtom(const Atom *atom, } if (atom->string() == ATOM_LIST_BULLET) { out() << "<ul>\n"; - } else if (atom->string() == ATOM_LIST_TAG) { + } + else if (atom->string() == ATOM_LIST_TAG) { out() << "<dl>\n"; - } else if (atom->string() == ATOM_LIST_VALUE) { + } + else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { out() << "<p><table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">\n" "<tr><th width=\"25%\">Constant</th><th width=\"15%\">Value</th>" "<th width=\"60%\">Description</th></tr>\n"; - } else { + } + else { out() << "<p><table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" width=\"40%\">\n" << "<tr><th width=\"60%\">Constant</th><th width=\"40%\">Value</th></tr>\n"; } - } else { + } + else { out() << "<ol type="; if (atom->string() == ATOM_LIST_UPPERALPHA) { out() << "\"A\""; - } else if (atom->string() == ATOM_LIST_LOWERALPHA) { + } + else if (atom->string() == ATOM_LIST_LOWERALPHA) { out() << "\"a\""; - } else if (atom->string() == ATOM_LIST_UPPERROMAN) { + } + else if (atom->string() == ATOM_LIST_UPPERROMAN) { out() << "\"I\""; - } else if (atom->string() == ATOM_LIST_LOWERROMAN) { + } + else if (atom->string() == ATOM_LIST_LOWERROMAN) { out() << "\"i\""; - } else { // (atom->string() == ATOM_LIST_NUMERIC) + } + else { // (atom->string() == ATOM_LIST_NUMERIC) out() << "\"1\""; } if (atom->next() != 0 && atom->next()->string().toInt() != 1) @@ -565,7 +590,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::ListTagLeft: if (atom->string() == ATOM_LIST_TAG) { out() << "<dt>"; - } else { // (atom->string() == ATOM_LIST_VALUE) + } + else { // (atom->string() == ATOM_LIST_VALUE) // ### Trenton out() << "<tr><td valign=\"top\"><tt>" @@ -594,13 +620,15 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::ListItemLeft: if (atom->string() == ATOM_LIST_TAG) { out() << "<dd>"; - } else if (atom->string() == ATOM_LIST_VALUE) { + } + else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { out() << "</td><td valign=\"top\">"; if (matchAhead(atom, Atom::ListItemRight)) out() << " "; } - } else { + } + else { out() << "<li>"; } if (matchAhead(atom, Atom::ParaLeft)) @@ -609,20 +637,25 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::ListItemRight: if (atom->string() == ATOM_LIST_TAG) { out() << "</dd>\n"; - } else if (atom->string() == ATOM_LIST_VALUE) { + } + else if (atom->string() == ATOM_LIST_VALUE) { out() << "</td></tr>\n"; - } else { + } + else { out() << "</li>\n"; } break; case Atom::ListRight: if (atom->string() == ATOM_LIST_BULLET) { out() << "</ul>\n"; - } else if (atom->string() == ATOM_LIST_TAG) { + } + else if (atom->string() == ATOM_LIST_TAG) { out() << "</dl>\n"; - } else if (atom->string() == ATOM_LIST_VALUE) { + } + else if (atom->string() == ATOM_LIST_VALUE) { out() << "</table></p>\n"; - } else { + } + else { out() << "</ol>\n"; } break; @@ -658,7 +691,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, do { sectionNumber.append("1"); } while (sectionNumber.size() < nextLevel); - } else { + } + else { while (sectionNumber.size() > nextLevel) { sectionNumber.removeLast(); } @@ -688,7 +722,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::String: if (inLink && !inContents && !inSectionHeading) { generateLink(atom, relative, marker); - } else { + } + else { out() << protect(atom->string()); } break; @@ -704,7 +739,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, << "cellspacing=\"1\" border=\"0\">\n"; else out() << "<p><table align=\"center\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">\n"; - } else { + } + else { out() << "<p><table align=\"center\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">\n"; } numTableRows = 0; @@ -721,7 +757,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; out() << "\n<tr valign=\"top\" class=\"qt-style\">"; - } else { + } + else { out() << "</thead>\n"; inTableHeader = false; } @@ -798,6 +835,12 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<font color=\"red\"><b><code>\\" << protect(atom->string()) << "</code></b></font>"; break; +#ifdef QDOC_QML + case Atom::QmlText: + case Atom::EndQmlText: + // don't do anything with these. They are just tags. + break; +#endif default: unknownAtom(atom); } @@ -821,7 +864,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Namespace Reference"; - } else if (inner->type() == Node::Class) { + } + else if (inner->type() == Node::Class) { classe = static_cast<const ClassNode *>(inner); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); @@ -1101,12 +1145,12 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateBody(fake, marker); #ifdef QDOC_QML if (fake->subType() == FakeNode::QmlClass) { - qDebug() << "generateFakeNode(): QML CLASS" << fake->name(); + //qDebug() << "generateFakeNode(): QML CLASS" << fake->name(); const QmlNode* qmlNode = static_cast<const QmlNode*>(fake); const ClassNode* cn = qmlNode->classNode(); if (cn) { - qDebug() << " CPP CLASS" << cn->name(); - generateBody(cn, marker); + //qDebug() << " CPP CLASS" << cn->name(); + generateQmlText(cn->doc().body(), cn, marker); } } #endif @@ -1142,18 +1186,23 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) if (fake->subType() == FakeNode::Example) { appendDcfSubSection(&dcfExamplesRoot, fakeSection); - } else if (fake->subType() != FakeNode::File) { + } + else if (fake->subType() != FakeNode::File) { QString contentsPage = fake->links().value(Node::ContentsLink).first; if (contentsPage == "Qt Designer Manual") { appendDcfSubSection(&dcfDesignerRoot, fakeSection); - } else if (contentsPage == "Qt Linguist Manual") { + } + else if (contentsPage == "Qt Linguist Manual") { appendDcfSubSection(&dcfLinguistRoot, fakeSection); - } else if (contentsPage == "Qt Assistant Manual") { + } + else if (contentsPage == "Qt Assistant Manual") { appendDcfSubSection(&dcfAssistantRoot, fakeSection); - } else if (contentsPage == "qmake Manual") { + } + else if (contentsPage == "qmake Manual") { appendDcfSubSection(&dcfQmakeRoot, fakeSection); - } else { + } + else { appendDcfSubSection(&dcfOverviewsRoot, fakeSection); } } @@ -2865,10 +2914,10 @@ void HtmlGenerator::findAllQmlClasses(const InnerNode *node) const FakeNode* fakeNode = static_cast<const FakeNode *>(*c); if (fakeNode->subType() == FakeNode::QmlClass) { const QmlNode* qmlNode = static_cast<const QmlNode*>(fakeNode); - qDebug() << "HtmlGenerator: QML CLASS" << qmlNode->name(); + //qDebug() << "HtmlGenerator: QML CLASS" << qmlNode->name(); const Node* n = qmlNode->classNode(); if (n) - qDebug() << " FOUND IT!" << n->name(); + //qDebug() << " FOUND IT!" << n->name(); } qmlClasses.insert(fakeNode->name(),*c); } @@ -2922,9 +2971,11 @@ const Node *HtmlGenerator::findNodeForTarget(const QString &target, if (target.isEmpty()) { node = relative; - } else if (target.endsWith(".html")) { + } + else if (target.endsWith(".html")) { node = tre->root()->findNode(target, Node::Fake); - } else if (marker) { + } + else if (marker) { node = marker->resolveTarget(target, tre, relative); if (!node) node = tre->findFakeNodeByTitle(target); @@ -2969,11 +3020,13 @@ QString HtmlGenerator::getLink(const Atom *atom, || atom->string().startsWith("mailto:"))) { link = atom->string(); - } else { + } + else { QStringList path; if (atom->string().contains('#')) { path = atom->string().split('#'); - } else { + } + else { path.append(atom->string()); } @@ -2982,9 +3035,11 @@ QString HtmlGenerator::getLink(const Atom *atom, QString first = path.first().trimmed(); if (first.isEmpty()) { node = relative; - } else if (first.endsWith(".html")) { + } + else if (first.endsWith(".html")) { node = tre->root()->findNode(first, Node::Fake); - } else { + } + else { node = marker->resolveTarget(first, tre, relative); if (!node) node = tre->findFakeNodeByTitle(first); @@ -2997,7 +3052,8 @@ QString HtmlGenerator::getLink(const Atom *atom, return node->url(); else path.removeFirst(); - } else { + } + else { node = relative; } diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 39e286e..2d50279 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -198,9 +198,11 @@ void PageGenerator::generateInnerNode(const InnerNode *node, } else if (node->type() == Node::Fake) { const FakeNode* fakeNode = static_cast<const FakeNode *>(node); +#ifdef QDOC_QML if (fakeNode->subType() == FakeNode::QmlClass) { - qDebug() << "FILENAME:" << fileName(node); + //qDebug() << "FILENAME:" << fileName(node); } +#endif generateFakeNode(static_cast<const FakeNode *>(node), marker); } endSubPage(); diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index 0d0b664..6cf7377 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -99,6 +99,14 @@ body pre color: black } +table tr.qt-code pre +{ + padding: 0.2em; + border: #e7e7e7 1px solid; + background: #f1f1f1; + color: black +} + span.preprocessor, span.preprocessor a { color: darkblue; diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index d14f80a..85fe1db 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -23,5 +23,7 @@ macro.rarrow.HTML = "→" macro.reg.HTML = "<sup>®</sup>" macro.return = "Returns" macro.starslash = "\\c{*/}" +macro.begincomment = "\\c{/*}" +macro.endcomment = "\\c{*/}" macro.uuml.HTML = "ü" macro.mdash.HTML = "—" diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index 2e91ba2..bc5656b 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -9,7 +9,7 @@ url = ./ # Ensures that the documentation for the tools is not included in the generated # .qhp file. -qhp.Qt.excluded = $QT_SOURCE_TREE/doc/src/assistant-manual.qdoc \ +qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/assistant-manual.qdoc \ $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ $QT_SOURCE_TREE/doc/src/designer-manual.qdoc \ $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index a085768..25cdc5a 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -92,7 +92,11 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ $QT_SOURCE_TREE/src/3rdparty/wintab \ $QT_SOURCE_TREE/src/3rdparty/zlib \ - $QT_SOURCE_TREE/doc/src/snippets + $QT_SOURCE_TREE/doc/src/snippets \ + $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ + $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/waveout sources.fileextensions = "*.cpp *.qdoc *.mm" examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 298311e..4d401a4 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.450 +qhp.Qt.namespace = com.trolltech.qt.451 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp index b6a715c..62149a1 100644 --- a/tools/qvfb/qvfb.cpp +++ b/tools/qvfb/qvfb.cpp @@ -217,16 +217,10 @@ QVFb::QVFb( int display_id, int w, int h, int d, int r, const QString &skin, Dis setWindowIcon( pix ); rateDlg = 0; refreshRate = 30; -#if QT_VERSION >= 0x030000 - // When compiling with Qt 3 we need to create the menu first to - // avoid scroll bars in the main window + // Create the menu first to avoid scroll bars in the main window createMenu( menuBar() ); init( display_id, w, h, d, r, skin ); enableCursor( true ); -#else - init( display_id, w, h, d, r, skin ); - createMenu( menuBar() ); -#endif } QVFb::~QVFb() @@ -354,9 +348,7 @@ void QVFb::init( int display_id, int pw, int ph, int d, int r, const QString& sk scroller->setWidget(view); view->setContentsMargins( 0, 0, 0, 0 ); setCentralWidget(scroller); -#if QT_VERSION >= 0x030000 ph += 2; // avoid scrollbar -#endif scroller->show(); // delete defaultbuttons.conf if it was left behind... unlink(QFileInfo(QString("/tmp/qtembedded-%1/defaultbuttons.conf").arg(view->displayId())).absoluteFilePath().toLatin1().constData()); diff --git a/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp b/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp index ecdaf16..09394e7 100644 --- a/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp +++ b/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp @@ -48,9 +48,7 @@ #include <QtGui/QToolButton> #include <QtGui/QStyle> -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtButtonPropertyBrowserPrivate { @@ -626,8 +624,6 @@ bool QtButtonPropertyBrowser::isExpanded(QtBrowserItem *item) const return false; } -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #include "moc_qtbuttonpropertybrowser.cpp" diff --git a/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h b/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h index 0833c2d..0238f5c 100644 --- a/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h +++ b/tools/shared/qtpropertybrowser/qtbuttonpropertybrowser.h @@ -44,9 +44,7 @@ #include "qtpropertybrowser.h" -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtButtonPropertyBrowserPrivate; @@ -82,8 +80,6 @@ private: }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #endif diff --git a/tools/shared/qtpropertybrowser/qteditorfactory.cpp b/tools/shared/qtpropertybrowser/qteditorfactory.cpp index 3e9336f..a2e3917 100644 --- a/tools/shared/qtpropertybrowser/qteditorfactory.cpp +++ b/tools/shared/qtpropertybrowser/qteditorfactory.cpp @@ -62,9 +62,7 @@ # pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ #endif -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif // Set a hard coded left margin to account for the indentation // of the tree view icon when switching to an editor @@ -2583,9 +2581,7 @@ void QtFontEditorFactory::disconnectPropertyManager(QtFontPropertyManager *manag disconnect(manager, SIGNAL(valueChanged(QtProperty*,QFont)), this, SLOT(slotPropertyChanged(QtProperty*,QFont))); } -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #include "moc_qteditorfactory.cpp" #include "qteditorfactory.moc" diff --git a/tools/shared/qtpropertybrowser/qteditorfactory.h b/tools/shared/qtpropertybrowser/qteditorfactory.h index 044dd5e..d86f9f6 100644 --- a/tools/shared/qtpropertybrowser/qteditorfactory.h +++ b/tools/shared/qtpropertybrowser/qteditorfactory.h @@ -44,9 +44,7 @@ #include "qtpropertymanager.h" -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtSpinBoxFactoryPrivate; @@ -394,8 +392,6 @@ private: Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QFont &)) }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #endif diff --git a/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp b/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp index d7c8f0b..9ac9744 100644 --- a/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp +++ b/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.cpp @@ -47,9 +47,7 @@ #include <QtCore/QTimer> #include <QtCore/QMap> -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtGroupBoxPropertyBrowserPrivate { @@ -528,8 +526,6 @@ void QtGroupBoxPropertyBrowser::itemChanged(QtBrowserItem *item) d_ptr->propertyChanged(item); } -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #include "moc_qtgroupboxpropertybrowser.cpp" diff --git a/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h b/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h index 29422bd..6d1b2b1 100644 --- a/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h +++ b/tools/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h @@ -44,9 +44,7 @@ #include "qtpropertybrowser.h" -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtGroupBoxPropertyBrowserPrivate; @@ -73,8 +71,6 @@ private: }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #endif diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowser.cpp b/tools/shared/qtpropertybrowser/qtpropertybrowser.cpp index 7254245..cca082d 100644 --- a/tools/shared/qtpropertybrowser/qtpropertybrowser.cpp +++ b/tools/shared/qtpropertybrowser/qtpropertybrowser.cpp @@ -48,9 +48,7 @@ # pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ #endif -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtPropertyPrivate { @@ -1958,8 +1956,6 @@ void QtAbstractPropertyBrowser::setCurrentItem(QtBrowserItem *item) emit currentItemChanged(item); } -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #include "moc_qtpropertybrowser.cpp" diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowser.h b/tools/shared/qtpropertybrowser/qtpropertybrowser.h index 649a9e3..20ffb81 100644 --- a/tools/shared/qtpropertybrowser/qtpropertybrowser.h +++ b/tools/shared/qtpropertybrowser/qtpropertybrowser.h @@ -45,11 +45,7 @@ #include <QtGui/QWidget> #include <QtCore/QSet> -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif - - class QtAbstractPropertyManager; class QtPropertyPrivate; @@ -308,8 +304,6 @@ private: }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #endif // QTPROPERTYBROWSER_H diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp index d689e60..94b0285 100644 --- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp +++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp @@ -48,9 +48,7 @@ #include <QtGui/QLineEdit> #include <QtGui/QMenu> -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif QtCursorDatabase::QtCursorDatabase() { @@ -426,9 +424,4 @@ bool QtKeySequenceEdit::event(QEvent *e) return QWidget::event(e); } - - - -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h index 2eab3c8..fe8c6d1 100644 --- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h +++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h @@ -58,9 +58,7 @@ #include <QtGui/QWidget> #include <QtCore/QStringList> -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QMouseEvent; class QCheckBox; @@ -154,8 +152,6 @@ private: QLineEdit *m_lineEdit; }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #endif diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp index 8b84eb9..47b8c9b 100644 --- a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -61,9 +61,7 @@ # pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ #endif -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif template <class PrivateData, class Value> static void setSimpleMinimumData(PrivateData *data, const Value &minVal) @@ -421,23 +419,6 @@ private: QMetaEnum m_policyEnum; }; -#if QT_VERSION < 0x040300 - -static QList<QLocale::Country> countriesForLanguage(QLocale::Language language) -{ - QList<QLocale::Country> countries; - QLocale::Country country = QLocale::AnyCountry; - while (country <= QLocale::LastCountry) { - QLocale locale(language, country); - if (locale.language() == language && !countries.contains(locale.country())) - countries << locale.country(); - country = (QLocale::Country)((uint)country + 1); // ++country - } - return countries; -} - -#endif - static QList<QLocale::Country> sortCountries(const QList<QLocale::Country> &countries) { QMultiMap<QString, QLocale::Country> nameToCountry; @@ -469,11 +450,7 @@ void QtMetaEnumProvider::initLocale() while (itLang.hasNext()) { QLocale::Language language = itLang.next(); QList<QLocale::Country> countries; -#if QT_VERSION < 0x040300 - countries = countriesForLanguage(language); -#else countries = QLocale::countriesForLanguage(language); -#endif if (countries.isEmpty() && language == system.language()) countries << system.country(); @@ -5789,9 +5766,7 @@ QtFontPropertyManager::QtFontPropertyManager(QObject *parent) { d_ptr = new QtFontPropertyManagerPrivate; d_ptr->q_ptr = this; -#if QT_VERSION >= 0x040500 QObject::connect(qApp, SIGNAL(fontDatabaseChanged()), this, SLOT(slotFontDatabaseChanged())); -#endif d_ptr->m_intPropertyManager = new QtIntPropertyManager(this); connect(d_ptr->m_intPropertyManager, SIGNAL(valueChanged(QtProperty *, int)), @@ -6485,9 +6460,7 @@ void QtCursorPropertyManager::uninitializeProperty(QtProperty *property) d_ptr->m_values.remove(property); } -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #include "moc_qtpropertymanager.cpp" #include "qtpropertymanager.moc" diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.h b/tools/shared/qtpropertybrowser/qtpropertymanager.h index 90fe5c0..2fb69bf 100644 --- a/tools/shared/qtpropertybrowser/qtpropertymanager.h +++ b/tools/shared/qtpropertybrowser/qtpropertymanager.h @@ -44,9 +44,7 @@ #include "qtpropertybrowser.h" -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QDate; class QTime; @@ -743,8 +741,6 @@ private: Q_DISABLE_COPY(QtCursorPropertyManager) }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #endif diff --git a/tools/shared/qtpropertybrowser/qttreepropertybrowser.cpp b/tools/shared/qtpropertybrowser/qttreepropertybrowser.cpp index 446be39..1ad3f6b 100644 --- a/tools/shared/qtpropertybrowser/qttreepropertybrowser.cpp +++ b/tools/shared/qtpropertybrowser/qttreepropertybrowser.cpp @@ -52,9 +52,7 @@ #include <QtGui/QStyle> #include <QtGui/QPalette> -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtPropertyEditorView; @@ -436,9 +434,7 @@ void QtTreePropertyBrowserPrivate::init(QWidget *parent) layout->setMargin(0); m_treeWidget = new QtPropertyEditorView(parent); m_treeWidget->setEditorPrivate(this); - const int indicatorWidth = m_treeWidget->style()->pixelMetric(QStyle::PM_IndicatorWidth, 0, m_treeWidget); - QSize iconSize(indicatorWidth, indicatorWidth); - m_treeWidget->setIconSize(QSize(indicatorWidth, indicatorWidth)); + m_treeWidget->setIconSize(QSize(18, 18)); layout->addWidget(m_treeWidget); m_treeWidget->setColumnCount(2); @@ -1042,9 +1038,7 @@ void QtTreePropertyBrowser::editItem(QtBrowserItem *item) d_ptr->editItem(item); } -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #include "moc_qttreepropertybrowser.cpp" #include "qttreepropertybrowser.moc" diff --git a/tools/shared/qtpropertybrowser/qttreepropertybrowser.h b/tools/shared/qtpropertybrowser/qttreepropertybrowser.h index 63bd7f6..813e050 100644 --- a/tools/shared/qtpropertybrowser/qttreepropertybrowser.h +++ b/tools/shared/qtpropertybrowser/qttreepropertybrowser.h @@ -44,9 +44,7 @@ #include "qtpropertybrowser.h" -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QTreeWidgetItem; class QtTreePropertyBrowserPrivate; @@ -131,8 +129,6 @@ private: }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #endif diff --git a/tools/shared/qtpropertybrowser/qtvariantproperty.cpp b/tools/shared/qtpropertybrowser/qtvariantproperty.cpp index 7e1975e..f712ba6 100644 --- a/tools/shared/qtpropertybrowser/qtvariantproperty.cpp +++ b/tools/shared/qtpropertybrowser/qtvariantproperty.cpp @@ -51,9 +51,7 @@ # pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ #endif -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtEnumPropertyType { @@ -69,17 +67,13 @@ class QtGroupPropertyType { }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif Q_DECLARE_METATYPE(QtEnumPropertyType) Q_DECLARE_METATYPE(QtFlagPropertyType) Q_DECLARE_METATYPE(QtGroupPropertyType) -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif /*! Returns the type id for an enum property. @@ -2275,8 +2269,6 @@ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager d_ptr->m_checkBoxFactory->removePropertyManager(itFlag.next()->subBoolPropertyManager()); } -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif #include "moc_qtvariantproperty.cpp" diff --git a/tools/shared/qtpropertybrowser/qtvariantproperty.h b/tools/shared/qtpropertybrowser/qtvariantproperty.h index 91397d8..9253809 100644 --- a/tools/shared/qtpropertybrowser/qtvariantproperty.h +++ b/tools/shared/qtpropertybrowser/qtvariantproperty.h @@ -46,9 +46,7 @@ #include <QtCore/QVariant> #include <QtGui/QIcon> -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif typedef QMap<int, QIcon> QtIconMap; @@ -172,9 +170,7 @@ private: Q_DISABLE_COPY(QtVariantEditorFactory) }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif Q_DECLARE_METATYPE(QIcon) Q_DECLARE_METATYPE(QtIconMap) diff --git a/util/scripts/mac-binary/doit.sh b/util/scripts/mac-binary/doit.sh deleted file mode 100755 index 109f014..0000000 --- a/util/scripts/mac-binary/doit.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -e -[ -r $HOME/.bashrc ] && . $HOME/.bashrc -VERSION=$1 - -PACKAGE=qt-mac-commercial-src-${VERSION}.tar.gz -OSPACKAGE=qt-mac-opensource-src-${VERSION}.tar.gz -EVALPACKAGE=qt-mac-evalpatches-src-${VERSION}.tar.gz - -echo Downloading source packages... -curl -O http://tirion.troll.no/~qt/packages/$VERSION/$PACKAGE -curl -O http://tirion.troll.no/~qt/packages/$VERSION/$OSPACKAGE -curl -O http://tirion.troll.no/~qt/packages/$VERSION/$EVALPACKAGE - -echo Building commercial package... -./package/mkpackage -packages $HOME/tmp/mac-binary/install -qtpackage $PWD/$PACKAGE >log 2>&1 - -echo Building opensource package... -./package/mkpackage -packages $HOME/tmp/mac-binary/install -qtpackage $PWD/$OSPACKAGE >>log 2>&1 - -echo Building eval package... -./package/mkpackage -packages $HOME/tmp/mac-binary/install -qtpackage $PWD/$PACKAGE -licensetype eval >>log 2>&1 - -echo -n Uploading results... -scp -B outputs/*.dmg qt@tirion:public_html/packages/$VERSION diff --git a/util/scripts/mac-binary/install/debuglibraries/Info.plist b/util/scripts/mac-binary/install/debuglibraries/Info.plist deleted file mode 100644 index b421879..0000000 --- a/util/scripts/mac-binary/install/debuglibraries/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Debug Libraries</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.debuglibs</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Debug Libraries</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <false/> - <key>IFPkgFlagIsRequired</key> - <false/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/debuglibraries/Resources/Description.plist b/util/scripts/mac-binary/install/debuglibraries/Resources/Description.plist deleted file mode 100644 index d12abfd..0000000 --- a/util/scripts/mac-binary/install/debuglibraries/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Debug Libraries</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt Debug Libraries</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/debuglibraries/Resources/Readme.rtf b/util/scripts/mac-binary/install/debuglibraries/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/debuglibraries/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/debuglibraries/Resources/debuglibraries.info b/util/scripts/mac-binary/install/debuglibraries/Resources/debuglibraries.info deleted file mode 100644 index 7acd621..0000000 --- a/util/scripts/mac-binary/install/debuglibraries/Resources/debuglibraries.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Libraries -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Debug Libraries -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/debuglibraries/Resources/postflight b/util/scripts/mac-binary/install/debuglibraries/Resources/postflight deleted file mode 100755 index be34b81..0000000 --- a/util/scripts/mac-binary/install/debuglibraries/Resources/postflight +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -#fix the doc path -#PACK_LOCATION="$1" -#INST_LOCATION="$3" -#"$PACK_LOCATION/Contents/Resources/qtconf.pl" -version $VERSION_MAJOR$.$VERSION_MINOR$ -value "$INST_LOCATION/System/Library" Libraries - -t() -{ - o="$1" - i="$INSTALLER_TEMP/`basename $o`_t" - rm -f "$i" - mv "$o" "$i" - perl -e "open(SIN, \"<\" . \"$i\"); - open(SOUT, \">\" . \"$o\"); - local $/; - binmode SIN; - binmode SOUT; - \$ulen = length(\"$2\")+1; - \$plen = length(\"$3\")+1; - \$klen = length(\"$4\")+1; - while(\$C = <SIN>) { - \$C =~ s,(qt_lcnsuser=).{\$ulen},\\1$2\\0,; - \$C =~ s,(qt_lcnsprod=).{\$plen},\1$3\0,; - \$C =~ s,(qt_qevalkey=).{\$klen},\1$4\0,; - print SOUT \$C; - } - close SIN; - close SOUT" -} - -for lib in QtCore QtGui QtNetwork QtXml QtOpenGL QtSql Qt3Support QtSvg QtScript; do - [ -d "${3}/Library/Frameworks/${lib}.framework" ] || continue - cd "${3}/Library/Frameworks/${lib}.framework/Versions/$VERSION_MAJOR$.0" - Products="bad product" - (Licensee="not-licensed"; LicenseKeyExt="bad-license"; . $HOME/.qt-license >/dev/null 2>&1 - if [ "$LicenseKeyExt" != "bad-license" ]; then - productTest=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1` - case $productTest in - F) - # Universal - Products="Universal" - ;; - B) - # Desktop - Products="Desktop" - ;; - L) - # Desktop Lite - Products="Desktop Light" - ;; - *) - Products="bad product" - esac - fi - t "${lib}_debug" "$Licensee" "$Products" "$LicenseKeyExt") -done - -exit 0 diff --git a/util/scripts/mac-binary/install/debuglibraries/create_package.sh b/util/scripts/mac-binary/install/debuglibraries/create_package.sh deleted file mode 100755 index ed3a85d..0000000 --- a/util/scripts/mac-binary/install/debuglibraries/create_package.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -SRCDIR= -OUTDIR= -DO_DEBUG=yes -while [ -n "$1" ]; do - echo "$1" | grep '^--*=*' >/dev/null 2>&1 || break - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - debug) DO_DEBUG="$ARG" ;; - qtsrc) SRCDIR="$ARG" ;; - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done -[ -z "$OUTDIR" ] && exit 1 - -#setup -FRAMEWORK_DIR="$OUTDIR/Library/Frameworks" -mkdir -p "$FRAMEWORK_DIR" - -for lib in QtCore QtGui QtNetwork QtXml QtOpenGL QtSql Qt3Support QtSvg QtAssistant QtDesigner QtDesignerComponents QtTest QtScript QtScriptTools QtHelp QtXmlPatterns QtWebKit QtDBus phonon; do - if [ ! -d "$BINDIR/lib/${lib}.framework" ]; then - echo "No framework for $lib!" - continue - fi - cp -R "$BINDIR/lib/${lib}.framework" "$FRAMEWORK_DIR/" >/dev/null 2>&1 - ../libraries/fix_config_paths.pl "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}_debug" "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}_debug.fixed" - mv "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}_debug.fixed" "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}_debug" - ../libraries/fix_prl_paths.pl "$FRAMEWORK_DIR/${lib}.framework/${lib}_debug.prl" "$FRAMEWORK_DIR/${lib}.framework/${lib}_debug.prl.fixed" - mv "$FRAMEWORK_DIR/${lib}.framework/${lib}_debug.prl.fixed" "$FRAMEWORK_DIR/${lib}.framework/${lib}_debug.prl" - # Remove the normal libraries and headers (they are part of another package) - # some find command here. - find "$FRAMEWORK_DIR/${lib}.framework" -name ${lib} -o -name ${lib}'.*' -a ! -name ${lib}.framework | xargs rm >/dev/null 2>&1 - find "$FRAMEWORK_DIR/${lib}.framework/" -name Headers -exec rm -rf {} \; >/dev/null 2>&1 - # Since we are using dwarf-2 for debugging, we need to store the dSYM bundles as well. - /usr/bin/dsymutil -o "$FRAMEWORK_DIR/${lib}.framework/${lib}_debug.dSYM" "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}_debug" -done - -#Handle the libraries in tools as well -mkdir -p "$OUTDIR/usr/lib" - -#first QtAssistantClient, and QtUiTools since they are static -for lib in libQtUiTools_debug.a; do - [ -e "$BINDIR/lib/${lib}" ] && cp "$BINDIR/lib/${lib}" "$OUTDIR/usr/lib/${lib}" -done - -if [ -e "${BINDIR}/lib/libQtCLucene_debug.${VERSION_MAJOR}.dylib" ]; then - mkdir -p "$OUTDIR/usr/lib" - for lib in libQtCLucene_debug.dylib libQtCLucene_debug.${VERSION_MAJOR}.dylib libQtCLucene_debug.${VERSION_MAJOR}.${VERSION_MINOR}.dylib libQtCLucene_debug.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dylib; do - cp -R "${BINDIR}/lib/$lib" "$OUTDIR/usr/lib/" - /usr/bin/dsymutil "$OUTDIR/usr/lib/$lib" - done -fi - - -# Now for the plugins -for plugin in `find $BINDIR/plugins/ -name 'lib*.dylib'`; do - if echo `basename $plugin` | grep "_debug" >/dev/null 2>&1; then - out_plugin=`echo $plugin | sed "s,^$BINDIR,$OUTDIR/Developer/Applications/Qt,g"` - pluginDirName= `dirname $out_plugin` - mkdir -p $pluginDirName - [ -e "$plugin" ] && ../libraries/fix_config_paths.pl "$plugin" "$out_plugin" - /usr/bin/dsymutil -o "$pluginDirName/$out_plugin.dSYM" "$out_plugin" - fi -done - -exit 0 diff --git a/util/scripts/mac-binary/install/docs/Info.plist b/util/scripts/mac-binary/install/docs/Info.plist deleted file mode 100644 index f67feed..0000000 --- a/util/scripts/mac-binary/install/docs/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Documentation</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.docs</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Documentation</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <false/> - <key>IFPkgFlagIsRequired</key> - <false/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/docs/Resources/Description.plist b/util/scripts/mac-binary/install/docs/Resources/Description.plist deleted file mode 100644 index b89be7b..0000000 --- a/util/scripts/mac-binary/install/docs/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Documentation</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt Documentation</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/docs/Resources/Readme.rtf b/util/scripts/mac-binary/install/docs/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/docs/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/docs/Resources/docs.info b/util/scripts/mac-binary/install/docs/Resources/docs.info deleted file mode 100644 index 6be46f2..0000000 --- a/util/scripts/mac-binary/install/docs/Resources/docs.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Documentation -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Documentation -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/docs/Resources/postflight b/util/scripts/mac-binary/install/docs/Resources/postflight deleted file mode 100755 index ecd77da..0000000 --- a/util/scripts/mac-binary/install/docs/Resources/postflight +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -#fix the doc path -#PACK_LOCATION="$1" -#INST_LOCATION="$3" -#"$PACK_LOCATION/Contents/Resources/qtconf.pl" -version $VERSION_MAJOR$.$VERSION_MINOR$ -value "$INST_LOCATION/Developer/Documentation/Qt" Documentation - -#get the documentation into the index -DOC_INDEX="/Developer/Documentation/Help/Developer Help Viewer/MacOSXDeveloper.pbHelpIndexerList" -if [ -e "$DOC_INDEX" ]; then - if grep "$3/Developer/Documentation/Qt" "$DOC_INDEX" >/dev/null 2>&1; then - true - else - echo "$3/Developer/Documentation/Qt" >>"$$DOC_INDEX" - /Developer/Tools/pbhelpindexer & - fi -fi
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/docs/create_package.sh b/util/scripts/mac-binary/install/docs/create_package.sh deleted file mode 100755 index fccd6fc..0000000 --- a/util/scripts/mac-binary/install/docs/create_package.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -SRCDIR= -OUTDIR= -while [ -n "$1" ]; do - echo "$1" | grep '^--*=*' >/dev/null 2>&1 || break - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - qtsrc) SRCDIR="$ARG" ;; - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done -[ -z "$OUTDIR" ] && exit 1 - -mkdir -p "$OUTDIR/Developer/Documentation/Qt" -for dir in `find "$SRCDIR/doc" -name 'html*' -type d`; do - cp -R "$dir" "$OUTDIR/Developer/Documentation/Qt" -done - -for dir in `find "$SRCDIR/doc" -name 'qch' -type d`; do - cp -R "$dir" "$OUTDIR/Developer/Documentation/Qt" -done - -# The old code. -#cp -R "$SRCDIR/doc/html/" "$OUTDIR/Developer/Documentation/Qt" -#[ "$SRCDIR" != "$BINDIR" ] && cp -R "$BINDIR/doc/html/" "$OUTDIR/Developer/Documentation/Qt" -#ln -s . "$OUTDIR/Developer/Documentation/Qt/html" - -exit 0 diff --git a/util/scripts/mac-binary/install/examples/Info.plist b/util/scripts/mac-binary/install/examples/Info.plist deleted file mode 100644 index 1799025..0000000 --- a/util/scripts/mac-binary/install/examples/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Examples</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.examples</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Examples</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <true/> - <key>IFPkgFlagIsRequired</key> - <false/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/examples/Resources/Description.plist b/util/scripts/mac-binary/install/examples/Resources/Description.plist deleted file mode 100644 index ad798e3..0000000 --- a/util/scripts/mac-binary/install/examples/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Examples</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt Examples</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/examples/Resources/Readme.rtf b/util/scripts/mac-binary/install/examples/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/examples/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/examples/Resources/examples.info b/util/scripts/mac-binary/install/examples/Resources/examples.info deleted file mode 100644 index f94a510..0000000 --- a/util/scripts/mac-binary/install/examples/Resources/examples.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Examples -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Examples -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/examples/Resources/postflight b/util/scripts/mac-binary/install/examples/Resources/postflight deleted file mode 100644 index e7c10e7..0000000 --- a/util/scripts/mac-binary/install/examples/Resources/postflight +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python - -import os, sys, grp - -startPath = os.path.join(sys.argv[2], "Developer/Examples/Qt") -qmakeCache = open(os.path.join(startPath, ".qmake.cache"), "w") -qmakeCache.write("#nothing anymore...") -qmakeCache.close() -adminGid = grp.getgrnam('admin')[2] - -# Generate Xcode projects for everything and make things -# writeable to the admin users -for root, dirs, files in os.walk(startPath, topdown = False): - for name in files: - fullName = os.path.join(root, name) - currUid = os.stat(fullName).st_uid - if name.endswith(".pro"): - os.chdir(os.path.dirname(fullName)) - print "/usr/bin/qmake -spec macx-xcode %s [%s]" % (name, fullName) - sys.stdout.flush() # To make the logger update in a timely fashion - os.system('/usr/bin/qmake -spec macx-xcode "%s"' % (name)) - os.chown(fullName, currUid, adminGid) - if os.access(fullName, os.X_OK): - os.chmod(fullName, 0775) - elif os.access(fullName, os.W_OK): - os.chmod(fullName, 0664) - for name in dirs: - fullName = os.path.join(root, name) - currUid = os.stat(fullName).st_uid - os.chown(fullName, currUid, adminGid) - os.chmod(fullName, 0775) diff --git a/util/scripts/mac-binary/install/examples/create_package.sh b/util/scripts/mac-binary/install/examples/create_package.sh deleted file mode 100755 index f2a82f2..0000000 --- a/util/scripts/mac-binary/install/examples/create_package.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -SRCDIR= -OUTDIR= -while [ -n "$1" ]; do - echo "$1" | grep '^--*=*' >/dev/null 2>&1 || break - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - qtsrc) SRCDIR="$ARG" ;; - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done -[ -z "$OUTDIR" ] && exit 1 - -mkdir -p "$OUTDIR/Developer/Examples/Qt" - -get_sources() -{ - DIR="$1" - IN="$2" - for file in `find $DIR -type f`; do - case $file in #only need sources - */ui_*.h|*/moc_*.cpp|*/qrc_*.cpp|*.app|*.app/*|*/.obj/*|*/.ui/*|*/.rcc/*|*/.moc/*|*/Makefile|*.build*|*.xcode*|*/build|*/build/*|*.doc|*~|*.gch|*.gch/*|*/.DS_Store|*/.gdb_history) continue ;; - *) ;; - esac - [ -x "$file" ] && continue - FILE=`echo "$file" | sed "s,^$DIR,,"` - mkdir -p "$OUTDIR/Developer/Examples/Qt/$IN/`dirname $FILE`" - cp "$file" "$OUTDIR/Developer/Examples/Qt/$IN/$FILE" - done -} - -#examples -get_sources "$SRCDIR/examples/" -rm -rf "$OUTDIR/Developer/Examples/Qt/activeqt" #we don't need it -for category_dir in $BINDIR/examples/*; do - for example_dir in $category_dir/*; do - [ -d "$example_dir" ] || continue - example_cat=`echo $example_dir | sed "s,^$BINDIR/examples/,,"` - [ -d "${OUTDIR}/Developer/Examples/Qt/${example_cat}" ] || continue - example=`basename $example_dir` - EXE= - if [ -x "${example_dir}/${example}" ]; then - mkdir -p "${OUTDIR}/Developer/Examples/Qt/${example_cat}/" - EXE="${OUTDIR}/Developer/Examples/Qt/${example_cat}/${example}" - cp "${example_dir}/${example}" "$EXE" - elif [ -d "${example_dir}/${example}.app" ]; then #in a bundle - mkdir -p "${OUTDIR}/Developer/Examples/Qt/${example_cat}/" - cp -R "${example_dir}/${example}.app" "${OUTDIR}/Developer/Examples/Qt/${example_cat}/" - EXE="${OUTDIR}/Developer/Examples/Qt/${example_cat}/${example}.app/Contents/MacOS/${example}" - else - FOUND=no - for f in ${example_dir}/*; do - if [ '!' -d "$f" ] && [ -x "$f" ]; then - FOUND=yes - mkdir -p "${OUTDIR}/Developer/Examples/Qt/${example_cat}/" - EXE="${OUTDIR}/Developer/Examples/Qt/${example_cat}/`basename $f`" - cp "$f" "$EXE" - elif echo "$f" | grep ".dylib$" >/dev/null 2>&1; then - FOUND=yes - mkdir -p "${OUTDIR}/Developer/Examples/Qt/${example_cat}/" - EXE="${OUTDIR}/Developer/Examples/Qt/${example_cat}/`basename $f`" - cp "$f" "$EXE" - elif [ -d "$f" ] && echo "$f" | grep ".app$" >/dev/null 2>&1; then - FOUND=yes - mkdir -p "${OUTDIR}/Developer/Examples/Qt/${example_cat}/" - cp -R "$f" "${OUTDIR}/Developer/Examples/Qt/${example_cat}/" - APP_NAME=`basename $f | sed "s,\.app$,,"` - EXE="${OUTDIR}/Developer/Examples/Qt/${example_cat}/${APP_NAME}.app/Contents/MacOS/$APP_NAME" - fi - done - #[ "$FOUND" = "no" ] && echo "Unable to find binary for Example [$example]" - fi - if [ "$example" = "plugandpaint" ]; then - PLG="${OUTDIR}/Developer/Examples/Qt/${example_cat}/plugins/" - mkdir -p "$PLG" - for plugin in ${example_dir}/plugins/*.dylib; do - ../libraries/fix_config_paths.pl "$plugin" "/tmp/tmp.plg" - cp "/tmp/tmp.plg" "$PLG/`basename $plugin`" - rm -f "/tmp/tmp.plg" - done - fi - if [ -x "$EXE" ]; then - ../libraries/fix_config_paths.pl "$EXE" "/tmp/tmp.exe" - strip "/tmp/tmp.exe" - cp "/tmp/tmp.exe" "$EXE" - rm -f "/tmp/tmp.exe" - chmod a+x "$EXE" - fi - done -done - -#demos -get_sources "$SRCDIR/demos" "Demos" -for demo_dir in $BINDIR/demos/*; do - [ -d "$demo_dir" ] || continue - demo=`basename $demo_dir` - EXE= - if [ "$demo" = "qtdemo" ]; then - mkdir -p "${OUTDIR}/Developer/Applications/Qt/" - cp -R "$BINDIR/bin/${demo}.app" "${OUTDIR}/Developer/Applications/Qt/" - EXE="${OUTDIR}/Developer/Applications/Qt/${demo}.app/Contents/MacOS/${demo}" - elif [ -x "${demo_dir}/${demo}" ]; then - mkdir -p "${OUTDIR}/Developer/Examples/Qt/Demos/${demo}" - EXE="${OUTDIR}/Developer/Examples/Qt/Demos/${demo_dir}/${demo}" - cp "${demo}/${demo}" "$EXE" - elif [ -d "${demo_dir}/${demo}.app" ]; then #in a bundle - mkdir -p "${OUTDIR}/Developer/Examples/Qt/Demos/${demo}" - cp -R "${demo_dir}/${demo}.app" "${OUTDIR}/Developer/Examples/Qt/Demos/${demo}" - EXE="${OUTDIR}/Developer/Examples/Qt/Demos/${demo}/${demo}.app/Contents/MacOS/$demo" - else - FOUND=no - for f in ${demo_dir}/*; do - if [ '!' -d "$f" ] && [ -x "$f" ]; then - FOUND=yes - mkdir -p "${OUTDIR}/Developer/Examples/Qt/Demos/${demo}/" - EXE="${OUTDIR}/Developer/Examples/Qt/Demos/${demo_dir}/`basename $f`" - cp "$f" "$EXE" - elif echo "$f" | grep ".dylib$" >/dev/null 2>&1; then - FOUND=yes - mkdir -p "${OUTDIR}/Developer/Examples/Qt/Demos/${demo}/" - EXE="${OUTDIR}/Developer/Examples/Qt/Demos/${demo_dir}/`basename $f`" - cp "$f" "$EXE" - elif [ -d "$f" ] && echo "$f" | grep ".app$" >/dev/null 2>&1; then - FOUND=yes - mkdir -p "${OUTDIR}/Developer/Examples/Qt/Demos/${demo}/" - cp -R "$f" "${OUTDIR}/Developer/Examples/Qt/Demos/${demo}/" - APP_NAME=`basename $f | sed "s,\.app$,,"` - EXE="${OUTDIR}/Developer/Examples/Qt/Demos/${demo}/${APP_NAME}.app/Contents/MacOS/$APP_NAME}" - fi - done - fi - if [ -x "$EXE" ]; then - ../libraries/fix_config_paths.pl "$EXE" "/tmp/tmp.exe" - strip "/tmp/tmp.exe" - cp "/tmp/tmp.exe" "$EXE" - rm -f "/tmp/tmp.exe" - chmod a+x "$EXE" - fi -done - -exit 0 diff --git a/util/scripts/mac-binary/install/headers/Info.plist b/util/scripts/mac-binary/install/headers/Info.plist deleted file mode 100644 index 3cf7064..0000000 --- a/util/scripts/mac-binary/install/headers/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Headers</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.headers</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Headers</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <false/> - <key>IFPkgFlagIsRequired</key> - <false/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/headers/Resources/Description.plist b/util/scripts/mac-binary/install/headers/Resources/Description.plist deleted file mode 100644 index ddfe8a9..0000000 --- a/util/scripts/mac-binary/install/headers/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Headers</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt Headers</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/headers/Resources/Readme.rtf b/util/scripts/mac-binary/install/headers/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/headers/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/headers/Resources/headers.info b/util/scripts/mac-binary/install/headers/Resources/headers.info deleted file mode 100644 index a241de8e..0000000 --- a/util/scripts/mac-binary/install/headers/Resources/headers.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Headers -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Headers -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/headers/Resources/postflight b/util/scripts/mac-binary/install/headers/Resources/postflight deleted file mode 100755 index aefec7b..0000000 --- a/util/scripts/mac-binary/install/headers/Resources/postflight +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python - -import os, re - -def getEditionDefine(licenseKey): - ProductMap = { 'F': 'QT_EDITION_UNIVERSAL', 'B': 'QT_EDITION_DESKTOP', - 'L': 'QT_EDITION_DESKTOPLIGHT', 'R': 'QT_EDITION_CONSOLE', - 'OPEN': 'QT_EDITION_OPENSOURCE' } - - LicenseTypeMap = { 'Z4M': "QT_EDITION_EVALUATION", 'R4M': "QT_EDITION_EVALUATION", - 'Q4M': "QT_EDITION_EVALUATION", '34M': "QT_EDITION_ACADEMIC", - 'TBM': "QT_EDITION_EDUCATIONAL" } - - if len(licenseKey) == 0: - return 'QT_EDITION_UNKNOWN' - licenseParts = licenseKey.split('-') - productDefine = LicenseTypeMap.get(licenseParts[2], "") - if len(productDefine) == 0: - productDefine = ProductMap.get(licenseParts[0][0], 'QT_EDITION_UNKNOWN') - - return productDefine - -def alterQConfig(qconfigPath, licenseKey): - qconfigFile = open(qconfigPath, 'r') - qconfigLines = qconfigFile.readlines() - qconfigFile.close() - finalContents = [] - editionRE = re.compile(r"(^#\s*define QT_EDITION) (.*)$") - licenseKeyRE = re.compile(r'(^#define QT_PRODUCT_LICENSEKEY).*$') - - for line in qconfigLines: - tmpStr = line - matchObj = editionRE.search(line) - if matchObj: - tmpStr = matchObj.group(1) + " " + getEditionDefine(licenseKey) + "\n" - else: - matchObj = licenseKeyRE.search(line) - if matchObj: - tmpStr = matchObj.group(1) + ' "' + licenseKey + '"\n' - finalContents.append(tmpStr) - qconfigFile = open(qconfigPath, 'w') - qconfigFile.writelines(finalContents) - qconfigFile.close() - -def getLicenseKey(): - licensePath = os.path.join(os.environ["HOME"], ".qt-license") - if not os.path.exists(licensePath): - return "" - - licenseKeyRE = re.compile(r"^LicenseKeyExt=(.+)$") - file = open(licensePath, 'r') - for line in file: - matchObj = licenseKeyRE.search(line) - if matchObj: - return matchObj.group(1) - -if __name__ == "__main__": - import sys - qconfigPath = os.path.join(sys.argv[3], - "Library/Frameworks/QtCore.framework/Versions/4.0/Headers/qconfig.h") - alterQConfig(qconfigPath, getLicenseKey()) diff --git a/util/scripts/mac-binary/install/headers/create_package.sh b/util/scripts/mac-binary/install/headers/create_package.sh deleted file mode 100755 index 02ff489..0000000 --- a/util/scripts/mac-binary/install/headers/create_package.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -SRCDIR= -OUTDIR= -while [ -n "$1" ]; do - echo "$1" | grep '^--*=*' >/dev/null 2>&1 || break - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - qtsrc) SRCDIR="$ARG" ;; - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done -[ -z "$OUTDIR" ] && exit 1 - -#setup -FRAMEWORK_DIR="$OUTDIR/Library/Frameworks" -mkdir -p "$FRAMEWORK_DIR" - -for lib in QtCore QtGui QtNetwork QtXml QtOpenGL QtSql Qt3Support QtSvg QtScript QtScriptTools QtXmlPatterns QtWebKit QtDBus phonon; do - if [ ! -d "$BINDIR/lib/${lib}.framework/Headers" ]; then - echo "No headers for $lib" - continue - fi - (cd "$BINDIR/lib/${lib}.framework/" - for header in `find . -name Headers`; do - mkdir -p "$FRAMEWORK_DIR/${lib}.framework/`dirname $header`" - if [ -L "$header" ]; then - cp -RP "$header" "$FRAMEWORK_DIR/${lib}.framework/`dirname $header`" - else - cp -R "$header" "$FRAMEWORK_DIR/${lib}.framework/`dirname $header`" - fi - done) -done - -exit 0 diff --git a/util/scripts/mac-binary/install/libraries/Info.plist b/util/scripts/mac-binary/install/libraries/Info.plist deleted file mode 100644 index 6c70d73..0000000 --- a/util/scripts/mac-binary/install/libraries/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Libraries</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.libs</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Libraries</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <true/> - <key>IFPkgFlagIsRequired</key> - <true/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/libraries/Resources/Description.plist b/util/scripts/mac-binary/install/libraries/Resources/Description.plist deleted file mode 100644 index ffba86f..0000000 --- a/util/scripts/mac-binary/install/libraries/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Libraries</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt Libraries</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/libraries/Resources/Readme.rtf b/util/scripts/mac-binary/install/libraries/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/libraries/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/libraries/Resources/libraries.info b/util/scripts/mac-binary/install/libraries/Resources/libraries.info deleted file mode 100644 index aaad93f..0000000 --- a/util/scripts/mac-binary/install/libraries/Resources/libraries.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Libraries -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Libraries -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/libraries/Resources/postflight b/util/scripts/mac-binary/install/libraries/Resources/postflight deleted file mode 100755 index 4bcaa6c..0000000 --- a/util/scripts/mac-binary/install/libraries/Resources/postflight +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python - -import os, sys, shutil, re -def replaceStrings(library, licensee, product, licenseKey): - tmpLib = os.path.join(os.environ["INSTALLER_TEMP"], os.path.basename(library) + "_t") - if os.path.exists(tmpLib): - os.remove(tmpLib) - shutil.move(library, tmpLib) - tmpLibFile = open(tmpLib, 'r') - libraryFile = open(library, 'w') - namRe = re.compile(r'(qt_lcnsuser=).{' + str(len(licensee) + 1) + r'}') - prdRe = re.compile(r'(qt_lcnsprod=).{' + str(len(product) + 1) + r'}') - keyRe = re.compile(r'(qt_qevalkey=).{' + str(len(licenseKey) + 1) + r'}') - - for line in tmpLibFile.readlines(): - line = namRe.sub('\\1' + licensee + '\0', line) - line = prdRe.sub('\\1' + product + '\0', line) - line = keyRe.sub('\\1' + licenseKey + '\0', line) - libraryFile.write(line) - libraryFile.close() - tmpLibFile.close() - os.remove(tmpLib) - -def getEditionDefine(licenseKey): - ProductMap = { 'F': 'Universal', 'B': 'Desktop', - 'L': 'Desktop Light', 'R': 'Console', - 'OPEN': 'Opensource' } - - LicenseTypeMap = { 'Z4M': "Evaluation", 'R4M': "Evaluation", - 'Q4M': "Evaluation", '34M': "Academic", - 'TBM': "Educational" } - - if len(licenseKey) == 0: - return 'QT_EDITION_UNKNOWN' - licenseParts = licenseKey.split('-') - productDefine = LicenseTypeMap.get(licenseParts[2], "") - if len(productDefine) == 0: - productDefine = ProductMap.get(licenseParts[0][0], 'QT_EDITION_UNKNOWN') - - return productDefine - -def readLicenseFile(): - licenseKeyPath = os.path.join(os.environ['HOME'], '.qt-license'); - - licenseKeyRE = re.compile(r"^LicenseKeyExt=(.+)$") - licenseeRE = re.compile(r"^Licensee=(.+)$") - license = open(licenseKeyPath, 'r') - licensee = "Bad Licensee" - product = "Bad Product" - licensekey = "Bad Key" - for line in license: - matchObj = licenseeRE.match(line) - if matchObj: - licensee = matchObj.group(1) - else: - matchObj = licenseKeyRE.match(line) - if matchObj: - licensekey = matchObj.group(1) - product = getEditionDefine(licensekey) - return (licensee, product, licensekey) - -def fixLibraries(): - licensee, product, licensekey = readLicenseFile() - - frameworks = [ "QtCore", "QtGui", "QtNetwork", "QtXml", "QtOpenGL", "QtSql", "Qt3Support", "QtSvg", "QtScript" ] - for framework in frameworks: - frameworkPath = os.path.join(sys.argv[3], 'Library', 'Frameworks', framework + '.framework') - if not os.path.exists(frameworkPath): - continue - os.chdir(os.path.join(frameworkPath, 'Versions', '4.0')) - replaceStrings(framework, licensee, product, licensekey) - -if __name__ == "__main__": - fixLibraries() - sys.exit(0) - diff --git a/util/scripts/mac-binary/install/libraries/create_package.sh b/util/scripts/mac-binary/install/libraries/create_package.sh deleted file mode 100755 index 781f092..0000000 --- a/util/scripts/mac-binary/install/libraries/create_package.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -SRCDIR= -OUTDIR= -DO_DEBUG=yes -while [ -n "$1" ]; do - echo "$1" | grep '^--*=*' >/dev/null 2>&1 || break - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - debug) DO_DEBUG="$ARG" ;; - qtsrc) SRCDIR="$ARG" ;; - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done -[ -z "$OUTDIR" ] && exit 1 - -#setup -FRAMEWORK_DIR="$OUTDIR/Library/Frameworks" -mkdir -p "$FRAMEWORK_DIR" - -for lib in QtCore QtGui QtNetwork QtXml QtOpenGL QtSql Qt3Support QtSvg QtScript QtScriptTools QtXmlPatterns QtWebKit QtDBus phonon; do - if [ ! -d "$BINDIR/lib/${lib}.framework" ]; then - echo "No framework for $lib!" - continue - fi - cp -R "$BINDIR/lib/${lib}.framework" "$FRAMEWORK_DIR/" >/dev/null 2>&1 - ./fix_prl_paths.pl "$FRAMEWORK_DIR/${lib}.framework/${lib}.prl" "$FRAMEWORK_DIR/${lib}.framework/${lib}.prl.fixed" - mv "$FRAMEWORK_DIR/${lib}.framework/${lib}.prl.fixed" "$FRAMEWORK_DIR/${lib}.framework/${lib}.prl" - ./fix_config_paths.pl "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/$lib" "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}.fixed" - mv "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}.fixed" "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/$lib" - - # Make a sym-link to make things compatible with what we had in version before 4.2 - OLDDIR="$PWD" - cd "$FRAMEWORK_DIR/${lib}.framework/Versions" - ln -s "${VERSION_MAJOR}" "4.0" - cd "$OLDDIR" - # Remove the debug libraries and headers (they are part of another package) - find "$FRAMEWORK_DIR/${lib}.framework/" -name '*_debug*' -exec rm -f {} \; >/dev/null 2>&1 - find "$FRAMEWORK_DIR/${lib}.framework/" -name Headers -exec rm -rf {} \; >/dev/null 2>&1 -done - -exit 0 diff --git a/util/scripts/mac-binary/install/libraries/fix_config_paths.pl b/util/scripts/mac-binary/install/libraries/fix_config_paths.pl deleted file mode 100755 index 6b9d777..0000000 --- a/util/scripts/mac-binary/install/libraries/fix_config_paths.pl +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -#globals -my %VARS = ( - "docs" => "/Developer/Documentation/Qt", - "libs" => "/Library/Frameworks", - "plug" => "/Developer/Applications/Qt/plugins", - "trns" => "/Developer/Applications/Qt/translations", - "data" => "/usr/local/Qt" . $ENV{"VERSION_MAJOR"} . "." . $ENV{"VERSION_MINOR"}, - "bins" => "/Developer/Tools/Qt", - "demo" => "/Developer/Examples/Qt/Demos", - "xmpl" => "/Developer/Examples/Qt/", - "hdrs" => "/usr/include", - "prfx" => "/" -); -my $file_in = 0; -my $file_out = 0; - -#parse args -while ( @ARGV ) { - my $arg = shift @ARGV; - if($arg =~ /^-/) { - my $val = shift @ARGV; - my $var = $arg; - $var =~ s,^-,,; - $VARS{$var} = $val; - } elsif(!$file_in) { - $file_in = $arg; - } elsif(!$file_out) { - $file_out = $arg; - } else { - die "$0 <file_in> <file_out>"; - } -} -die "$0 <file_in> <file_out>" if(!$file_in || !$file_out); - -#open - -open(FIN , "<" . $file_in ) || die "Could not open $file_in for reading"; -open(FOUT, ">" . $file_out) || die "Could not open $file_out for writing"; -local $/; -binmode FIN; -binmode FOUT; - -#do stuff -while(my $CONTENT = <FIN>) { - foreach (keys(%VARS)) { - my $var = "qt_" . $_ . "path="; - my $val = $VARS{$_}; - my $val_length = length($val)+1; - $CONTENT =~ s,${var}.{$val_length},${var}${val}\0,g; - } - print FOUT $CONTENT; -} - -#close -close FIN; -close FOUT; diff --git a/util/scripts/mac-binary/install/libraries/fix_prl_paths.pl b/util/scripts/mac-binary/install/libraries/fix_prl_paths.pl deleted file mode 100755 index 62c8f7a..0000000 --- a/util/scripts/mac-binary/install/libraries/fix_prl_paths.pl +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/perl - -use strict; - -open(OLDFILE, "<" . "$ARGV[0]") || die "Couldn't open input file: $ARGV[0]"; -open(NEWFILE, ">" . "$ARGV[1]") || die "Couldn't open output file: $ARGV[1]"; - -while (my $line = <OLDFILE>) { - $line =~ s,-L/(\w+(\w|\s|/)*)/pgsql/lib,,g; - $line =~ s,-L/(\w+(\w|\s|/)*)/mysql/lib/mysql,,g; - $line =~ s,-F(/private)?/tmp/qt-stuff/source/qt-mac-\w+-src-4\.\d\.\d(-rc\d)?/lib,,g; - $line =~ s,-L(/private)?/tmp/qt-stuff/source/qt-mac-\w+-src-4\.\d\.\d(-rc\d)?/lib,,g; - print NEWFILE $line; -} - -close OLDFILE; -close NEWFILE; diff --git a/util/scripts/mac-binary/install/plugins/Info.plist b/util/scripts/mac-binary/install/plugins/Info.plist deleted file mode 100644 index 4d2ae28..0000000 --- a/util/scripts/mac-binary/install/plugins/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Plugins</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.plugins</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Plugins</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <true/> - <key>IFPkgFlagIsRequired</key> - <true/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/plugins/Resources/Description.plist b/util/scripts/mac-binary/install/plugins/Resources/Description.plist deleted file mode 100644 index 9e94d9e..0000000 --- a/util/scripts/mac-binary/install/plugins/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Plugins</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt Plugins</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/plugins/Resources/Readme.rtf b/util/scripts/mac-binary/install/plugins/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/plugins/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/plugins/Resources/plugins.info b/util/scripts/mac-binary/install/plugins/Resources/plugins.info deleted file mode 100644 index 24fd13f..0000000 --- a/util/scripts/mac-binary/install/plugins/Resources/plugins.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Tools -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Plugins -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/plugins/Resources/postflight b/util/scripts/mac-binary/install/plugins/Resources/postflight deleted file mode 100755 index a8af8dd..0000000 --- a/util/scripts/mac-binary/install/plugins/Resources/postflight +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -#fix the doc path -#PACK_LOCATION="$1" -#INST_LOCATION="$3" -#"$PACK_LOCATION/Contents/Resources/qtconf.pl" -version $VERSION_MAJOR$.$VERSION_MINOR$ -value "$INST_LOCATION/Developer/Applications/Qt/plugins" Plugins diff --git a/util/scripts/mac-binary/install/plugins/create_package.sh b/util/scripts/mac-binary/install/plugins/create_package.sh deleted file mode 100755 index b722f68..0000000 --- a/util/scripts/mac-binary/install/plugins/create_package.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -SRCDIR= -OUTDIR= -DO_DEBUG=yes -while [ -n "$1" ]; do - echo "$1" | grep '^--*=*' >/dev/null 2>&1 || break - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - debug) DO_DEBUG="$ARG" ;; - qtsrc) SRCDIR="$ARG" ;; - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done -[ -z "$OUTDIR" ] && exit 1 - -#copy plugins -for plugin in `find $BINDIR/plugins/ -name 'lib*.dylib'`; do - echo `basename $plugin` | grep "_debug" >/dev/null 2>&1 && continue - out_plugin=`echo $plugin | sed "s,^$BINDIR,$OUTDIR/Developer/Applications/Qt,g"` - mkdir -p `dirname $out_plugin` - [ -e "$plugin" ] && ../libraries/fix_config_paths.pl "$plugin" "$out_plugin" -done - -exit 0 diff --git a/util/scripts/mac-binary/install/tools/Info.plist b/util/scripts/mac-binary/install/tools/Info.plist deleted file mode 100644 index f30ba03..0000000 --- a/util/scripts/mac-binary/install/tools/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Tools</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.tools</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Tools</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <true/> - <key>IFPkgFlagIsRequired</key> - <true/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/tools/Resources/Description.plist b/util/scripts/mac-binary/install/tools/Resources/Description.plist deleted file mode 100644 index 5a88747..0000000 --- a/util/scripts/mac-binary/install/tools/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Tools</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt Tools</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/tools/Resources/Readme.rtf b/util/scripts/mac-binary/install/tools/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/tools/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/tools/Resources/postflight b/util/scripts/mac-binary/install/tools/Resources/postflight deleted file mode 100755 index d9c4a57..0000000 --- a/util/scripts/mac-binary/install/tools/Resources/postflight +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - -import os, sys, shutil, re - -def readLicenseFile(): - licenseKeyPath = os.path.join(os.environ['HOME'], '.qt-license'); - - licenseKeyRE = re.compile(r"^LicenseKeyExt=(.+)$") - license = open(licenseKeyPath, 'r') - licensekey = "Bad Key" - for line in license: - matchObj = licenseKeyRE.match(line) - if matchObj: - licensekey = matchObj.group(1) - return licensekey - -def getEditionDefine(): - licenseKey = readLicenseFile() - - MeteredMap = { '5': True, 'L': True } - - if len(licenseKey) == 0: - return false - - licenseParts = licenseKey.split('-') - return MeteredMap.get(licenseParts[3][0], False) - - -if __name__ == "__main__": - if getEditionDefine() == False: - usageReporterPath = os.path.join(os.path.sep, 'usr', 'bin', 'qtusagereporter') - reporterInDevToolsPath = os.path.join(os.path.sep, 'Developer', 'Tools', 'qtusagereporter') - if os.path.exists(usageReporterPath): - finalPath = os.path.realpath(usageReporterPath); - os.remove(finalPath) - if os.path.exists(reporterInDevToolsPath): - os.remove(reporterInDevToolsPath) - if os.path.exists(usageReporterPath): - os.remove(usageReporterPath) - sys.exit(0) diff --git a/util/scripts/mac-binary/install/tools/Resources/tools.info b/util/scripts/mac-binary/install/tools/Resources/tools.info deleted file mode 100644 index 54f8d04..0000000 --- a/util/scripts/mac-binary/install/tools/Resources/tools.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Tools -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Tools -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/tools/create_package.sh b/util/scripts/mac-binary/install/tools/create_package.sh deleted file mode 100755 index 6ed1e15..0000000 --- a/util/scripts/mac-binary/install/tools/create_package.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -SRCDIR= -OUTDIR= -DO_DEBUG=yes -while [ -n "$1" ]; do - echo "$1" | grep '^--*=*' >/dev/null 2>&1 || break - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - debug) DO_DEBUG="$ARG" ;; - qtsrc) SRCDIR="$ARG" ;; - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done - -copyHeader() -{ - HEADER_FILE=$1 - HEADER_DIR=$2 - mkdir -p $HEADER_DIR - if [ `wc -l $HEADER_FILE | awk '{print $1;}'` = "1" ]; then - LINE=`head -1 $HEADER_FILE` - if echo "$LINE" | grep '^#include "../../' >/dev/null 2>&1; then - HEADER_FILE=`dirname $HEADER_FILE`/`echo $LINE | sed "s,^#include \"\([^\"]*\)\"\$,\1,"` - fi - fi - cp "$HEADER_FILE" "$HEADER_DIR" -} - -copyHeaderDir() -{ - BASEDIR=$1 - DESTDIR=$2 - mkdir -p "$DESTDIR" - for header in `find "$BASEDIR" -type f`; do - case $header in - *_pch.h|*_p.h|*headers.pri) - continue - ;; - *) - copyHeader "$header" "$DESTDIR" - ;; - esac - done -} - -[ -z "$OUTDIR" ] && exit 1 - -#copy tools -for a in qmake uic uic3 rcc moc Assistant Assistant_adp pixeltool Linguist Designer qt3to4 rccdump lrelease lupdate lconvert findtr qtusagereporter qdoc qcollectiongenerator qhelpconverter qhelpgenerator xmlpatterns qdbus qdbusviewer qdbusxml2cpp qdbuscpp2xml evalextender macdeployqt; do - EXE= - if [ -d "${BINDIR}/bin/${a}.app" ]; then - mkdir -p "$OUTDIR/Developer/Applications/Qt/" - cp -R "${BINDIR}/bin/${a}.app" "$OUTDIR/Developer/Applications/Qt" - EXE="$OUTDIR/Developer/Applications/Qt/${a}.app/Contents/MacOS/$a" #in the bundle - #place it into the tools dir - mkdir -p "$OUTDIR/Developer/Tools/Qt/" - ln -s "/Developer/Applications/Qt/${a}.app" "$OUTDIR/Developer/Tools/Qt/${a}.app" - elif [ -x "${BINDIR}/bin/${a}" -o -x "${BINDIR}/tools/qdoc3/${a}" ]; then - EXE="$OUTDIR/usr/bin/$a-${VERSION_MAJOR}.${VERSION_MINOR}" - mkdir -p `dirname $EXE` - cp "${BINDIR}/bin/$a" "$EXE" - ln -s "$a-${VERSION_MAJOR}.${VERSION_MINOR}" "$OUTDIR/usr/bin/$a" - #place it into the tools dir - mkdir -p "$OUTDIR/Developer/Tools/Qt/" - ln -s "/usr/bin/$a-${VERSION_MAJOR}.${VERSION_MINOR}" "$OUTDIR/Developer/Tools/Qt/$a" - fi - [ -z "$EXE" ] && continue - - #configs - if [ "$a" = "qmake" ]; then - mkdir -p "$OUTDIR/usr/local/Qt${VERSION_MAJOR}.${VERSION_MINOR}/mkspecs" - cp -PR $SRCDIR/mkspecs/* "$OUTDIR/usr/local/Qt${VERSION_MAJOR}.${VERSION_MINOR}/mkspecs" - sed "s,qt_no_framework,,g" "$BINDIR/mkspecs/qconfig.pri" >"$OUTDIR/usr/local/Qt${VERSION_MAJOR}.${VERSION_MINOR}/mkspecs/qconfig.pri" - cat >>"$OUTDIR/usr/local/Qt${VERSION_MAJOR}.${VERSION_MINOR}/mkspecs/qconfig.pri" <<EOF -CONFIG += no_mocdepend -EOF - (cd "$OUTDIR/usr/local/Qt${VERSION_MAJOR}.${VERSION_MINOR}/mkspecs"; rm -f default; ln -s macx-xcode default) - ../libraries/fix_config_paths.pl -data "/usr/local/Qt${VERSION_MAJOR}.${VERSION_MINOR}" "$EXE" "/tmp/tmp.exe" - cp "/tmp/tmp.exe" "$EXE" - rm -f "/tmp/tmp.exe" - else - ../libraries/fix_config_paths.pl "$EXE" "/tmp/tmp.exe" - cp "/tmp/tmp.exe" "$EXE" - rm -f /tmp/tmp.exe - fi - #perms - strip "$EXE" >/dev/null 2>&1 - chmod a+x "$EXE" -done - -# Do the tool frameworks (Gah, this is copy-past from the libraries create_package.sh). -FRAMEWORK_DIR="$OUTDIR/Library/Frameworks" -mkdir -p "$FRAMEWORK_DIR" -for lib in QtDesigner QtDesignerComponents QtTest QtAssistant QtHelp; do - if [ ! -d "$BINDIR/lib/${lib}.framework" ]; then - echo "No framework for $lib!" - continue - fi - - cp -R "$BINDIR/lib/${lib}.framework" "$FRAMEWORK_DIR/" >/dev/null 2>&1 - ../libraries/fix_prl_paths.pl "$FRAMEWORK_DIR/${lib}.framework/${lib}.prl" "$FRAMEWORK_DIR/${lib}.framework/${lib}.prl.fixed" - mv "$FRAMEWORK_DIR/${lib}.framework/${lib}.prl.fixed" "$FRAMEWORK_DIR/${lib}.framework/${lib}.prl" - ../libraries/fix_config_paths.pl "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/$lib" "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}.fixed" - mv "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/${lib}.fixed" "$FRAMEWORK_DIR/${lib}.framework/Versions/${VERSION_MAJOR}/$lib" - - # Remove the debug libraries (they are part of another package) - find "$FRAMEWORK_DIR/${lib}.framework/" -name '*_debug*' -exec rm -f {} \; >/dev/null 2>&1 -done - -#copy q3porting.xml. qt3to4 looks for it in QLibraryInfo::DataPath and QLibraryInfo::PrefixPath -cp $BINDIR/tools/porting/src/q3porting.xml $OUTDIR/usr/local/Qt${VERSION_MAJOR}.${VERSION_MINOR}/q3porting.xml - -# Finally handle QtUiTools -if [ -e "${BINDIR}/lib/libQtUiTools.a" ]; then - mkdir -p "$OUTDIR/usr/lib" - cp "${BINDIR}/lib/libQtUiTools.a" "$OUTDIR/usr/lib/libQtUiTools.a" - # Copy its headers as well - copyHeaderDir "${BINDIR}/include/QtUiTools" "$OUTDIR/usr/include/QtUiTools" -fi - -if [ -e "${BINDIR}/lib/libQtCLucene.${VERSION_MAJOR}.dylib" ]; then - mkdir -p "$OUTDIR/usr/lib" - for lib in libQtCLucene.dylib libQtCLucene.${VERSION_MAJOR}.dylib libQtCLucene.${VERSION_MAJOR}.${VERSION_MINOR}.dylib libQtCLucene.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dylib; do - cp -R "${BINDIR}/lib/$lib" "$OUTDIR/usr/lib/" - done -fi - -# finally phrase books for Linguist -PHRASEDEST="$OUTDIR/Developer/Applications/Qt/phrasebooks" -mkdir -p "$PHRASEDEST" -for phrasebook in `find $BINDIR/tools/linguist/phrasebooks/ -name '*.qph'`; do - cp "$phrasebook" "$PHRASEDEST" -done - - diff --git a/util/scripts/mac-binary/install/translations/Info.plist b/util/scripts/mac-binary/install/translations/Info.plist deleted file mode 100644 index 73eb840..0000000 --- a/util/scripts/mac-binary/install/translations/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Translations</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.translations</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Translations</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <true/> - <key>IFPkgFlagIsRequired</key> - <true/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/translations/Resources/Description.plist b/util/scripts/mac-binary/install/translations/Resources/Description.plist deleted file mode 100644 index c1b27b2..0000000 --- a/util/scripts/mac-binary/install/translations/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Translations</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt Translations</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/translations/Resources/Readme.rtf b/util/scripts/mac-binary/install/translations/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/translations/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/translations/Resources/postflight b/util/scripts/mac-binary/install/translations/Resources/postflight deleted file mode 100755 index a8af8dd..0000000 --- a/util/scripts/mac-binary/install/translations/Resources/postflight +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -#fix the doc path -#PACK_LOCATION="$1" -#INST_LOCATION="$3" -#"$PACK_LOCATION/Contents/Resources/qtconf.pl" -version $VERSION_MAJOR$.$VERSION_MINOR$ -value "$INST_LOCATION/Developer/Applications/Qt/plugins" Plugins diff --git a/util/scripts/mac-binary/install/translations/Resources/translations.info b/util/scripts/mac-binary/install/translations/Resources/translations.info deleted file mode 100644 index cc0d5b3..0000000 --- a/util/scripts/mac-binary/install/translations/Resources/translations.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Translations -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ Translations -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/translations/create_package.sh b/util/scripts/mac-binary/install/translations/create_package.sh deleted file mode 100644 index b8b2b78..0000000 --- a/util/scripts/mac-binary/install/translations/create_package.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -SRCDIR= -OUTDIR= -DO_DEBUG=yes -while [ -n "$1" ]; do - echo "$1" | grep '^--*=*' >/dev/null 2>&1 || break - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - debug) DO_DEBUG="$ARG" ;; - qtsrc) SRCDIR="$ARG" ;; - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done -[ -z "$OUTDIR" ] && exit 1 - -#copy translation -TRANSLATIONDEST="$OUTDIR/Developer/Applications/Qt/translations" -mkdir -p "$TRANSLATIONDEST" -for translation in `find $BINDIR/translations/ -name '*.qm'`; do - cp "$translation" "$TRANSLATIONDEST" -done - -# Copy the untranslated, so there's a starting point for them as well. -for translation in `find $BINDIR/translations/ -name '*_untranslated.ts'`; do - cp "$translation" "$TRANSLATIONDEST" -done - -exit 0 diff --git a/util/scripts/mac-binary/install/xcode/.gitattributes b/util/scripts/mac-binary/install/xcode/.gitattributes deleted file mode 100644 index 5a2a8ee..0000000 --- a/util/scripts/mac-binary/install/xcode/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -integration/templates/*/Application/*/main.cpp -crlf diff --git a/util/scripts/mac-binary/install/xcode/Info.plist b/util/scripts/mac-binary/install/xcode/Info.plist deleted file mode 100644 index 4410b63..0000000 --- a/util/scripts/mac-binary/install/xcode/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ XCode Integration</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt$VERSION_MAJOR$.xcode</string> - <key>CFBundleName</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ XCode Integration</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagAllowBackRev</key> - <false/> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagDefaultLocation</key> - <string>/</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFPkgFlagInstallFat</key> - <true/> - <key>IFPkgFlagIsRequired</key> - <true/> - <key>IFPkgFlagRelocatable</key> - <false/> - <key>IFPkgFlagRestartAction</key> - <string>NoRestart</string> - <key>IFPkgFlagRootVolumeOnly</key> - <true/> - <key>IFPkgFlagUpdateInstalledLanguages</key> - <false/> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/xcode/Resources/Description.plist b/util/scripts/mac-binary/install/xcode/Resources/Description.plist deleted file mode 100644 index 386e200..0000000 --- a/util/scripts/mac-binary/install/xcode/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ XCode Integration</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt XCode Integration</string> - <key>IFPkgDescriptionVersion</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/xcode/Resources/Readme.rtf b/util/scripts/mac-binary/install/xcode/Resources/Readme.rtf deleted file mode 100644 index f5636ca..0000000 --- a/util/scripts/mac-binary/install/xcode/Resources/Readme.rtf +++ /dev/null @@ -1,7 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Thanks for reading me}
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/xcode/Resources/xcode.info b/util/scripts/mac-binary/install/xcode/Resources/xcode.info deleted file mode 100644 index 0f3e8a4..0000000 --- a/util/scripts/mac-binary/install/xcode/Resources/xcode.info +++ /dev/null @@ -1,17 +0,0 @@ -Title Qt Tools -Version $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$ XCode Integration -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization YES -Required NO -Relocatable YES -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO - diff --git a/util/scripts/mac-binary/install/xcode/create_package.sh b/util/scripts/mac-binary/install/xcode/create_package.sh deleted file mode 100755 index f86932b..0000000 --- a/util/scripts/mac-binary/install/xcode/create_package.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -#options parsing -BINDIR= -OUTDIR= -while [ -n "$1" ]; do - OPTION=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,^--\([^=]*\)=\(.*\),\2,'` - shift - case "$OPTION" in - qtbin) BINDIR="$ARG" ;; - outdir) OUTDIR="$ARG" ;; - *) ;; - esac -done -[ -z "$OUTDIR" ] && exit 1 - -translate_cp() -{ - DO_TRANSLATE="$PWD/do_translate.sh" - if [ -d "$1" ]; then - (cd "$1" && find . -type f -exec "$DO_TRANSLATE" {} "$2" \;) - else - "$DO_TRANSLATE" "$1" "$2" - fi -} - -#copy the scripts -SCRPT_DIR="$OUTDIR/Library/Frameworks/QtCore.framework/Versions/${VERSION_MAJOR}.${VERSION_MINOR}/Resources/xcode" -mkdir -p "$SCRPT_DIR" -translate_cp integration/scripts "$SCRPT_DIR" -for a in $SCRPT_DIR/*.sh; do - chmod a+x "$a" -done -ln -sf "Versions/${VERSION_MAJOR}.${VERSION_MINOR}/Resources" "$OUTDIR/Library/Frameworks/QtCore.framework/Resources" - -#copy the templates -mkdir -p "$OUTDIR/Library/Application Support/Apple/Developer Tools/" -translate_cp integration/templates "$OUTDIR/Library/Application Support/Apple/Developer Tools/" - -#build the bundle -(cd "$OUTDIR/Library/Application Support/Apple/Developer Tools/CustomDataViews/QtDataFormatters.bundle/Contents/MacOS" -chmod 755 ./build_bundle.sh -QTDIR="$BINDIR" ./build_bundle.sh) - -exit 0 diff --git a/util/scripts/mac-binary/install/xcode/do_translate.sh b/util/scripts/mac-binary/install/xcode/do_translate.sh deleted file mode 100755 index b1b00e49..0000000 --- a/util/scripts/mac-binary/install/xcode/do_translate.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -dir=`dirname "$2/$1"` -mkdir -p "$dir" -sed -e "s,\\\$VERSION_MAJOR\\\$,$VERSION_MAJOR,g" \ - -e "s,\\\$VERSION_MINOR\\\$,$VERSION_MINOR,g" \ - -e "s,\\\$VERSION_PATCH\\\$,$VERSION_PATCH,g" "$1" >"$2/$1" - - diff --git a/util/scripts/mac-binary/install/xcode/fake_package.sh b/util/scripts/mac-binary/install/xcode/fake_package.sh deleted file mode 100755 index 74175c5..0000000 --- a/util/scripts/mac-binary/install/xcode/fake_package.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -#for now -VERSION_MAJOR=4 -VERSION_MINOR=0 -BINDIR="$QTDIR" - -translate_cp() -{ - DO_TRANSLATE="$PWD/do_translate.sh" - if [ -d "$1" ]; then - (cd "$1" && find . -type f -exec "$DO_TRANSLATE" {} "$2" \;) - else - "$DO_TRANSLATE" "$1" "$2" - fi -} - -make_link() -{ - base=`basename "$1"` - rm -rf "$2/$base" - mkdir -p "$2" - ln -sf "$1" "$2" -} - -#copy the templates -rm -rf "$PWD/.faked_integration" -mkdir -p "$PWD/.faked_integration" -translate_cp integration/templates "$PWD/.faked_integration" -(cd "$PWD/.faked_integration/CustomDataViews/QtDataFormatters.bundle/Contents/MacOS" -chmod 755 ./build_bundle.sh -QTDIR="$BINDIR" ./build_bundle.sh) -#links -templ_dir="/Library/Application Support/Apple/Developer Tools/" -make_link "$PWD/.faked_integration/CustomDataViews/QtDataFormatters.bundle" "$templ_dir/CustomDataViews" -make_link "$PWD/.faked_integration/Project Templates/Application/Qt Application" "$templ_dir/Project Templates/Application" -make_link "$PWD/.faked_integration/File Templates/Qt" "$templ_dir/File Templates" -make_link "$PWD/.faked_integration/Scripts/999-Qt" "$templ_dir/Scripts" -for a in `find "$PWD/.faked_integration/Specifications/" -name *.pb*spec`; do - make_link "$a" "$templ_dir/Specifications" -done - -#copy the scripts -SCRPT_DIR="/Library/Frameworks/QtCore.framework/Versions/${VERSION_MAJOR}.${VERSION_MINOR}/Resources/xcode" -mkdir -p "$SCRPT_DIR" -for script in integration/scripts/*; do - make_link "$PWD/$script" "$SCRPT_DIR" -done -ln -sf "Versions/${VERSION_MAJOR}.${VERSION_MINOR}/Resources" "/Library/Frameworks/QtCore.framework/Resources" diff --git a/util/scripts/mac-binary/install/xcode/integration/scripts/get_file_list.applescript b/util/scripts/mac-binary/install/xcode/integration/scripts/get_file_list.applescript deleted file mode 100644 index 6f110ca..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/scripts/get_file_list.applescript +++ /dev/null @@ -1,31 +0,0 @@ -set all_files to {} -tell application "Xcode" - tell project 1 - repeat with f in file references - tell f - set fn to absolute path - set end of all_files to fn & " -" - end tell - end repeat - set all_groups to {} - repeat with grp in groups - set end of all_groups to grp - end repeat - repeat with grp in all_groups - tell grp - repeat with grp in groups - set end of all_groups to grp - end repeat - repeat with f in file references - tell f - set fn to absolute path - set end of all_files to fn & " -" - end tell - end repeat - end tell - end repeat - end tell -end tell -all_files
\ No newline at end of file diff --git a/util/scripts/mac-binary/install/xcode/integration/scripts/get_mocs.sh b/util/scripts/mac-binary/install/xcode/integration/scripts/get_mocs.sh deleted file mode 100755 index c3107fc..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/scripts/get_mocs.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/sh - -[ -z "$TEMP_FILE_DIR" ] && TEMP_FILE_DIR="/tmp" -CFG_MODE=overwrite -CFG_PREPROCESS_FLAGS= -CFG_INPUT= -CFG_OUTPUT= -CFG_MOC="/usr/bin/moc" -CFG_FILE_LIST="/Library/Frameworks/QtCore.framework/Resources/xcode/get_file_list.applescript" - -mocable() -{ - if grep '\bQ_OBJECT\b' "$1" >/dev/null 2>&1; then - return 0 - fi - return 1 -} - -while [ -n "$1" ]; do - CACHE_1="$1" - OPTION= - ARG= - case $1 in - -*=*) #gnu style - OPTION=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\2,'` - ;; - -output|-moc|-file-list|-input) #second arg style - OPTION=`echo $1 | sed 's,-\([^=]*\),\1,'` - shift - ARG=$1 - ;; - esac - shift - case "$OPTION" in - file-list) CFG_FILE_LIST="$ARG" ;; - moc) CFG_MOC="$ARG" ;; - input) CFG_INPUT="$ARG" ;; - output) CFG_OUTPUT="$ARG" ;; - help|*) - [ "$OPTION" = "help" ] || echo "Unknown option $CACHE_1!" - echo "Help!!" - exit 888; - ;; - esac -done - -cd "${SOURCE_ROOT}" -for a in $OTHER_CPLUSPLUSFLAGS; do - case "$a" in - -D*|-I*) - CFG_PREPROCESS_FLAGS="$CFG_PREPROCESS_FLAGS ${a}" ;; - *) ;; - esac -done -for a in $GCC_PREPROCESSOR_DEFINITIONS; do - CFG_PREPROCESS_FLAGS="$CFG_PREPROCESS_FLAGS -D${a}" -done -CFG_PREPROCESS_FLAGS="$CFG_PREPROCESS_FLAGS -I${SOURCE_ROOT}" - -MOC_LIST="${TEMP_FILE_DIR}/mocable.list" -echo >"$MOC_LIST" - -if [ ! -z "$CFG_INPUT" ] && [ ! -z "$CFG_OUTPUT" ]; then - FILE_TYPE=unknown - case "$CFG_INPUT" in - *.cpp|*.C|*.cc|*.CPP|*.CC) FILE_TYPE=c++-source ;; - *.h|*.H|*.hpp|*.HPP) FILE_TYPE=c++-header ;; - esac - [ "$FILE_TYPE" = "unknown" ] && exit 0 - - if mocable "$CFG_INPUT"; then - if [ "$FILE_TYPE" = "c++-source" ]; then - MOC_FILE=`echo $CFG_INPUT | sed "s,\.[^.]*$,.moc,"` - if [ ! -e "$MOC_FILE" ] || [ "$CFG_INPUT" -nt "$MOC_FILE" ]; then - $CFG_MOC "$CFG_PREPROCESS_FLAGS" "$CFG_INPUT" -o "$MOC_FILE" - fi - elif [ "$FILE_TYPE" = "c++-header" ]; then - [ -f "$CFG_OUTPUT" ] && cp "$CFG_OUTPUT" "$MOC_LIST" - echo "#include \"$CFG_INPUT\"" >>"$MOC_LIST" - fi - elif [ -f "$CFG_OUTPUT" ]; then - grep -v "$CFG_INPUT" "$CFG_OUTPUT" >"$MOC_LIST" - fi -else - FILE_LIST="${TEMP_FILE_DIR}/file.list" - osascript "$CFG_FILE_LIST" | sed "s,^[, ]*,,g" >"$FILE_LIST" - - LINE=0 - LINES=`wc -l "$FILE_LIST" | awk '{ print $1; }'` - while [ "$LINE" -lt "$LINES" ]; do - LINE=$((LINE+1)) - FILE=`head -$LINE ${FILE_LIST} | tail -1` - FILE_TYPE=unknown - case "$FILE" in - *.cpp|*.C|*.cc|*.CPP|*.CC) FILE_TYPE=c++-source ;; - *.h|*.H|*.hpp|*.HPP) FILE_TYPE=c++-header ;; - *.mocs) [ -z "$CFG_OUTPUT" ] && CFG_OUTPUT="$FILE" ;; - esac - [ "$FILE_TYPE" = "unknown" ] && continue - - if mocable "$FILE"; then - if [ "$FILE_TYPE" = "c++-source" ]; then - MOC_FILE=`echo $FILE | sed "s,\.[^.]*$,.moc,"` - if [ ! -e "$MOC_FILE" ] || [ "$FILE" -nt "$MOC_FILE" ]; then - $CFG_MOC "$CFG_PREPROCESS_FLAGS" "$FILE" -o "$MOC_FILE" - fi - elif [ "$FILE_TYPE" = "c++-header" ]; then - echo "#include \"$FILE\"" >>"$MOC_LIST" - fi - fi - done - rm -f "$FILE_LIST" - - if [ -z "$CFG_OUTPUT" ]; then - echo "No output file specified!" - exit 1 - fi -# CFG_MODE=remove -fi - -#sort it -sort "$MOC_LIST" | uniq | grep -v '^$' >"${MOC_LIST}.sorted" -mv "${MOC_LIST}.sorted" "${MOC_LIST}" - -#replace it -if cmp -s "$MOC_LIST" "$CFG_OUTPUT"; then - rm -f "$MOC_LIST" -else - if [ "$CFG_MODE" = "overwrite" ]; then - mv "$MOC_LIST" "$CFG_OUTPUT" - else - if [ -z `cat "$MOC_LIST"` ]; then - if [ ! -e "$CFG_OUTPUT" ] || [ ! -z `cat "$CFG_OUTPUT"` ]; then - echo >"$CFG_OUTPUT" - fi - else - rm -f "$CFG_OUTPUT" - fi - rm -f "$MOC_LIST" - fi -fi - -exit 0 diff --git a/util/scripts/mac-binary/install/xcode/integration/scripts/make_moc.sh b/util/scripts/mac-binary/install/xcode/integration/scripts/make_moc.sh deleted file mode 100755 index c7f0179..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/scripts/make_moc.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh - -CFG_PREPROCESS_FLAGS= -CFG_MOC="/usr/bin/moc" -CFG_INPUT= -CFG_OUTPUT= - -while [ -n "$1" ]; do - CACHE_1="$1" - OPTION= - ARG= - case $1 in - -*=*) #gnu style - OPTION=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\2,'` - ;; - -output|-input|-moc) #second arg style - OPTION=`echo $1 | sed 's,-\([^=]*\),\1,'` - shift - ARG=$1 - ;; - esac - shift - case "$OPTION" in - moc) CFG_MOC="$ARG" ;; - output) CFG_OUTPUT="$ARG" ;; - input) CFG_INPUT="$ARG" ;; - help|*) - [ "$OPTION" = "help" ] || echo "Unknown option $CACHE_1!" - echo "Help!!" - exit 888; - ;; - esac -done - -if [ -z "$CFG_INPUT" ] || [ -z "$CFG_OUTPUT" ]; then - echo "No input/output file specified." - exit 1 -fi - -cd "${SOURCE_ROOT}" -for a in $OTHER_CPLUSPLUSFLAGS; do - case "$a" in - -D*|-I*) - CFG_PREPROCESS_FLAGS="$CFG_PREPROCESS_FLAGS ${a}" ;; - *) ;; - esac -done -for a in $GCC_PREPROCESSOR_DEFINITIONS; do - CFG_PREPROCESS_FLAGS="$CFG_PREPROCESS_FLAGS -D${a}" -done -CFG_PREPROCESS_FLAGS="$CFG_PREPROCESS_FLAGS -I${SOURCE_ROOT}" - -NO_CHANGE=yes -MOC_OUTPUT="${TEMP_FILE_DIR}/moc.out" -echo >"$MOC_OUTPUT" - -#do the moc -if [ -e "$CFG_INPUT" ]; then - if [ '!' -e "$CFG_OUTPUT" ] || [ "$CFG_INPUT" -nt "$CFG_OUTPUT" ]; then - NO_CHANGE=no - else - LINE=0 - LINES=`wc -l "$CFG_INPUT" | awk '{ print $1; }'` - while [ "$LINE" -lt "$LINES" ]; do - LINE=$((LINE+1)) - SOURCE=`head -$LINE ${CFG_INPUT} | tail -1` - - FILE=`echo $SOURCE | sed "s,^#include \"\([^\"]*\)\"$,\1,"` - if [ '!' -f "$FILE" ] || [ "$FILE" -nt "$CFG_OUTPUT" ]; then - NO_CHANGE=no - break - fi - done - fi - - if [ "$NO_CHANGE" = "no" ]; then - LINE=0 - LINES=`wc -l "$CFG_INPUT" | awk '{ print $1; }'` - while [ "$LINE" -lt "$LINES" ]; do - LINE=$((LINE+1)) - SOURCE=`head -$LINE ${CFG_INPUT} | tail -1` - - FILE=`echo $SOURCE | sed "s,^#include \"\([^\"]*\)\"$,\1,"` - if [ -f "$FILE" ]; then - $CFG_MOC $CFG_PREPROCESS_FLAGS "$FILE" >>"$MOC_OUTPUT" - fi - done - fi -fi - -#replace it -if [ "$NO_CHANGE" = "yes" ] || cmp -s "$MOC_OUTPUT" "$CFG_OUTPUT"; then - rm -f "$MOC_OUTPUT" -else - mv "$MOC_OUTPUT" "$CFG_OUTPUT" -fi - diff --git a/util/scripts/mac-binary/install/xcode/integration/scripts/make_rcc.sh b/util/scripts/mac-binary/install/xcode/integration/scripts/make_rcc.sh deleted file mode 100755 index 2165bec..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/scripts/make_rcc.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -CFG_RCC="/usr/bin/rcc" -CFG_INPUT= -CFG_OUTPUT= - -while [ -n "$1" ]; do - CACHE_1="$1" - OPTION= - ARG= - case $1 in - -*=*) #gnu style - OPTION=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\2,'` - ;; - -output|-input|-rcc) #second arg style - OPTION=`echo $1 | sed 's,-\([^=]*\),\1,'` - shift - ARG=$1 - ;; - esac - shift - case "$OPTION" in - rcc) CFG_UIC="$ARG" ;; - output) CFG_OUTPUT="$ARG" ;; - input) CFG_INPUT="$ARG" ;; - help|*) - [ "$OPTION" = "help" ] || echo "Unknown option $CACHE_1!" - echo "Help!!" - exit 888; - ;; - esac -done - -if [ -z "$CFG_INPUT" ] || [ -z "$CFG_OUTPUT" ]; then - echo "No input/output file specified." - exit 1 -fi -[ "$CFG_OUTPUT" -nt "$CFG_INPUT" ] && exit 0 -cd "${SOURCE_ROOT}" - -#do the rcc -RCC_OPTIONS= -[ -z "$PRODUCT_NAME" ] || RCC_OPTIONS="$RCC_OPTIONS -name \"$PRODUCT_NAME\"" -$CFG_RCC $RCC_OPTIONS -o "$CFG_OUTPUT" "$CFG_INPUT" diff --git a/util/scripts/mac-binary/install/xcode/integration/scripts/make_uic.sh b/util/scripts/mac-binary/install/xcode/integration/scripts/make_uic.sh deleted file mode 100755 index e5fd5c1..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/scripts/make_uic.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -CFG_UIC="/usr/bin/uic" -CFG_INPUT= -CFG_OUTPUT= - -while [ -n "$1" ]; do - CACHE_1="$1" - OPTION= - ARG= - case $1 in - -*=*) #gnu style - OPTION=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\2,'` - ;; - -output|-input|-uic) #second arg style - OPTION=`echo $1 | sed 's,-\([^=]*\),\1,'` - shift - ARG=$1 - ;; - esac - shift - case "$OPTION" in - uic) CFG_UIC="$ARG" ;; - output) CFG_OUTPUT="$ARG" ;; - input) CFG_INPUT="$ARG" ;; - help|*) - [ "$OPTION" = "help" ] || echo "Unknown option $CACHE_1!" - echo "Help!!" - exit 888; - ;; - esac -done - -if [ -z "$CFG_INPUT" ] || [ -z "$CFG_OUTPUT" ]; then - echo "No input/output file specified." - exit 1 -fi -[ "$CFG_OUTPUT" -nt "$CFG_INPUT" ] && exit 0 -cd "${SOURCE_ROOT}" - -#do the uic -$CFG_UIC -o "$CFG_OUTPUT" "$CFG_INPUT" diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/Info.plist b/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/Info.plist deleted file mode 100644 index b775dcd..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>QtDataFormatters</string> - <key>CFBundleGetInfoString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$, Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)</string> - <key>CFBundleIdentifier</key> - <string>com.apple.Xcode.QtDataFormatters</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>Xcode Qt Data Formatters Plugin</string> - <key>CFBundlePackageType</key> - <string>BNDL</string> - <key>CFBundleShortVersionString</key> - <string>1.2</string> - <key>CFBundleSignature</key> - <string>xccf</string> - <key>CFBundleVersion</key> - <string>308</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/MacOS/build_bundle.sh b/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/MacOS/build_bundle.sh deleted file mode 100755 index df1e225..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/MacOS/build_bundle.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -DO_DEBUG=yes -[ "$1" = "-debug" ] && DO_DEBUG=yes - -#figure out compiler flags -CFLAGS="-F${QTDIR}/lib" -LFLAGS= -for a in QtCore; do - LFLAGS="$LFLAGS -framework ${a}" -done -[ "$DO_DEBUG" = "yes" ] && CFLAGS="$CFLAGS -g" -if [ -d "/Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Headers/" ]; then - CFLAGS="$CFLAGS -I/Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Headers/" -elif [ -d "/Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.pbplugin/Contents/Headers/" ]; then - CFLAGS="$CFLAGS -I/Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.pbplugin/Contents/Headers/" -fi - -#link -/usr/bin/c++ -bundle bundle.cpp $CFLAGS -o QtDataFormatters $LFLAGS diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/MacOS/bundle.cpp b/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/MacOS/bundle.cpp deleted file mode 100644 index 2c28c6f..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/MacOS/bundle.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the $MODULE$ of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************///xcode -extern "C" { -#include "DataFormatterPlugin.h" - _pbxgdb_plugin_function_list *_pbxgdb_plugin_functions = 0; -} - -//qt stuff -#include <QtCore/QtCore> - -static int serialId(int id) -{ -#if 0 - static int serialRet = 0xF00F00F0; - return serialRet--; -#else - return id; -#endif -} - -static void *doAllocate(int id, int size) -{ - if(_pbxgdb_plugin_functions && _pbxgdb_plugin_functions->allocate) - return (*_pbxgdb_plugin_functions->allocate)(id, size); - return malloc(size); -} - -static char *doSprintf(int id, const char *format, va_list ap) -{ - if(_pbxgdb_plugin_functions && _pbxgdb_plugin_functions->vmessage) - return (*_pbxgdb_plugin_functions->vmessage)(id, format, ap); - return "Unable to sprintf!"; -} - -static char *doSprintf(int id, const char *format, ...) -{ - va_list ap; - va_start(ap, format); - char *ret = doSprintf(id, format, ap); - va_end(ap); - return ret; -} - -char * -Qt_QPointSummary(QPoint &point, int id) -{ - return doSprintf(serialId(id), "(%d,%d)", point.x(), point.y()); -} - -char * -Qt_QSizeSummary(QSize &size, int id) -{ - return doSprintf(serialId(id), "[%dx%d]", size.width(), size.height()); -} - -char * -Qt_QStringSummary(QString &string, int id) -{ - return doSprintf(serialId(id), "%s", string.toLatin1().constData()); -} - -char * -Qt_QDateSummary(QDate &v, int id) -{ - return doSprintf(serialId(id), "%s", v.toString().toLatin1().constData()); -} - -char * -Qt_QTimeSummary(QTime &v, int id) -{ - return doSprintf(serialId(id), "%s", v.toString().toLatin1().constData()); -} - -char * -Qt_QDateTimeSummary(QDateTime &v, int id) -{ - return doSprintf(serialId(id), "%s", v.toString().toLatin1().constData()); -} - -char * -Qt_QVariantSummary(QVariant &v, int id) -{ - return doSprintf(serialId(id), "%s", v.toString().toLatin1().constData()); -} - -char * -Qt_QRectSummary(QRect &rect, int id) -{ - return doSprintf(serialId(id), "(%d,%d)[%dx%d]", rect.x(), rect.y(), - rect.width(), rect.height()); -} diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/Resources/CustomDataViews.plist b/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/Resources/CustomDataViews.plist deleted file mode 100644 index cebb3c7..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/Resources/CustomDataViews.plist +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>QRect</key> - <dict> - <key>SummaryString</key> - <string>{(char *)Qt_QRectSummary($VAR, $ID)}:s</string> - </dict> - <key>QPoint</key> - <dict> - <key>SummaryString</key> - <string>{(char *)Qt_QPointSummary($VAR, $ID)}:s</string> - </dict> - <key>QSize</key> - <dict> - <key>SummaryString</key> - <string>{(char *)Qt_QSizeSummary($VAR, $ID)}:s</string> - </dict> - <key>QString</key> - <dict> - <key>SummaryString</key> - <string>{(char *)Qt_QStringSummary($VAR, $ID)}:s</string> - </dict> - <key>QDate</key> - <dict> - <key>SummaryString</key> - <string>{(char *)Qt_QDateSummary($VAR, $ID)}:s</string> - </dict> - <key>QTime</key> - <dict> - <key>SummaryString</key> - <string>{(char *)Qt_QTimeSummary($VAR, $ID)}:s</string> - </dict> - <key>QDateTime</key> - <dict> - <key>SummaryString</key> - <string>{(char *)Qt_QDateTimeSummary($VAR, $ID)}:s</string> - </dict> - <key>QCoreVariant</key> - <dict> - <key>SummaryString</key> - <string>{(char *)Qt_QCoreVariantSummary($VAR, $ID)}:s</string> - </dict> - <key>File Version</key> - <string>1</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/version.plist b/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/version.plist deleted file mode 100644 index 7cc21e5..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/CustomDataViews/QtDataFormatters.bundle/Contents/version.plist +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>BuildVersion</key> - <string>1</string> - <key>CFBundleShortVersionString</key> - <string>$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>CFBundleVersion</key> - <string>308</string> - <key>ProjectName</key> - <string>pbxdataformatters</string> - <key>SourceVersion</key> - <string>3080000</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/C++ Class.pbfiletemplate/TemplateInfo.plist b/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/C++ Class.pbfiletemplate/TemplateInfo.plist deleted file mode 100644 index 2cb6259..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/C++ Class.pbfiletemplate/TemplateInfo.plist +++ /dev/null @@ -1,5 +0,0 @@ -{ - MainTemplateFile = "class.cpp"; - CounterpartTemplateFile = "class.h"; - Description = "A C++ class, with an optional header file which includes the <QtGui/QtGui> header."; -} diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/Header File.pbfiletemplate/TemplateInfo.plist b/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/Header File.pbfiletemplate/TemplateInfo.plist deleted file mode 100644 index 7f20a37..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/Header File.pbfiletemplate/TemplateInfo.plist +++ /dev/null @@ -1,4 +0,0 @@ -{ - MainTemplateFile = "header.h"; - Description = "A header file which includes the <QtGui/QtGui> header."; -} diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/Header File.pbfiletemplate/header.h b/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/Header File.pbfiletemplate/header.h deleted file mode 100644 index dd1cdd9..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/Header File.pbfiletemplate/header.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/* - * «FILENAME» - * «PROJECTNAME» - * - * Created by «FULLUSERNAME» on «DATE». - * Copyright (c) «YEAR» «ORGANIZATIONNAME». All rights reserved. - * - */ - -#include <QtGui/QtGui> - diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/QRC File.pbfiletemplate/TemplateInfo.plist b/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/QRC File.pbfiletemplate/TemplateInfo.plist deleted file mode 100644 index 8f896d4..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/QRC File.pbfiletemplate/TemplateInfo.plist +++ /dev/null @@ -1,4 +0,0 @@ -{ - MainTemplateFile = "resource.qrc"; - Description = "A base Qt resource file"; -} diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/UI File.pbfiletemplate/TemplateInfo.plist b/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/UI File.pbfiletemplate/TemplateInfo.plist deleted file mode 100644 index c6e3e8c..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/UI File.pbfiletemplate/TemplateInfo.plist +++ /dev/null @@ -1,4 +0,0 @@ -{ - MainTemplateFile = "class.ui"; - Description = "A base UI file to edit with the designer"; -} diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/UI File.pbfiletemplate/class.ui b/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/UI File.pbfiletemplate/class.ui deleted file mode 100644 index 95db9ca..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/File Templates/Qt/UI File.pbfiletemplate/class.ui +++ /dev/null @@ -1,16 +0,0 @@ -<UI version="4.0" stdsetdef="1" > - <class>«FILEBASENAME»</class> - <widget class="QDialog" name="«FILEBASENAME»" > - <property name="objectName" > - <string notr="true">«FILEBASENAME»</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>391</width> - <height>223</height> - </rect> - </property> - </widget> -</UI> diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/Info.plist b/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/Info.plist deleted file mode 100644 index f554bea..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>«PROJECTNAMEASXML»</string> - <key>CFBundleIconFile</key> - <string></string> - <key>CFBundleIdentifier</key> - <string>com.apple.myQtApp</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>0.1</string> - <key>CSResourcesFileMapped</key> - <true/> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.mocs b/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.mocs deleted file mode 100644 index 8b13789..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.mocs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.pbproj/TemplateInfo.plist b/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.pbproj/TemplateInfo.plist deleted file mode 100644 index 8003b8d..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.pbproj/TemplateInfo.plist +++ /dev/null @@ -1,11 +0,0 @@ -{ - FilesToRename = { - "QtApp.mocs" = "ÇPROJECTNAMEÈ.mocs"; - }; - FilesToMacroExpand = ( - "ÇPROJECTNAMEÈ.mocs", - "Info.plist", - "main.cpp", - ); - Description = "This project builds a Qt application that uses .ui files for interfaces."; -} diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.pbproj/project.pbxproj b/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.pbproj/project.pbxproj deleted file mode 100644 index c2522e2..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/QtApp.pbproj/project.pbxproj +++ /dev/null @@ -1,377 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 39; - objects = { - 0249A66BFF388E3F11CA2CEA = { - expectedFileType = archive.ar; - isa = PBXFileReference; - name = "libstdc++.a"; - path = "/usr/lib/libstdc++.a"; - refType = 0; - sourceTree = "<absolute>"; - }; -//020 -//021 -//022 -//023 -//024 -//080 -//081 -//082 -//083 -//084 - 195DF8CFFE9D517E11CA2CBB = { - children = ( - 8D0C4E970486CD37000505A6, - ); - isa = PBXGroup; - name = Products; - refType = 4; - sourceTree = "<group>"; - }; -//190 -//191 -//192 -//193 -//194 -//200 -//201 -//202 -//203 -//204 - 20286C28FDCF999611CA2CEA = { - buildStyles = ( - 4A9504C5FFE6A39111CA0CBA, - 4A9504C6FFE6A39111CA0CBA, - ); - hasScannedForEncodings = 1; - isa = PBXProject; - mainGroup = 20286C29FDCF999611CA2CEA; - projectDirPath = ""; - targets = ( - 8D0C4E890486CD37000505A6, - ); - }; - 20286C29FDCF999611CA2CEA = { - children = ( - 20286C2AFDCF999611CA2CEA, - 20286C32FDCF999611CA2CEA, - 195DF8CFFE9D517E11CA2CBB, - ); - isa = PBXGroup; - name = "«PROJECTNAMEASXML»"; - path = ""; - refType = 4; - sourceTree = "<group>"; - }; - 20286C2AFDCF999611CA2CEA = { - children = ( - 32DBCF6D0370B57F00C91783, - 20286C2BFDCF999611CA2CEA, - ); - isa = PBXGroup; - name = Sources; - path = ""; - refType = 4; - sourceTree = "<group>"; - }; - 20286C2BFDCF999611CA2CEA = { - expectedFileType = sourcecode.qt.cpp; - fileEncoding = 30; - isa = PBXFileReference; - path = main.cpp; - refType = 4; - sourceTree = "<group>"; - }; - 20286C32FDCF999611CA2CEA = { - children = ( - 20286C33FDCF999611CA2CEA, - 20286CA3FDCF999611CA2CEA, - 4A9504CAFFE6A41611CA0CBA, - 4A9504C8FFE6A3BC11CA0CBA, - 0249A66BFF388E3F11CA2CEA, - ); - isa = PBXGroup; - name = "External Frameworks and Libraries"; - path = ""; - refType = 4; - sourceTree = "<group>"; - }; - 20286CA3FDCF999611CA2CEA = { - expectedFileType = wrapper.framework; - fallbackIsa = PBXFileReference; - isa = PBXFrameworkReference; - name = QtGui.framework; - path = /Library/Frameworks/QtGui.framework; - refType = 0; - sourceTree = "<absolute>"; - }; - - 20286C33FDCF999611CA2CEA = { - expectedFileType = wrapper.framework; - fallbackIsa = PBXFileReference; - isa = PBXFrameworkReference; - name = QtCore.framework; - path = /Library/Frameworks/QtCore.framework; - refType = 0; - sourceTree = "<absolute>"; - }; -//200 -//201 -//202 -//203 -//204 -//320 -//321 -//322 -//323 -//324 - 32DBCF6D0370B57F00C91783 = { - fileEncoding = 4; - isa = PBXFileReference; - path = "«PROJECTNAME».mocs"; - refType = 4; - sourceTree = "<group>"; - }; -//320 -//321 -//322 -//323 -//324 -//4A0 -//4A1 -//4A2 -//4A3 -//4A4 - 4A9504C5FFE6A39111CA0CBA = { - buildRules = ( - ); - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUGGING_SYMBOLS = YES; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - OPTIMIZATION_CFLAGS = "-O0"; - ZERO_LINK = YES; - }; - isa = PBXBuildStyle; - name = Development; - }; - 4A9504C6FFE6A39111CA0CBA = { - buildRules = ( - ); - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - ZERO_LINK = NO; - }; - isa = PBXBuildStyle; - name = Deployment; - }; - 4A9504C8FFE6A3BC11CA0CBA = { - expectedFileType = wrapper.framework; - fallbackIsa = PBXFileReference; - isa = PBXFrameworkReference; - name = ApplicationServices.framework; - path = /System/Library/Frameworks/ApplicationServices.framework; - refType = 0; - sourceTree = "<absolute>"; - }; - 4A9504CAFFE6A41611CA0CBA = { - expectedFileType = wrapper.framework; - fallbackIsa = PBXFileReference; - isa = PBXFrameworkReference; - name = CoreServices.framework; - path = /System/Library/Frameworks/CoreServices.framework; - refType = 0; - sourceTree = "<absolute>"; - }; -//4A0 -//4A1 -//4A2 -//4A3 -//4A4 -//8D0 -//8D1 -//8D2 -//8D3 -//8D4 - 8D0C4E890486CD37000505A6 = { - buildPhases = ( - 22D275D307D515930050A600, //get_mocs phase - 8D0C4E8F0486CD37000505A6, - 8D0C4E910486CD37000505A6, - 8D0C4E940486CD37000505A6, - ); - buildRules = ( - //22E554940732E0C3002CE4A0, //get_mocs rule - 2241F8060731C52400C1F590, //make_moc rule - 2241F8060731C52430C1F590, //make_uic rule - 2241F8060731C59400C1F590, //make_rcc rule - ); - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ""; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_PREFIX_HEADER = ""; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = ""; - LIBRARY_STYLE = Static; - OTHER_CPLUSPLUSFLAGS = "-I/Library/Frameworks/QtCore.framework/Headers -I/Library/Frameworks/QtGui.framework/Headers"; - OTHER_CLAGS = "-I/Library/Frameworks/QtCore.framework/Headers -I/Library/Frameworks/QtGui.framework/Headers"; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = "«PROJECTNAME»"; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; - WRAPPER_EXTENSION = app; - }; - dependencies = ( - ); - isa = PBXNativeTarget; - name = "«PROJECTNAME»"; - productInstallPath = "$(HOME)/Applications"; - productName = "«PROJECTNAME»"; - productReference = 8D0C4E970486CD37000505A6; - productType = "com.apple.product-type.application"; - }; - 8D0C4E8B0486CD37000505A6 = { - fileRef = 32DBCF6D0370B57F00C91783; - isa = PBXBuildFile; - settings = { - }; - }; - 22D275D307D515930050A600 = { //get_mocs phase - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - //"*.h", - ); - name = "Qt Auto-Retrieve Mocables"; - isa = PBXShellScriptBuildPhase; - outputPaths = ( - //"«PROJECTNAME».mocs", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/Library/Frameworks/QtCore.framework/Resources/xcode/get_mocs.sh -output \"«PROJECTNAME».mocs\""; - }; - 22E554940732E0C3002CE4A0 = { //get_mocs rule - compilerSpec = com.apple.compilers.proxy.script; - filePatterns = "*.h"; - fileType = pattern.proxy; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - "«PROJECTNAME».mocs", - ); - script = "/Library/Frameworks/QtCore.framework/Resources/xcode/get_mocs.sh -input \"${INPUT_FILE_PATH}\" -output \"«PROJECTNAME».mocs\""; - }; - 2241F8060731C59400C1F590 = { //make_rcc rule - compilerSpec = com.apple.compilers.proxy.script; - filePatterns = "*.qrc"; - fileType = pattern.proxy; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - "${DERIVED_FILES_DIR}/qrc_${INPUT_FILE_BASE}.cpp", - ); - script = "/Library/Frameworks/QtCore.framework/Resources/xcode/make_rcc.sh -input \"${INPUT_FILE_PATH}\" -output \"${DERIVED_FILES_DIR}/qrc_${INPUT_FILE_BASE}.cpp\""; - }; - 2241F8060731C52430C1F590 = { //make_uic rule - compilerSpec = com.apple.compilers.proxy.script; - filePatterns = "*.ui"; - fileType = pattern.proxy; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - "${DERIVED_FILES_DIR}/ui_${INPUT_FILE_BASE}.h", - ); - script = "/Library/Frameworks/QtCore.framework/Resources/xcode/make_uic.sh -input \"${INPUT_FILE_PATH}\" -output \"${DERIVED_FILES_DIR}/ui_${INPUT_FILE_BASE}.h\""; - }; - 2241F8060731C52400C1F590 = { //make_moc rule - compilerSpec = com.apple.compilers.proxy.script; - filePatterns = "*.mocs"; - fileType = pattern.proxy; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - "${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}_mocs.cpp", - ); - script = "/Library/Frameworks/QtCore.framework/Resources/xcode/make_moc.sh -input \"${INPUT_FILE_PATH}\" -output \"${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}_mocs.cpp\""; - }; - 8D0C4E8F0486CD37000505A6 = { - buildActionMask = 2147483647; - files = ( - 8D0C4E8B0486CD37000505A6, - 8D0C4E900486CD37000505A6, - ); - isa = PBXSourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8D0C4E900486CD37000505A6 = { - fileRef = 20286C2BFDCF999611CA2CEA; - isa = PBXBuildFile; - settings = { - ATTRIBUTES = ( - ); - }; - }; - 8D0C4E910486CD37000505A6 = { - buildActionMask = 2147483647; - files = ( - 8D0C4E920486CD37000505A6, - 8D0C4E92048CCD37000505A6, - 8D0C4E930486CD37000505A6, - ); - isa = PBXFrameworksBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8D0C4E92048CCD37000505A6 = { - fileRef = 20286CA3FDCF999611CA2CEA; - isa = PBXBuildFile; - settings = { - }; - }; - 8D0C4E920486CD37000505A6 = { - fileRef = 20286C33FDCF999611CA2CEA; - isa = PBXBuildFile; - settings = { - }; - }; - 8D0C4E930486CD37000505A6 = { - fileRef = 0249A66BFF388E3F11CA2CEA; - isa = PBXBuildFile; - settings = { - }; - }; - 8D0C4E940486CD37000505A6 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXRezBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8D0C4E970486CD37000505A6 = { - expectedFileType = wrapper.application; - includeInIndex = 0; - isa = PBXFileReference; - path = "«PROJECTNAME».app"; - refType = 3; - sourceTree = BUILT_PRODUCTS_DIR; - }; - }; - rootObject = 20286C28FDCF999611CA2CEA; -} diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/version.plist b/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/version.plist deleted file mode 100644 index 6f3c68c..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Project Templates/Application/Qt Application/version.plist +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>BuildVersion</key> - <string>1</string> - <key>CFBundleShortVersionString</key> - <string>0.1</string> - <key>CFBundleVersion</key> - <string>0.1</string> - <key>ProjectName</key> - <string>NibPBTemplates</string> - <key>SourceVersion</key> - <string>1160200</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/10-aboutQt.sh b/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/10-aboutQt.sh deleted file mode 100755 index 343181e..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/10-aboutQt.sh +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh -# -# aboutQt.sh - Will display about Qt. -# -# -- PB User Script Info -- -# %%%{PBXName=About Qt}%%% -# %%%{PBXInput=None}%%% -# %%%{PBXOutput=SeparateWindow}%%% -# %%%{PBXKeyEquivalent=}%%% -# - -echo "This program uses Qt version $VERSION_MAJOR$." -echo "Qt is a C++ toolkit for cross-platform GUI " -echo "application development." -echo -echo "Qt provides single-source " -echo "portability across MS Windows, Mac OS X, " -echo "Linux, and all major commercial Unix variants." -echo -echo "Qt is also available for embedded devices." -echo -echo "Qt is a Trolltech product. " -echo "See http://qtsoftware.com/qt/ for more information." diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/20-getMocs.sh b/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/20-getMocs.sh deleted file mode 100755 index 3fea677..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/20-getMocs.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -# -# getMocs.sh - Will update meta object information for your current project -# -# -- PB User Script Info -- -# %%%{PBXName=Check for mocables}%%% -# %%%{PBXInput=None}%%% -# %%%{PBXOutput=AppendToAllText}%%% -# %%%{PBXKeyEquivalent=}%%% -# - -/Library/Frameworks/QtCore.framework/Resources/xcode/get_mocs.sh diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/menuIcon.tiff b/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/menuIcon.tiff Binary files differdeleted file mode 100644 index 466b976..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Scripts/999-Qt/menuIcon.tiff +++ /dev/null diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Specifications/qt.pbfilespec b/util/scripts/mac-binary/install/xcode/integration/templates/Specifications/qt.pbfilespec deleted file mode 100644 index 62b205d..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Specifications/qt.pbfilespec +++ /dev/null @@ -1,41 +0,0 @@ -/** Qt file formats -*/ -( - { - Identifier = sourcecode.qt.h; - BasedOn = sourcecode.cpp.h; - Name = "Qt header file"; - ComputerLanguage = qt.c.cpp; - AppliesToBuildRules = no; - Extensions = (h); - IncludeInIndex = NO; - CanSetIncludeInIndex = YES; - }, - { - Identifier = sourcecode.qt.cpp; - BasedOn = sourcecode.cpp.cpp; - Name = "Qt source file"; - ComputerLanguage = qt.c.cpp; - AppliesToBuildRules = yes; - Extensions = (cpp); - IncludeInIndex = YES; - CanSetIncludeInIndex = YES; - }, - { - Identifier = sourcecode.qt.qrc; - Name = "Qt resource file"; - ComputerLanguage = qt.qrc; - AppliesToBuildRules = yes; - Extensions = (qrc); - IncludeInIndex = NO; - }, - { - Identifier = sourcecode.qt.ui; - Name = "Qt UI file"; - ComputerLanguage = qt.ui; - AppliesToBuildRules = yes; - Extensions = (ui); - IncludeInIndex = NO; - } -) - diff --git a/util/scripts/mac-binary/install/xcode/integration/templates/Specifications/qt.pblangspec b/util/scripts/mac-binary/install/xcode/integration/templates/Specifications/qt.pblangspec deleted file mode 100644 index 6500020..0000000 --- a/util/scripts/mac-binary/install/xcode/integration/templates/Specifications/qt.pblangspec +++ /dev/null @@ -1,84 +0,0 @@ -( - { - Identifier = qt.c.cpp; - BasedOn = c.cpp; - Name = "Qt C++"; - SourceScannerClassName = PBXCPPSourceScanner; - SupportsIndentation = YES; - Description = "Qt C++"; - SyntaxColoring = { - CaseSensitive = YES; - Keywords = ( - "slots", - "signals", - "Q_OBJECT", - "Q_PROPERTY", - "Q_CLASSINFO", - "Q_INTERFACES", - "Q_PROPERTY", - "Q_OVERRIDE", - "Q_ENUMS", - "Q_FLAGS", - "Q_GADGET", - "foreach" - ); - AltKeywords = ( - "SLOT", - "SIGNAL", - "Q_SCRIPTABLE", - "Q_INVOKABLE", - "emit" - ); - }; - }, - { - Identifier = qt.xml; - Name = "Qt XML"; - Description = "Qt XML"; - BasedOn = "pbx_root_language"; - SupportsIndentation = NO; - Indentation = { - }; - SyntaxColoring = { - CaseSensitive = NO; - UnicodeSymbols = YES; - MultiLineComment = ( - ( "<!--", "-->" ) - ); - /*KeywordDelimeters = ( // not supported yet - ( "<", ">" ) - );*/ - String = ( - ( "<", ">" ) - ); - Character = ( - ( "&", ";", "=" ) - ); - }; - }, - { - Identifier = qt.qrc; - Name = "Qt Resource"; - Description = "Qt Resource"; - BasedOn = "qt.xml"; - SyntaxColoring = { - CaseSensitive = NO; - String = ( - "RCC", - "qresource", - "file", - ); - AltKeywords = ( - "version", - "prefix", - "alias" - ); - }; - }, - { - Identifier = qt.ui; - Name = "Qt UI"; - Description = "Qt UI"; - BasedOn = "qt.xml"; - } -) diff --git a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InfoPlist.strings b/util/scripts/mac-binary/package/InstallerPane/English.lproj/InfoPlist.strings Binary files differdeleted file mode 100644 index ea97bd3..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InfoPlist.strings +++ /dev/null diff --git a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/classes.nib b/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/classes.nib deleted file mode 100644 index 73d69c9..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/classes.nib +++ /dev/null @@ -1,43 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - CLASS = InstallerPane; - LANGUAGE = ObjC; - OUTLETS = { - contentView = NSView; - firstKeyView = NSView; - initialKeyView = NSView; - lastKeyView = NSView; - nextPane = InstallerPane; - parentSection = id; - }; - SUPERCLASS = NSObject; - }, - { - ACTIONS = {checkLicense = id; checkName = id; }; - CLASS = InstallerPanePane; - LANGUAGE = ObjC; - OUTLETS = { - LicenseField1 = NSTextField; - LicenseField2 = NSTextField; - LicenseField3 = NSTextField; - LicenseField4 = NSTextField; - LicenseField5 = NSTextField; - LicenseField6 = NSTextField; - LicenseField7 = NSTextField; - errorField = NSTextField; - myOutlet = id; - nameField = NSTextField; - }; - SUPERCLASS = InstallerPane; - }, - { - CLASS = InstallerSection; - LANGUAGE = ObjC; - OUTLETS = {firstPane = InstallerPane; }; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -}
\ No newline at end of file diff --git a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/info.nib b/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/info.nib deleted file mode 100644 index 0ec3501..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/info.nib +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>283 121 356 240 0 0 1600 1178 </string> - <key>IBEditorPositions</key> - <dict> - <key>8</key> - <string>162 556 438 372 0 0 1600 1178 </string> - </dict> - <key>IBFramework Version</key> - <string>446.1</string> - <key>IBOpenObjects</key> - <array> - <integer>8</integer> - </array> - <key>IBSystem Version</key> - <string>8I127</string> - <key>IBUsesTextArchiving</key> - <true/> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/keyedobjects.nib b/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/keyedobjects.nib deleted file mode 100644 index d15482e..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane.nib/keyedobjects.nib +++ /dev/null @@ -1,3688 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>$archiver</key> - <string>NSKeyedArchiver</string> - <key>$objects</key> - <array> - <string>$null</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>241</integer> - </dict> - <key>NSAccessibilityConnectors</key> - <dict> - <key>CF$UID</key> - <integer>238</integer> - </dict> - <key>NSAccessibilityOidsKeys</key> - <dict> - <key>CF$UID</key> - <integer>239</integer> - </dict> - <key>NSAccessibilityOidsValues</key> - <dict> - <key>CF$UID</key> - <integer>240</integer> - </dict> - <key>NSClassesKeys</key> - <dict> - <key>CF$UID</key> - <integer>182</integer> - </dict> - <key>NSClassesValues</key> - <dict> - <key>CF$UID</key> - <integer>183</integer> - </dict> - <key>NSConnections</key> - <dict> - <key>CF$UID</key> - <integer>8</integer> - </dict> - <key>NSFontManager</key> - <dict> - <key>CF$UID</key> - <integer>0</integer> - </dict> - <key>NSFramework</key> - <dict> - <key>CF$UID</key> - <integer>5</integer> - </dict> - <key>NSNamesKeys</key> - <dict> - <key>CF$UID</key> - <integer>159</integer> - </dict> - <key>NSNamesValues</key> - <dict> - <key>CF$UID</key> - <integer>160</integer> - </dict> - <key>NSNextOid</key> - <integer>130</integer> - <key>NSObjectsKeys</key> - <dict> - <key>CF$UID</key> - <integer>156</integer> - </dict> - <key>NSObjectsValues</key> - <dict> - <key>CF$UID</key> - <integer>158</integer> - </dict> - <key>NSOidsKeys</key> - <dict> - <key>CF$UID</key> - <integer>184</integer> - </dict> - <key>NSOidsValues</key> - <dict> - <key>CF$UID</key> - <integer>185</integer> - </dict> - <key>NSRoot</key> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <key>NSVisibleWindows</key> - <dict> - <key>CF$UID</key> - <integer>6</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>4</integer> - </dict> - <key>NSClassName</key> - <dict> - <key>CF$UID</key> - <integer>3</integer> - </dict> - </dict> - <string>InstallerSection</string> - <dict> - <key>$classes</key> - <array> - <string>NSCustomObject</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSCustomObject</string> - </dict> - <string>IBCocoaFramework</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>7</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSMutableSet</string> - <string>NSSet</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSMutableSet</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>24</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>9</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>14</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>16</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>119</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>121</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>122</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>123</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>124</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>125</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>127</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>129</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>131</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>133</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>135</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>137</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>139</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>141</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>143</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>144</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>145</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>146</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>147</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>148</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>149</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>150</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>151</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>152</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>153</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>154</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>12</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>4</integer> - </dict> - <key>NSClassName</key> - <dict> - <key>CF$UID</key> - <integer>11</integer> - </dict> - </dict> - <string>InstallerPanePane</string> - <string>firstPane</string> - <dict> - <key>$classes</key> - <array> - <string>NSNibOutletConnector</string> - <string>NSNibConnector</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSNibOutletConnector</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>15</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>parentSection</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>118</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>117</integer> - </dict> - <key>NSClassName</key> - <dict> - <key>CF$UID</key> - <integer>115</integer> - </dict> - <key>NSExtension</key> - <dict> - <key>CF$UID</key> - <integer>116</integer> - </dict> - <key>NSFrameSize</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>0</integer> - </dict> - <key>NSSubviews</key> - <dict> - <key>CF$UID</key> - <integer>18</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>24</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>86</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>90</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>94</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>98</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>102</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>106</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>110</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>39</integer> - </dict> - <key>NSBorderType</key> - <integer>3</integer> - <key>NSBoxType</key> - <integer>2</integer> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>25</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSOffsets</key> - <dict> - <key>CF$UID</key> - <integer>26</integer> - </dict> - <key>NSSubviews</key> - <dict> - <key>CF$UID</key> - <integer>20</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSTitleCell</key> - <dict> - <key>CF$UID</key> - <integer>27</integer> - </dict> - <key>NSTitlePosition</key> - <integer>0</integer> - <key>NSTransparent</key> - <false/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>24</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>21</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>23</integer> - </dict> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>22</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - </dict> - <string>{{2, 2}, {125, 1}}</string> - <dict> - <key>$classes</key> - <array> - <string>NSView</string> - <string>NSResponder</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSView</string> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSMutableArray</string> - <string>NSArray</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSMutableArray</string> - </dict> - <string>{{12, 154}, {394, 5}}</string> - <string>{0, 0}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>0</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>28</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>37</integer> - </dict> - </dict> - <string>Box</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>31</integer> - </dict> - <key>NSName</key> - <dict> - <key>CF$UID</key> - <integer>30</integer> - </dict> - <key>NSSize</key> - <real>13</real> - <key>NSfFlags</key> - <integer>1044</integer> - </dict> - <string>LucidaGrande</string> - <dict> - <key>$classes</key> - <array> - <string>NSFont</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSFont</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSCatalogName</key> - <dict> - <key>CF$UID</key> - <integer>33</integer> - </dict> - <key>NSColor</key> - <dict> - <key>CF$UID</key> - <integer>35</integer> - </dict> - <key>NSColorName</key> - <dict> - <key>CF$UID</key> - <integer>34</integer> - </dict> - <key>NSColorSpace</key> - <integer>6</integer> - </dict> - <string>System</string> - <string>textBackgroundColor</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>3</integer> - <key>NSWhite</key> - <data> - MQA= - </data> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSColor</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSColor</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>3</integer> - <key>NSWhite</key> - <data> - MCAwLjgwMDAwMDAxAA== - </data> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSTextFieldCell</string> - <string>NSActionCell</string> - <string>NSCell</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSTextFieldCell</string> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSBox</string> - <string>NSView</string> - <string>NSResponder</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSBox</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>42</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>41</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{240, 126}, {43, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <string></string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSCatalogName</key> - <dict> - <key>CF$UID</key> - <integer>33</integer> - </dict> - <key>NSColor</key> - <dict> - <key>CF$UID</key> - <integer>46</integer> - </dict> - <key>NSColorName</key> - <dict> - <key>CF$UID</key> - <integer>45</integer> - </dict> - <key>NSColorSpace</key> - <integer>6</integer> - </dict> - <string>textColor</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>3</integer> - <key>NSWhite</key> - <data> - MAA= - </data> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSTextField</string> - <string>%NSTextField</string> - <string>NSControl</string> - <string>NSView</string> - <string>NSResponder</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSTextField</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>50</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>49</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{187, 126}, {45, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>53</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>52</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{134, 126}, {45, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>56</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>55</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{83, 126}, {43, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>59</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>58</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{291, 126}, {45, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>62</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>61</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{9, 183}, {45, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>71303168</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>63</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>Name: -</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSCatalogName</key> - <dict> - <key>CF$UID</key> - <integer>33</integer> - </dict> - <key>NSColor</key> - <dict> - <key>CF$UID</key> - <integer>66</integer> - </dict> - <key>NSColorName</key> - <dict> - <key>CF$UID</key> - <integer>65</integer> - </dict> - <key>NSColorSpace</key> - <integer>6</integer> - </dict> - <string>controlColor</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>3</integer> - <key>NSWhite</key> - <data> - MC42NjY2NjY2OQA= - </data> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSCatalogName</key> - <dict> - <key>CF$UID</key> - <integer>33</integer> - </dict> - <key>NSColor</key> - <dict> - <key>CF$UID</key> - <integer>46</integer> - </dict> - <key>NSColorName</key> - <dict> - <key>CF$UID</key> - <integer>68</integer> - </dict> - <key>NSColorSpace</key> - <integer>6</integer> - </dict> - <string>controlTextColor</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>71</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>70</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{159, 156}, {82, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>72</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>License Key:</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>75</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>74</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{59, 181}, {347, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>78</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>77</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{30, 126}, {45, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>81</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>80</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{344, 126}, {44, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>84</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>83</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{78, 211}, {263, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>85</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>Please Enter Your Name and License Key -</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>88</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>87</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{27, 101}, {364, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>138412032</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>86</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>89</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>1</integer> - <key>NSRGB</key> - <data> - MCAwIDAA - </data> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>92</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>91</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{73, 128}, {12, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>93</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>90</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>- -</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>96</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>95</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{177, 128}, {12, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>97</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>94</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>- -</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>100</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>99</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{124, 128}, {12, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>101</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>98</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>- -</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>104</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>103</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{230, 128}, {12, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>105</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>102</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>- -</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>108</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>107</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{281, 128}, {12, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>109</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>106</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>- -</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>112</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>111</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{334, 128}, {11, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>113</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>110</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>- -</string> - <string>{418, 330}</string> - <string>NSView</string> - <string>NSResponder</string> - <dict> - <key>$classes</key> - <array> - <string>NSCustomView</string> - <string>NSView</string> - <string>NSResponder</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSCustomView</string> - </dict> - <string>contentView</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - </dict> - <string>nextKeyView</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>126</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>nameField</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField1</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>130</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField2</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>132</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField3</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>134</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField4</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>136</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField5</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>138</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField6</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>140</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField7</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - </dict> - <string>delegate</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>86</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>155</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>errorField</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>86</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>106</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>21</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>94</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>98</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>110</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>102</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>90</integer> - </dict> - </array> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSArray</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSArray</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>86</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>106</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>21</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>94</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>98</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>110</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>102</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>90</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>161</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>162</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>163</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>164</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>165</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>166</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>167</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>168</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>169</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>170</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>171</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>11</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>115</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>172</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>173</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>174</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>175</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>176</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>177</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>178</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>179</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>180</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>181</integer> - </dict> - </array> - </dict> - <string>NSTextField</string> - <string>File's Owner</string> - <string>NSTextField11326</string> - <string>NSTextField22</string> - <string>NSTextField11321</string> - <string>NSTextField11322</string> - <string>NSTextField11325</string> - <string>NSTextField211</string> - <string>NSTextField2331</string> - <string>NSTextField11324</string> - <string>NSTextField21</string> - <string>NSTextField231</string> - <string>NSBox1</string> - <string>NSTextField232</string> - <string>NSTextField1132</string> - <string>NSTextField2332</string> - <string>NSTextField2</string> - <string>View</string> - <string>NSTextField11323</string> - <string>NSTextField233</string> - <string>NSTextField23</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>127</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>149</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>141</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>94</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>122</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>98</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>129</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>150</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>143</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>123</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>16</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>21</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>131</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>151</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>144</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>86</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>124</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>121</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>153</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>133</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>152</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>145</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>154</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>119</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>135</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>146</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>14</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>90</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>9</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>102</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>147</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>137</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>106</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>110</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>125</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>148</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>139</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>186</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>187</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>188</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>189</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>190</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>191</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>192</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>193</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>194</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>195</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>196</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>197</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>198</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>199</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>200</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>201</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>202</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>203</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>204</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>205</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>206</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>207</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>208</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>209</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>210</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>211</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>212</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>213</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>214</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>215</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>216</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>217</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>218</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>219</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>220</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>221</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>222</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>223</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>224</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>225</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>226</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>227</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>228</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>229</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>230</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>231</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>232</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>233</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>234</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>235</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>236</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>237</integer> - </dict> - </array> - </dict> - <integer>62</integer> - <integer>94</integer> - <integer>116</integer> - <integer>109</integer> - <integer>125</integer> - <integer>73</integer> - <integer>89</integer> - <integer>5</integer> - <integer>126</integer> - <integer>95</integer> - <integer>117</integer> - <integer>110</integer> - <integer>80</integer> - <integer>90</integer> - <integer>9</integer> - <integer>69</integer> - <integer>72</integer> - <integer>96</integer> - <integer>118</integer> - <integer>111</integer> - <integer>122</integer> - <integer>1</integer> - <integer>91</integer> - <integer>88</integer> - <integer>79</integer> - <integer>68</integer> - <integer>120</integer> - <integer>97</integer> - <integer>119</integer> - <integer>112</integer> - <integer>121</integer> - <integer>77</integer> - <integer>123</integer> - <integer>87</integer> - <integer>98</integer> - <integer>113</integer> - <integer>7</integer> - <integer>124</integer> - <integer>8</integer> - <integer>76</integer> - <integer>6</integer> - <integer>127</integer> - <integer>114</integer> - <integer>99</integer> - <integer>128</integer> - <integer>75</integer> - <integer>129</integer> - <integer>71</integer> - <integer>92</integer> - <integer>115</integer> - <integer>74</integer> - <integer>100</integer> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>24</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSIBObjectData</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSIBObjectData</string> - </dict> - </array> - <key>$top</key> - <dict> - <key>IB.objectdata</key> - <dict> - <key>CF$UID</key> - <integer>1</integer> - </dict> - </dict> - <key>$version</key> - <integer>100000</integer> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/classes.nib b/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/classes.nib deleted file mode 100644 index ac5d9ad..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/classes.nib +++ /dev/null @@ -1,42 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - CLASS = InstallerPane; - LANGUAGE = ObjC; - OUTLETS = { - contentView = NSView; - firstKeyView = NSView; - initialKeyView = NSView; - lastKeyView = NSView; - nextPane = InstallerPane; - parentSection = id; - }; - SUPERCLASS = NSObject; - }, - { - ACTIONS = {checkLicense = id; checkName = id; }; - CLASS = InstallerPanePane; - LANGUAGE = ObjC; - OUTLETS = { - LicenseField1 = NSTextField; - LicenseField2 = NSTextField; - LicenseField3 = NSTextField; - LicenseField4 = NSTextField; - LicenseField5 = NSTextField; - LicenseField6 = NSTextField; - LicenseField7 = NSTextField; - companyField = NSTextField; - nameField = NSTextField; - }; - SUPERCLASS = InstallerPane; - }, - { - CLASS = InstallerSection; - LANGUAGE = ObjC; - OUTLETS = {firstPane = InstallerPane; }; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -}
\ No newline at end of file diff --git a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/info.nib b/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/info.nib deleted file mode 100644 index b06383f..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/info.nib +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>283 121 356 240 0 0 1600 1178 </string> - <key>IBEditorPositions</key> - <dict> - <key>8</key> - <string>303 597 438 372 0 0 1600 1178 </string> - </dict> - <key>IBFramework Version</key> - <string>439.0</string> - <key>IBOpenObjects</key> - <array> - <integer>8</integer> - </array> - <key>IBSystem Version</key> - <string>8C46</string> - <key>IBUsesTextArchiving</key> - <true/> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/keyedobjects.nib b/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/keyedobjects.nib deleted file mode 100644 index 81ba051..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/English.lproj/InstallerPane~.nib/keyedobjects.nib +++ /dev/null @@ -1,2942 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>$archiver</key> - <string>NSKeyedArchiver</string> - <key>$objects</key> - <array> - <string>$null</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>197</integer> - </dict> - <key>NSAccessibilityConnectors</key> - <dict> - <key>CF$UID</key> - <integer>194</integer> - </dict> - <key>NSAccessibilityOidsKeys</key> - <dict> - <key>CF$UID</key> - <integer>195</integer> - </dict> - <key>NSAccessibilityOidsValues</key> - <dict> - <key>CF$UID</key> - <integer>196</integer> - </dict> - <key>NSClassesKeys</key> - <dict> - <key>CF$UID</key> - <integer>146</integer> - </dict> - <key>NSClassesValues</key> - <dict> - <key>CF$UID</key> - <integer>147</integer> - </dict> - <key>NSConnections</key> - <dict> - <key>CF$UID</key> - <integer>8</integer> - </dict> - <key>NSFontManager</key> - <dict> - <key>CF$UID</key> - <integer>0</integer> - </dict> - <key>NSFramework</key> - <dict> - <key>CF$UID</key> - <integer>5</integer> - </dict> - <key>NSNamesKeys</key> - <dict> - <key>CF$UID</key> - <integer>130</integer> - </dict> - <key>NSNamesValues</key> - <dict> - <key>CF$UID</key> - <integer>131</integer> - </dict> - <key>NSNextOid</key> - <integer>122</integer> - <key>NSObjectsKeys</key> - <dict> - <key>CF$UID</key> - <integer>127</integer> - </dict> - <key>NSObjectsValues</key> - <dict> - <key>CF$UID</key> - <integer>129</integer> - </dict> - <key>NSOidsKeys</key> - <dict> - <key>CF$UID</key> - <integer>148</integer> - </dict> - <key>NSOidsValues</key> - <dict> - <key>CF$UID</key> - <integer>149</integer> - </dict> - <key>NSRoot</key> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <key>NSVisibleWindows</key> - <dict> - <key>CF$UID</key> - <integer>6</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>4</integer> - </dict> - <key>NSClassName</key> - <dict> - <key>CF$UID</key> - <integer>3</integer> - </dict> - </dict> - <string>InstallerSection</string> - <dict> - <key>$classes</key> - <array> - <string>NSCustomObject</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSCustomObject</string> - </dict> - <string>IBCocoaFramework</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>7</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSMutableSet</string> - <string>NSSet</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSMutableSet</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>24</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>9</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>14</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>16</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>91</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>93</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>94</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>95</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>96</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>97</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>99</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>101</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>103</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>105</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>107</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>109</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>111</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>113</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>115</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>116</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>117</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>118</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>119</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>121</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>122</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>124</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>125</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>126</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>12</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>4</integer> - </dict> - <key>NSClassName</key> - <dict> - <key>CF$UID</key> - <integer>11</integer> - </dict> - </dict> - <string>InstallerPanePane</string> - <string>firstPane</string> - <dict> - <key>$classes</key> - <array> - <string>NSNibOutletConnector</string> - <string>NSNibConnector</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSNibOutletConnector</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>15</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>parentSection</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>90</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>89</integer> - </dict> - <key>NSClassName</key> - <dict> - <key>CF$UID</key> - <integer>87</integer> - </dict> - <key>NSExtension</key> - <dict> - <key>CF$UID</key> - <integer>88</integer> - </dict> - <key>NSFrameSize</key> - <dict> - <key>CF$UID</key> - <integer>86</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>0</integer> - </dict> - <key>NSSubviews</key> - <dict> - <key>CF$UID</key> - <integer>18</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>24</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>39</integer> - </dict> - <key>NSBorderType</key> - <integer>3</integer> - <key>NSBoxType</key> - <integer>2</integer> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>25</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSOffsets</key> - <dict> - <key>CF$UID</key> - <integer>26</integer> - </dict> - <key>NSSubviews</key> - <dict> - <key>CF$UID</key> - <integer>20</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSTitleCell</key> - <dict> - <key>CF$UID</key> - <integer>27</integer> - </dict> - <key>NSTitlePosition</key> - <integer>0</integer> - <key>NSTransparent</key> - <false/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>24</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>21</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>23</integer> - </dict> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>22</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - </dict> - <string>{{2, 2}, {125, 1}}</string> - <dict> - <key>$classes</key> - <array> - <string>NSView</string> - <string>NSResponder</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSView</string> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSMutableArray</string> - <string>NSArray</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSMutableArray</string> - </dict> - <string>{{12, 154}, {394, 5}}</string> - <string>{0, 0}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>0</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>28</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>37</integer> - </dict> - </dict> - <string>Box</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>31</integer> - </dict> - <key>NSName</key> - <dict> - <key>CF$UID</key> - <integer>30</integer> - </dict> - <key>NSSize</key> - <real>13</real> - <key>NSfFlags</key> - <integer>1044</integer> - </dict> - <string>LucidaGrande</string> - <dict> - <key>$classes</key> - <array> - <string>NSFont</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSFont</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSCatalogName</key> - <dict> - <key>CF$UID</key> - <integer>33</integer> - </dict> - <key>NSColor</key> - <dict> - <key>CF$UID</key> - <integer>35</integer> - </dict> - <key>NSColorName</key> - <dict> - <key>CF$UID</key> - <integer>34</integer> - </dict> - <key>NSColorSpace</key> - <integer>6</integer> - </dict> - <string>System</string> - <string>textBackgroundColor</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>3</integer> - <key>NSWhite</key> - <data> - MQA= - </data> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSColor</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSColor</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>3</integer> - <key>NSWhite</key> - <data> - MCAwLjgwMDAwMDAxAA== - </data> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSTextFieldCell</string> - <string>NSActionCell</string> - <string>NSCell</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSTextFieldCell</string> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSBox</string> - <string>NSView</string> - <string>NSResponder</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSBox</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>42</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>41</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{240, 126}, {43, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <string></string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSCatalogName</key> - <dict> - <key>CF$UID</key> - <integer>33</integer> - </dict> - <key>NSColor</key> - <dict> - <key>CF$UID</key> - <integer>46</integer> - </dict> - <key>NSColorName</key> - <dict> - <key>CF$UID</key> - <integer>45</integer> - </dict> - <key>NSColorSpace</key> - <integer>6</integer> - </dict> - <string>textColor</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>3</integer> - <key>NSWhite</key> - <data> - MAA= - </data> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSTextField</string> - <string>%NSTextField</string> - <string>NSControl</string> - <string>NSView</string> - <string>NSResponder</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSTextField</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>50</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>49</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{187, 126}, {45, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>53</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>52</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{134, 126}, {45, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>56</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>55</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{83, 126}, {43, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>59</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>58</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{291, 126}, {45, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>62</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>61</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{9, 183}, {45, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>71303168</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>63</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>Name: -</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSCatalogName</key> - <dict> - <key>CF$UID</key> - <integer>33</integer> - </dict> - <key>NSColor</key> - <dict> - <key>CF$UID</key> - <integer>66</integer> - </dict> - <key>NSColorName</key> - <dict> - <key>CF$UID</key> - <integer>65</integer> - </dict> - <key>NSColorSpace</key> - <integer>6</integer> - </dict> - <string>controlColor</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSColorSpace</key> - <integer>3</integer> - <key>NSWhite</key> - <data> - MC42NjY2NjY2OQA= - </data> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>36</integer> - </dict> - <key>NSCatalogName</key> - <dict> - <key>CF$UID</key> - <integer>33</integer> - </dict> - <key>NSColor</key> - <dict> - <key>CF$UID</key> - <integer>46</integer> - </dict> - <key>NSColorName</key> - <dict> - <key>CF$UID</key> - <integer>68</integer> - </dict> - <key>NSColorSpace</key> - <integer>6</integer> - </dict> - <string>controlTextColor</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>71</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>70</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{159, 156}, {82, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>72</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>License Key:</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>75</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>74</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{59, 181}, {347, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>78</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>77</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{30, 126}, {45, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>81</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>80</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{344, 126}, {44, 22}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>32</integer> - </dict> - <key>NSCellFlags</key> - <integer>-1804468671</integer> - <key>NSCellFlags2</key> - <integer>272630784</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>43</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <key>NSDrawsBackground</key> - <true/> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>44</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>47</integer> - </dict> - <key>NSCell</key> - <dict> - <key>CF$UID</key> - <integer>84</integer> - </dict> - <key>NSEnabled</key> - <true/> - <key>NSFrame</key> - <dict> - <key>CF$UID</key> - <integer>83</integer> - </dict> - <key>NSNextResponder</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSSuperview</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <key>NSvFlags</key> - <integer>256</integer> - </dict> - <string>{{78, 211}, {263, 17}}</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>38</integer> - </dict> - <key>NSBackgroundColor</key> - <dict> - <key>CF$UID</key> - <integer>64</integer> - </dict> - <key>NSCellFlags</key> - <integer>67239424</integer> - <key>NSCellFlags2</key> - <integer>272629760</integer> - <key>NSContents</key> - <dict> - <key>CF$UID</key> - <integer>85</integer> - </dict> - <key>NSControlView</key> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <key>NSSupport</key> - <dict> - <key>CF$UID</key> - <integer>29</integer> - </dict> - <key>NSTextColor</key> - <dict> - <key>CF$UID</key> - <integer>67</integer> - </dict> - </dict> - <string>Please Enter Your Name and License Key -</string> - <string>{418, 330}</string> - <string>NSView</string> - <string>NSResponder</string> - <dict> - <key>$classes</key> - <array> - <string>NSCustomView</string> - <string>NSView</string> - <string>NSResponder</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSCustomView</string> - </dict> - <string>contentView</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>92</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - </dict> - <string>nextKeyView</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>92</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>92</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>92</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>92</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>98</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>nameField</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>100</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField1</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>102</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField2</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>104</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField3</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>106</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField4</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>108</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField5</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>110</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField6</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>112</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </dict> - <string>LicenseField7</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - </dict> - <string>delegate</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>114</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>123</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - </dict> - <string>nextKeyView</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>123</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>123</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>13</integer> - </dict> - <key>NSDestination</key> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <key>NSLabel</key> - <dict> - <key>CF$UID</key> - <integer>123</integer> - </dict> - <key>NSSource</key> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>21</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - </array> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSArray</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSArray</string> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>21</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>132</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>133</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>87</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>134</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>135</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>136</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>137</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>138</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>139</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>140</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>141</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>142</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>11</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>143</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>144</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>145</integer> - </dict> - </array> - </dict> - <string>NSTextField11325</string> - <string>NSTextField211</string> - <string>NSTextField11324</string> - <string>NSTextField11321</string> - <string>NSBox1</string> - <string>NSTextField1132</string> - <string>NSTextField2</string> - <string>NSTextField21</string> - <string>NSTextField11323</string> - <string>File's Owner</string> - <string>NSTextField</string> - <string>NSTextField11326</string> - <string>View</string> - <string>NSTextField11322</string> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>125</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>117</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>60</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>121</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>82</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>2</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>9</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>93</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>17</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>126</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>57</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>101</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>19</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>94</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>116</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>10</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>79</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>14</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>103</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>54</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>91</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>95</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>16</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>105</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>76</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>122</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>51</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>96</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>120</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>124</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>119</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>107</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>73</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>97</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>48</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>118</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>113</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>109</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>115</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>21</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>99</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>69</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>40</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>111</integer> - </dict> - </array> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array> - <dict> - <key>CF$UID</key> - <integer>150</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>151</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>152</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>153</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>154</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>155</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>156</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>157</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>158</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>159</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>160</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>161</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>162</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>163</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>164</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>165</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>166</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>167</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>168</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>169</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>170</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>171</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>172</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>173</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>174</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>175</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>176</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>177</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>178</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>179</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>180</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>181</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>182</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>183</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>184</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>185</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>186</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>187</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>188</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>189</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>190</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>191</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>192</integer> - </dict> - <dict> - <key>CF$UID</key> - <integer>193</integer> - </dict> - </array> - </dict> - <integer>119</integer> - <integer>112</integer> - <integer>77</integer> - <integer>116</integer> - <integer>121</integer> - <integer>1</integer> - <integer>6</integer> - <integer>88</integer> - <integer>8</integer> - <integer>120</integer> - <integer>76</integer> - <integer>95</integer> - <integer>68</integer> - <integer>89</integer> - <integer>111</integer> - <integer>5</integer> - <integer>75</integer> - <integer>7</integer> - <integer>96</integer> - <integer>74</integer> - <integer>87</integer> - <integer>90</integer> - <integer>9</integer> - <integer>97</integer> - <integer>62</integer> - <integer>117</integer> - <integer>73</integer> - <integer>91</integer> - <integer>115</integer> - <integer>118</integer> - <integer>114</integer> - <integer>98</integer> - <integer>80</integer> - <integer>92</integer> - <integer>72</integer> - <integer>113</integer> - <integer>109</integer> - <integer>99</integer> - <integer>110</integer> - <integer>69</integer> - <integer>94</integer> - <integer>79</integer> - <integer>71</integer> - <integer>100</integer> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>24</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$class</key> - <dict> - <key>CF$UID</key> - <integer>128</integer> - </dict> - <key>NS.objects</key> - <array/> - </dict> - <dict> - <key>$classes</key> - <array> - <string>NSIBObjectData</string> - <string>NSObject</string> - </array> - <key>$classname</key> - <string>NSIBObjectData</string> - </dict> - </array> - <key>$top</key> - <dict> - <key>IB.objectdata</key> - <dict> - <key>CF$UID</key> - <integer>1</integer> - </dict> - </dict> - <key>$version</key> - <integer>100000</integer> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/InstallerPane/English.lproj/Localizable.strings b/util/scripts/mac-binary/package/InstallerPane/English.lproj/Localizable.strings Binary files differdeleted file mode 100644 index 13b56d9..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/English.lproj/Localizable.strings +++ /dev/null diff --git a/util/scripts/mac-binary/package/InstallerPane/Info.plist b/util/scripts/mac-binary/package/InstallerPane/Info.plist deleted file mode 100644 index b255851..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/Info.plist +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>InstallerPane</string> - <key>CFBundleIdentifier</key> - <string>com.trolltech.qt.installerPlugin</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>Installer</string> - <key>CFBundlePackageType</key> - <string>BNDL</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>InstallerSectionTitle</key> - <string>InstallerPane</string> - <key>NSMainNibFile</key> - <string>InstallerPane</string> - <key>NSPrincipalClass</key> - <string>InstallerSection</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/InstallerPane/InstallerPane.xcodeproj/default.pbxuser b/util/scripts/mac-binary/package/InstallerPane/InstallerPane.xcodeproj/default.pbxuser deleted file mode 100644 index 8c4de76..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/InstallerPane.xcodeproj/default.pbxuser +++ /dev/null @@ -1,238 +0,0 @@ -// !$*UTF8*$! -{ - 089C1669FE841209C02AAC07 = { - activeBuildStyle = 014CEA420018CDE011CA2923; - activeTarget = 8D5B49AC048680CD000E48DA; - codeSenseManager = B4ED4491067AA67F00C170C8; - perUserDictionary = { - PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { - PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; - PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; - PBXFileTableDataSourceColumnWidthsKey = ( - 20, - 206, - 20, - 206, - 43, - 43, - 20, - ); - PBXFileTableDataSourceColumnsKey = ( - PBXFileDataSource_FiletypeID, - PBXFileDataSource_Filename_ColumnID, - PBXFileDataSource_Built_ColumnID, - PBXFileDataSource_ObjectSize_ColumnID, - PBXFileDataSource_Errors_ColumnID, - PBXFileDataSource_Warnings_ColumnID, - PBXFileDataSource_Target_ColumnID, - ); - }; - PBXPerProjectTemplateStateSaveDate = 108701307; - PBXPrepackagedSmartGroups_v2 = ( - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - activationKey = OldTargetSmartGroup; - clz = PBXTargetSmartGroup; - description = "Displays all targets of the project."; - globalID = 1C37FABC04509CD000000102; - name = Targets; - preferences = { - image = Targets; - }; - }, - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - clz = PBXTargetSmartGroup2; - description = "Displays all targets of the project as well as nested build phases."; - globalID = 1C37FBAC04509CD000000102; - name = Targets; - preferences = { - image = Targets; - }; - }, - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - clz = PBXExecutablesSmartGroup; - description = "Displays all executables of the project."; - globalID = 1C37FAAC04509CD000000102; - name = Executables; - preferences = { - image = Executable; - }; - }, - { - " PBXTransientLocationAtTop " = bottom; - absolutePathToBundle = ""; - clz = PBXErrorsWarningsSmartGroup; - description = "Displays files with errors or warnings."; - globalID = 1C08E77C0454961000C914BD; - name = "Errors and Warnings"; - preferences = { - fnmatch = ""; - image = WarningsErrors; - recursive = 1; - regex = ""; - root = "<PROJECT>"; - }; - }, - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - clz = PBXFilenameSmartGroup; - description = "Filters items in a given group (potentially recursively) based on matching the name with the regular expression of the filter."; - globalID = 1CC0EA4004350EF90044410B; - name = "Implementation Files"; - preferences = { - canSave = 1; - fnmatch = ""; - image = SmartFolder; - isLeaf = 0; - recursive = 1; - regex = "?*\\.[mcMC]"; - root = "<PROJECT>"; - }; - }, - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - clz = PBXFilenameSmartGroup; - description = "This group displays Interface Builder NIB Files."; - globalID = 1CC0EA4004350EF90041110B; - name = "NIB Files"; - preferences = { - canSave = 1; - fnmatch = "*.nib"; - image = SmartFolder; - isLeaf = 0; - recursive = 1; - regex = ""; - root = "<PROJECT>"; - }; - }, - { - PBXTransientLocationAtTop = no; - absolutePathToBundle = ""; - clz = PBXFindSmartGroup; - description = "Displays Find Results."; - globalID = 1C37FABC05509CD000000102; - name = "Find Results"; - preferences = { - image = spyglass; - }; - }, - { - PBXTransientLocationAtTop = no; - absolutePathToBundle = ""; - clz = PBXBookmarksSmartGroup; - description = "Displays Project Bookmarks."; - globalID = 1C37FABC05539CD112110102; - name = Bookmarks; - preferences = { - image = Bookmarks; - }; - }, - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - clz = XCSCMSmartGroup; - description = "Displays files with interesting SCM status."; - globalID = E2644B35053B69B200211256; - name = SCM; - preferences = { - image = PBXRepository; - isLeaf = 0; - }; - }, - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - clz = PBXSymbolsSmartGroup; - description = "Displays all symbols for the project."; - globalID = 1C37FABC04509CD000100104; - name = "Project Symbols"; - preferences = { - image = ProjectSymbols; - isLeaf = 1; - }; - }, - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - clz = PBXFilenameSmartGroup; - description = "Filters items in a given group (potentially recursively) based on matching the name with the regular expression of the filter."; - globalID = PBXTemplateMarker; - name = "Simple Filter SmartGroup"; - preferences = { - canSave = 1; - fnmatch = "*.nib"; - image = SmartFolder; - isLeaf = 0; - recursive = 1; - regex = ""; - root = "<PROJECT>"; - }; - }, - { - PBXTransientLocationAtTop = bottom; - absolutePathToBundle = ""; - clz = PBXFilenameSmartGroup; - description = "Filters items in a given group (potentially recursively) based on matching the name with the regular expression of the filter."; - globalID = PBXTemplateMarker; - name = "Simple Regular Expression SmartGroup"; - preferences = { - canSave = 1; - fnmatch = ""; - image = SmartFolder; - isLeaf = 0; - recursive = 1; - regex = "?*\\.[mcMC]"; - root = "<PROJECT>"; - }; - }, - { - PBXTransientLocationAtTop = bottom; - clz = XDDesignSmartGroup; - description = "Displays Xdesign models"; - globalID = 2E4A936305E6979E00701470; - name = Design; - preferences = { - image = Design; - isLeaf = 0; - }; - }, - ); - PBXWorkspaceStateSaveDate = 108701307; - }; - sourceControlManager = B4ED4490067AA67F00C170C8; - userBuildSettings = { - }; - }; - 8D5B49AC048680CD000E48DA = { - activeExec = 0; - }; - B4ED4490067AA67F00C170C8 = { - fallbackIsa = XCSourceControlManager; - isa = PBXSourceControlManager; - scmConfiguration = { - }; - scmType = ""; - }; - B4ED4491067AA67F00C170C8 = { - indexTemplatePath = ""; - isa = PBXCodeSenseManager; - usesDefaults = 1; - wantsCodeCompletion = 1; - wantsCodeCompletionAutoPopup = 1; - wantsCodeCompletionAutoSuggestions = 0; - wantsCodeCompletionCaseSensitivity = 1; - wantsCodeCompletionListAlways = 1; - wantsCodeCompletionOnlyMatchingItems = 1; - wantsCodeCompletionParametersIncluded = 1; - wantsCodeCompletionPlaceholdersInserted = 1; - wantsCodeCompletionTabCompletes = 1; - wantsIndex = 1; - }; -} diff --git a/util/scripts/mac-binary/package/InstallerPane/InstallerPane.xcodeproj/project.pbxproj b/util/scripts/mac-binary/package/InstallerPane/InstallerPane.xcodeproj/project.pbxproj deleted file mode 100644 index 4445b5d..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/InstallerPane.xcodeproj/project.pbxproj +++ /dev/null @@ -1,381 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; - 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; - B40F7FFC06739E1B0053A16B /* InstallerPlugins.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B40F7FFB06739E1B0053A16B /* InstallerPlugins.framework */; }; - B40F802906739F480053A16B /* InstallerPane.nib in Resources */ = {isa = PBXBuildFile; fileRef = B40F802706739F480053A16B /* InstallerPane.nib */; }; - B47CF355067B4E030066DBF6 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B47CF353067B4E030066DBF6 /* Localizable.strings */; }; - CA21468F0897D41100C0167A /* InstallerSecionSection.mm in Sources */ = {isa = PBXBuildFile; fileRef = CA21468E0897D41100C0167A /* InstallerSecionSection.mm */; }; - CA72AA6A089640B3001196EE /* InstallerPanePane.mm in Sources */ = {isa = PBXBuildFile; fileRef = CA72AA69089640B3001196EE /* InstallerPanePane.mm */; }; - CADBCF9F08F55066009B9612 /* helpfulfunc.mm in Sources */ = {isa = PBXBuildFile; fileRef = CADBCF9E08F55066009B9612 /* helpfulfunc.mm */; }; - CADBD0A108F58F9C009B9612 /* keydec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CADBD0A008F58F9B009B9612 /* keydec.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; - 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; - 32DBCF630370AF2F00C91783 /* InstallerPane_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstallerPane_Prefix.pch; sourceTree = "<group>"; }; - 8D5B49B6048680CD000E48DA /* InstallerPane.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InstallerPane.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; - B40F7FFB06739E1B0053A16B /* InstallerPlugins.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = InstallerPlugins.framework; path = /System/Library/Frameworks/InstallerPlugins.framework; sourceTree = "<absolute>"; }; - B40F802806739F480053A16B /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/InstallerPane.nib; sourceTree = "<group>"; }; - B44C200806739AE500D31AA1 /* InstallerPanePane.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = InstallerPanePane.h; sourceTree = "<group>"; }; - B47CF354067B4E030066DBF6 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; }; - B4A6B2A60673D523003CD9B2 /* InstallerSections.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = InstallerSections.plist; sourceTree = "<group>"; }; - CA21468D0897D41100C0167A /* InstallerSecionSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstallerSecionSection.h; sourceTree = "<group>"; }; - CA21468E0897D41100C0167A /* InstallerSecionSection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InstallerSecionSection.mm; sourceTree = "<group>"; }; - CA2146C00897D69E00C0167A /* helpfulfunc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = helpfulfunc.h; sourceTree = "<group>"; }; - CA72A9A40896304E001196EE /* keydec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = keydec.h; sourceTree = "<group>"; }; - CA72AA69089640B3001196EE /* InstallerPanePane.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InstallerPanePane.mm; sourceTree = "<group>"; }; - CADBCF9E08F55066009B9612 /* helpfulfunc.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = helpfulfunc.mm; sourceTree = "<group>"; }; - CADBD0A008F58F9B009B9612 /* keydec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = keydec.cpp; sourceTree = "<group>"; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D5B49B3048680CD000E48DA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */, - B40F7FFC06739E1B0053A16B /* InstallerPlugins.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* InstallerPlugin */ = { - isa = PBXGroup; - children = ( - 08FB77AFFE84173DC02AAC07 /* Classes */, - 32C88E010371C26100C91783 /* Other Sources */, - 089C167CFE841241C02AAC07 /* Resources */, - 089C1671FE841209C02AAC07 /* Frameworks and Libraries */, - 19C28FB8FE9D52D311CA2CBB /* Products */, - ); - name = InstallerPlugin; - sourceTree = "<group>"; - }; - 089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, - 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, - ); - name = "Frameworks and Libraries"; - sourceTree = "<group>"; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - B47CF353067B4E030066DBF6 /* Localizable.strings */, - B4A6B2A60673D523003CD9B2 /* InstallerSections.plist */, - 8D5B49B7048680CD000E48DA /* Info.plist */, - 089C167DFE841241C02AAC07 /* InfoPlist.strings */, - B40F802706739F480053A16B /* InstallerPane.nib */, - ); - name = Resources; - sourceTree = "<group>"; - }; - 08FB77AFFE84173DC02AAC07 /* Classes */ = { - isa = PBXGroup; - children = ( - CADBD0A008F58F9B009B9612 /* keydec.cpp */, - CADBCF9E08F55066009B9612 /* helpfulfunc.mm */, - CA72A9A40896304E001196EE /* keydec.h */, - B44C200806739AE500D31AA1 /* InstallerPanePane.h */, - CA72AA69089640B3001196EE /* InstallerPanePane.mm */, - CA21468D0897D41100C0167A /* InstallerSecionSection.h */, - CA21468E0897D41100C0167A /* InstallerSecionSection.mm */, - CA2146C00897D69E00C0167A /* helpfulfunc.h */, - ); - name = Classes; - sourceTree = "<group>"; - }; - 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, - B40F7FFB06739E1B0053A16B /* InstallerPlugins.framework */, - ); - name = "Linked Frameworks"; - sourceTree = "<group>"; - }; - 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 089C1672FE841209C02AAC07 /* Foundation.framework */, - 089C167FFE841241C02AAC07 /* AppKit.framework */, - ); - name = "Other Frameworks"; - sourceTree = "<group>"; - }; - 19C28FB8FE9D52D311CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D5B49B6048680CD000E48DA /* InstallerPane.bundle */, - ); - name = Products; - sourceTree = "<group>"; - }; - 32C88E010371C26100C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32DBCF630370AF2F00C91783 /* InstallerPane_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D5B49AC048680CD000E48DA /* InstallerPane */ = { - isa = PBXNativeTarget; - buildConfigurationList = CA72A7AF0894D77F001196EE /* Build configuration list for PBXNativeTarget "InstallerPane" */; - buildPhases = ( - 8D5B49AF048680CD000E48DA /* Resources */, - 8D5B49B1048680CD000E48DA /* Sources */, - 8D5B49B3048680CD000E48DA /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = InstallerPane; - productInstallPath = "$(HOME)/Library/Bundles"; - productName = InstallerPlugin; - productReference = 8D5B49B6048680CD000E48DA /* InstallerPane.bundle */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = CA72A7B30894D77F001196EE /* Build configuration list for PBXProject "InstallerPane" */; - compatibilityVersion = "Xcode 2.4"; - hasScannedForEncodings = 1; - mainGroup = 089C166AFE841209C02AAC07 /* InstallerPlugin */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8D5B49AC048680CD000E48DA /* InstallerPane */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D5B49AF048680CD000E48DA /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */, - B40F802906739F480053A16B /* InstallerPane.nib in Resources */, - B47CF355067B4E030066DBF6 /* Localizable.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D5B49B1048680CD000E48DA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CA72AA6A089640B3001196EE /* InstallerPanePane.mm in Sources */, - CA21468F0897D41100C0167A /* InstallerSecionSection.mm in Sources */, - CADBCF9F08F55066009B9612 /* helpfulfunc.mm in Sources */, - CADBD0A108F58F9C009B9612 /* keydec.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C167EFE841241C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = "<group>"; - }; - B40F802706739F480053A16B /* InstallerPane.nib */ = { - isa = PBXVariantGroup; - children = ( - B40F802806739F480053A16B /* English */, - ); - name = InstallerPane.nib; - sourceTree = "<group>"; - }; - B47CF353067B4E030066DBF6 /* Localizable.strings */ = { - isa = PBXVariantGroup; - children = ( - B47CF354067B4E030066DBF6 /* English */, - ); - name = Localizable.strings; - sourceTree = "<group>"; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - CA1E6BC90897938F0079C491 /* Debug-eval */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = InstallerPane_Prefix.pch; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - PREBINDING = NO; - PRODUCT_NAME = InstallerPane; - WRAPPER_EXTENSION = bundle; - ZERO_LINK = YES; - }; - name = "Debug-eval"; - }; - CA1E6BCA0897938F0079C491 /* Debug-eval */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_ENABLE_FIX_AND_CONTINUE = YES; - OTHER_CFLAGS = "-DQT_EVAL"; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - ZERO_LINK = YES; - }; - name = "Debug-eval"; - }; - CA72A7B00894D77F001196EE /* Debug-commercial */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = InstallerPane_Prefix.pch; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - PREBINDING = NO; - PRODUCT_NAME = InstallerPane; - WRAPPER_EXTENSION = bundle; - ZERO_LINK = YES; - }; - name = "Debug-commercial"; - }; - CA72A7B10894D77F001196EE /* Release-commercial */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - ppc, - i386, - ); - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = InstallerPane_Prefix.pch; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - PREBINDING = NO; - PRODUCT_NAME = InstallerPane; - WRAPPER_EXTENSION = bundle; - ZERO_LINK = NO; - }; - name = "Release-commercial"; - }; - CA72A7B40894D77F001196EE /* Debug-commercial */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_ENABLE_FIX_AND_CONTINUE = YES; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - ZERO_LINK = YES; - }; - name = "Debug-commercial"; - }; - CA72A7B50894D77F001196EE /* Release-commercial */ = { - isa = XCBuildConfiguration; - buildSettings = { - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - }; - name = "Release-commercial"; - }; - CAEBD75C0896974E0003461D /* Release-eval */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - ppc, - i386, - ); - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = InstallerPane_Prefix.pch; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - PREBINDING = NO; - PRODUCT_NAME = InstallerPane; - WRAPPER_EXTENSION = bundle; - ZERO_LINK = NO; - }; - name = "Release-eval"; - }; - CAEBD75D0896974E0003461D /* Release-eval */ = { - isa = XCBuildConfiguration; - buildSettings = { - OTHER_CFLAGS = "-DQT_EVAL"; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - }; - name = "Release-eval"; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - CA72A7AF0894D77F001196EE /* Build configuration list for PBXNativeTarget "InstallerPane" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CA72A7B00894D77F001196EE /* Debug-commercial */, - CA1E6BC90897938F0079C491 /* Debug-eval */, - CA72A7B10894D77F001196EE /* Release-commercial */, - CAEBD75C0896974E0003461D /* Release-eval */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = "Debug-commercial"; - }; - CA72A7B30894D77F001196EE /* Build configuration list for PBXProject "InstallerPane" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CA72A7B40894D77F001196EE /* Debug-commercial */, - CA1E6BCA0897938F0079C491 /* Debug-eval */, - CA72A7B50894D77F001196EE /* Release-commercial */, - CAEBD75D0896974E0003461D /* Release-eval */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = "Debug-commercial"; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/util/scripts/mac-binary/package/InstallerPane/InstallerPanePane.h b/util/scripts/mac-binary/package/InstallerPane/InstallerPanePane.h deleted file mode 100644 index e7ff301..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/InstallerPanePane.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/* InstallerPanePane */ - -#import <InstallerPlugins/InstallerPane.h> -#import <Cocoa/Cocoa.h> - -@interface InstallerPanePane : InstallerPane -{ - int licenseStatus; - BOOL nameCheckOK; - NSMutableString *fullLicenseKey; - IBOutlet NSTextField *LicenseField1; - IBOutlet NSTextField *LicenseField2; - IBOutlet NSTextField *LicenseField3; - IBOutlet NSTextField *LicenseField4; - IBOutlet NSTextField *LicenseField5; - IBOutlet NSTextField *LicenseField6; - IBOutlet NSTextField *LicenseField7; - IBOutlet NSTextField *nameField; - IBOutlet NSTextField *errorField; - NSString *initialLicensee; - NSString *initialLicenseKey; -} -- (void)checkLicense; -- (void)checkName; -- (void)tryEnable; -- (void)manipulateEditorString:(NSTextField *)TextField; -- (void)fillInForm; -@end diff --git a/util/scripts/mac-binary/package/InstallerPane/InstallerPanePane.mm b/util/scripts/mac-binary/package/InstallerPane/InstallerPanePane.mm deleted file mode 100644 index 268d594..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/InstallerPanePane.mm +++ /dev/null @@ -1,250 +0,0 @@ -#import "InstallerPanePane.h" -#import "helpfulfunc.h" - -static BOOL checkForLicenseFile() -{ - static const int LICENSESIZE = 42; - int value = -1; - static NSString *qtLicense = [NSHomeDirectory() stringByAppendingPathComponent: @".qt-license"]; - NSData *fileContents = [[NSFileManager defaultManager] contentsAtPath: qtLicense]; - if (fileContents != nil) { - const char *charBuffer = (const char *)[fileContents bytes]; - int length = [fileContents length]; - char *location = strnstr(charBuffer, LicenseKeyExtString, length); - if (location) { - location += strlen(LicenseKeyExtString); - char licenseString[LICENSESIZE]; - strncpy(licenseString, location, LICENSESIZE); - licenseString[LICENSESIZE - 1] = '\0'; - while (location = strstr(licenseString, "\n")) - *location = '\0'; - value = validateLicense(licenseString); - } - } - return value == LicenseOK; -} - -@implementation InstallerPanePane -- (NSString *)title -{ - return [[NSBundle bundleForClass:[self class]] localizedStringForKey:@"PaneTitle" - value:nil table:nil]; -} - -- (id)init -{ - self = [super init]; - if (self) { - licenseStatus = InvalidLicense; - nameCheckOK = NO; - fullLicenseKey = [[NSMutableString alloc] initWithCapacity:35]; - [self fillInForm]; - } - return self; -} - -- (void)fillInForm -{ - static NSString *qtLicense = [NSHomeDirectory() stringByAppendingPathComponent: @".qt-license"]; - NSData *fileData = [[NSFileManager defaultManager] contentsAtPath: qtLicense]; - NSString *fileContents = [[[NSString alloc] initWithData:fileData - encoding:NSUTF8StringEncoding] autorelease]; - if (fileContents == nil) - return; - NSArray *array = [fileContents componentsSeparatedByString:@"\n"]; - uint totalCount = [array count]; - initialLicensee = nil; - initialLicenseKey = nil; - for (uint i = 0; i < totalCount; ++i) { - if (initialLicensee != nil && initialLicenseKey != nil) - break; - NSString *string = [array objectAtIndex:i]; - if (initialLicenseKey == nil) { - NSRange range = [string rangeOfString:[NSString stringWithUTF8String:LicenseKeyExtString]]; - if (range.location != NSNotFound && range.length != 0) { - initialLicenseKey = [string substringFromIndex:range.location + range.length]; - [initialLicenseKey retain]; - continue; - } - } - if (initialLicensee == nil) { - NSRange range = [string rangeOfString:[NSString stringWithUTF8String:LicenseeString]]; - if (range.location != NSNotFound && range.length != 0) { - initialLicensee = [[string substringFromIndex:range.location + range.length] - stringByTrimmingCharactersInSet: - [NSCharacterSet characterSetWithCharactersInString:@"\""]]; - [initialLicensee retain]; - continue; - } - } - } -} - -- (void)willEnterPane:(InstallerSectionDirection)dir -{ - NSString *string = [nameField stringValue]; - - if ((string == nil || [string length] == 0) && (initialLicensee != nil)) - [nameField setStringValue:initialLicensee]; - string = [LicenseField1 stringValue]; - if ((string == nil || [string length] == 0 && (initialLicenseKey != nil))) { - NSArray *array = [initialLicenseKey componentsSeparatedByString:@"-"]; - NSArray *licenseFieldArray = [NSArray arrayWithObjects:LicenseField1, LicenseField2, - LicenseField3, LicenseField4, - LicenseField5, LicenseField6, LicenseField7, nil]; - uint count = [array count]; - count = (count > 7) ? 7 : count; - for (uint i = 0; i < count; ++i) - [[licenseFieldArray objectAtIndex:i] setStringValue:[array objectAtIndex:i]]; - } - [self checkLicense]; -} - -- (BOOL)shouldExitPane:(InstallerSectionDirection)dir -{ - if ((dir == InstallerDirectionForward)) { - if ((licenseStatus != LicenseOK) && !nameCheckOK) - return NO; - - // Copy the file first - NSFileManager *fm = [NSFileManager defaultManager]; - NSString *qtLicense = [NSHomeDirectory() stringByAppendingPathComponent: @".qt-license"]; -#if 0 - if ([fm fileExistsAtPath:qtLicense]) { - NSMutableString *alternatePlace = [NSMutableString stringWithCapacity: 256]; - [alternatePlace setString : [NSHomeDirectory() stringByAppendingPathComponent: @".qt-license.bak"]]; - NSNumber *backNumber = [NSNumber numberWithInt:1]; - int index = [alternatePlace length] - 1; - - while ([fm fileExistsAtPath:alternatePlace]) { - [alternatePlace insertString:[backNumber stringValue] atIndex:index]; - int foo = [backNumber intValue]; - ++foo; - backNumber = [NSNumber numberWithInt:foo]; - } - [fm copyPath:qtLicense toPath:alternatePlace handler:nil]; - } -#endif - - NSMutableString *finalString = [NSMutableString stringWithCapacity:256]; - NSMutableString *nameString = [NSMutableString stringWithCapacity:128]; - [nameString appendString: [nameField stringValue]]; - [nameString replaceOccurrencesOfString:@"\"" withString:@"'" - options:NSLiteralSearch range:NSMakeRange(0, [nameString length])]; - - [finalString appendString:[NSString stringWithUTF8String: LicenseeString]]; - [finalString appendString:@"\""]; - [finalString appendString:nameString]; - [finalString appendString:@"\""]; - [finalString appendString:@"\n"]; - [finalString appendString:[NSString stringWithUTF8String: LicenseKeyExtString]]; - [finalString appendString:fullLicenseKey]; - [finalString appendString:@"\n"]; - - const char *finalFinalString = [finalString UTF8String]; - - NSData *data = [NSData dataWithBytes:finalFinalString length:strlen(finalFinalString)]; - [fm createFileAtPath:qtLicense contents:data attributes:nil]; - } - return YES; -} - -- (void)didEnterPane:(InstallerSectionDirection)dir -{ - [self checkName]; - [self checkLicense]; - [nameField selectText:self]; -} - -- (void)manipulateEditorString:(NSTextField *) textField -{ - NSString *string = [[textField currentEditor] string]; - NSRange range = [string rangeOfString:@"-"]; - if (range.location == NSNotFound) { - return; - } else { - NSString *theBeginning = [string substringToIndex:range.location]; - NSString *theRest = [string substringFromIndex:range.location + 1]; - NSText *ed = [textField currentEditor]; - [ed setString:theBeginning]; - NSView *nextView = [textField nextValidKeyView]; - if (nextView != nil && [nextView class] == [textField class]) { - NSTextField *nextTextField = (NSTextField *)nextView; - [[nextTextField window] makeFirstResponder: nextTextField]; - ed = [nextTextField currentEditor]; - [ed setString:theRest]; - // Bubble this along to catch extra dashes - [self manipulateEditorString:nextTextField]; - } - } -} - -- (void)controlTextDidChange:(NSNotification *)aNotification -{ - NSTextField *itemThatChanged = [aNotification object]; - if (itemThatChanged == nameField) { - [self checkName]; - } else if (itemThatChanged != nil) { - [self manipulateEditorString: itemThatChanged]; - [self checkLicense]; - } -} - - -- (void)checkLicense -{ - int i; - [fullLicenseKey setString:@""]; - NSTextField *theLicenseFields[] = { LicenseField1, LicenseField2, LicenseField3, LicenseField4, - LicenseField5, LicenseField6, LicenseField7 }; - - for (i = 0; i < sizeof(theLicenseFields) / sizeof(NSTextField*); ++i) { - NSString *part = [[theLicenseFields[i] stringValue] - stringByTrimmingCharactersInSet:[NSCharacterSet - whitespaceAndNewlineCharacterSet]]; - if ([part length] <= 0) { - licenseStatus = InvalidLicense; - [self tryEnable]; - return; - } - if (i != 0) - [fullLicenseKey appendString:@"-"]; - [fullLicenseKey appendString:[part uppercaseString]]; - } - - licenseStatus = validateLicense([fullLicenseKey UTF8String]); - [self tryEnable]; -} - -- (void)checkName -{ - NSString *name = [nameField stringValue]; - nameCheckOK = [name length] > 0; - [self tryEnable]; -} - - -- (void)tryEnable -{ - [self setNextEnabled:(licenseStatus == LicenseOK) && nameCheckOK]; - switch (licenseStatus) { - case LicenseOK: - case InvalidLicense: - [errorField setStringValue:@""]; - break; - case InvalidType: - [errorField setStringValue:@"This license cannot be used with this version of Qt"]; - break; - case InvalidPlatform: - [errorField setStringValue:@"This license cannot be used for this Qt Platform"]; - break; - case LicenseExpired: - [errorField setStringValue:@"This license has expired for this product,\n contact sales@trolltech.com for an upgrade"]; - break; - } -} - - -@end - - diff --git a/util/scripts/mac-binary/package/InstallerPane/InstallerPane_Prefix.pch b/util/scripts/mac-binary/package/InstallerPane/InstallerPane_Prefix.pch deleted file mode 100644 index c0a0b78..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/InstallerPane_Prefix.pch +++ /dev/null @@ -1,8 +0,0 @@ -// -// Prefix header for all source files of the 'InstallerPlugin' target in the 'InstallerPlugin' project. -// - -#ifdef __OBJC__ - #import <Cocoa/Cocoa.h> - #import <InstallerPlugins/InstallerPlugins.h> -#endif diff --git a/util/scripts/mac-binary/package/InstallerPane/InstallerSecionSection.mm b/util/scripts/mac-binary/package/InstallerPane/InstallerSecionSection.mm deleted file mode 100644 index 5d04a5e..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/InstallerSecionSection.mm +++ /dev/null @@ -1,46 +0,0 @@ -// -// InstallerSecionSection.mm -// InstallerPane -// -// Created by Trenton Schulz on 7/27/05. -// Copyright 2005 __MyCompanyName__. All rights reserved. -// - -#import "InstallerSecionSection.h" -#import "helpfulfunc.h" -#import <stdio.h> -#import <string.h> - - -static BOOL checkForLicenseFile() -{ - static const int LICENSESIZE = 42; - int value = -1; - static NSString *qtLicense = [NSHomeDirectory() stringByAppendingPathComponent: @".qt-license"]; - NSData *fileContents = [[NSFileManager defaultManager] contentsAtPath: qtLicense]; - if (fileContents != nil) { - const char *charBuffer = (const char *)[fileContents bytes]; - int length = [fileContents length]; - char *location = strnstr(charBuffer, LicenseKeyExtString, length); - if (location) { - location += strlen(LicenseKeyExtString); - char licenseString[LICENSESIZE]; - strncpy(licenseString, location, LICENSESIZE); - licenseString[LICENSESIZE - 1] = '\0'; - while (location = strstr(licenseString, "\n")) - *location = '\0'; - value = validateLicense(licenseString); - } - } - return value == LicenseOK; -} - - -@implementation InstallerSecionSection - -- (BOOL)shouldLoad -{ - return !checkForLicenseFile(); -} - -@end diff --git a/util/scripts/mac-binary/package/InstallerPane/InstallerSections.plist b/util/scripts/mac-binary/package/InstallerPane/InstallerSections.plist deleted file mode 100644 index 0a82f56..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/InstallerSections.plist +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>SectionOrder</key> - <array> - <string>Introduction</string> - <string>ReadMe</string> - <string>License</string> - <string>InstallerPane.bundle</string> - <string>Target</string> - <string>PackageSelection</string> - <string>Install</string> - </array> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/InstallerPane/helpfulfunc.mm b/util/scripts/mac-binary/package/InstallerPane/helpfulfunc.mm deleted file mode 100644 index 35b877a..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/helpfulfunc.mm +++ /dev/null @@ -1,88 +0,0 @@ -/* - * helpfulfunc.c - * InstallerPane - * - * Created by Trenton Schulz on 7/27/05. - * Copyright 2005 __MyCompanyName__. All rights reserved. - * - */ - -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include "helpfulfunc.h" -#include "keydec.h" - -#include <Cocoa/Cocoa.h> - -const char LicenseKeyExtString[] = "LicenseKeyExt="; -const char LicenseeString[] = "Licensee="; - -int validateLicense(const char *string) -{ - KeyDecoder key(string); - int ret = InvalidLicense; - int validSchema = -#ifdef QT_EVAL - (KeyDecoder::SupportedEvaluation - | KeyDecoder::UnsupportedEvaluation | KeyDecoder::FullSourceEvaluation); -#else - (KeyDecoder::FullSourceEvaluation | KeyDecoder::Academic - | KeyDecoder::Educational | KeyDecoder::FullCommercial); -#endif - if (key.IsValid()) { - if (!(key.getProducts() & (KeyDecoder::QtUniversal | KeyDecoder::QtDesktop - | KeyDecoder::QtDesktopLight | KeyDecoder::QtConsole))) { - ret = InvalidProduct; - } else { - if (!(key.getPlatforms() - & (KeyDecoder::Mac | KeyDecoder::Embedded | KeyDecoder::WinCE))) { - ret = InvalidPlatform; - } else { - - if (!(key.getLicenseSchema() & validSchema)) { - ret = InvalidType; - } else { - ret = LicenseOK; - } - } - } - } - - if (ret == LicenseOK) { - // We need to check ourselves against the build date - // First read in the build date and then use it to compare with the - // Expiry Date if it's commercial or the current date if it's an eval. - CDate date = key.getExpiryDate(); - NSCalendarDate *expiryDate = [NSCalendarDate dateWithYear:date.year() - month:date.month() day:date.day() - hour:23 minute:59 second:59 - timeZone:[NSTimeZone systemTimeZone]]; - NSCalendarDate *compareDay = 0; -#ifdef QT_EVAL - compareDay = [NSCalendarDate calendarDate]; -#else - // There's a lot of bundles here, so we have to make sure we get the correct one - NSBundle *bundle = nil; - NSArray *bundles = [NSBundle allBundles]; - for (uint i = 0; i < [bundles count]; ++i) { - NSBundle *bun = [bundles objectAtIndex: i]; - NSRange location = [[bun bundleIdentifier] rangeOfString:@"com.trolltech.qt4."]; - if (location.length == 0) - location = [[bun bundleIdentifier] rangeOfString:@"Trolltech Qt Packages"]; - - if (location.length != 0) { - bundle = bun; - break; - } - - } - NSString *contents = [NSString stringWithContentsOfFile:[bundle pathForResource:@".package_date" ofType:nil] - encoding:NSUTF8StringEncoding error:0]; - compareDay = [NSCalendarDate dateWithString: contents calendarFormat:@"%Y-%m-%d"]; -#endif - if ([expiryDate laterDate: compareDay] != expiryDate) - ret = LicenseExpired; - } - return ret; -} diff --git a/util/scripts/mac-binary/package/InstallerPane/keydec.cpp b/util/scripts/mac-binary/package/InstallerPane/keydec.cpp deleted file mode 100644 index e672187..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/keydec.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "keydec.h" - -#define MAX_STRSIZE 256 -#define NUMBER_OF_PARTS 7 - -const ushort KeyDecoder::crc_tbl[] = { - 0x0000, 0x1081, 0x2102, 0x3183, - 0x4204, 0x5285, 0x6306, 0x7387, - 0x8408, 0x9489, 0xa50a, 0xb58b, - 0xc60c, 0xd68d, 0xe70e, 0xf78f -}; - -const char KeyDecoder::Xalphabet[] = "WX9MUEC7AJH3KS6DB4YFG2L5PQRT8VNZ"; -const int KeyDecoder::XAlphabetSize = sizeof(Xalphabet) - 1; -const CDate KeyDecoder::StartDate = CDate(2001, 1, 1); -const uint KeyDecoder::MaxDays = 4000; - -const char *KeyDecoder::Products[] = { - "Qt Universal", - "Qt Desktop", - "Qt Desktop Light", - "Qt Console", - "Qt Designer Only", - 0, - 0, - 0, - 0, - 0, - - "Qtopia PDA", - "Qtopia Phone", - "Qtopia Reference Board", - 0, - 0, - 0, - 0, - 0, - 0, - 0, - - "Teambuilder", - "Solutions", - "QSA", - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 -}; - -const char *KeyDecoder::Platforms[] = { - "X11", - "Embedded", - "Windows", - "Mac", - "Windows CE" -}; - -const char *KeyDecoder::LicenseSchemas[] = { - "Supported Evaluation", - "Unsupported Evaluation", - "Full Source Evaluation", - "Full Commercial", - "Academic", - "Educational" -}; - -const char *KeyDecoder::LicenseFeatures[] = { - "US Customer", - "Floating License", - 0, - 0 -}; - -const int KeyDecoder::NumberOfProducts = sizeof(Products) / sizeof(char *); -const int KeyDecoder::NumberOfPlatforms = sizeof(Platforms) / sizeof(char *); -const int KeyDecoder::NumberOfLicenseSchemas = sizeof(LicenseSchemas) / sizeof(char *); -const int KeyDecoder::NumberOfLicenseFeatures = sizeof(LicenseFeatures) / sizeof(char *); - -CDate::CDate() : m_jd(0) -{ -} - -CDate::CDate(int y, int m, int d) -{ - m_jd = gregorianToJulian(y, m, d); -} - -CDate::CDate(CDate *d) -{ - m_jd = d->m_jd; -} - -CDate::CDate(uint julianDays) -{ - m_jd = julianDays; -} - -int CDate::year() const -{ - int y, m, d; - julianToGregorian(m_jd, y, m, d); - return y; -} - -int CDate::month() const -{ - int y, m, d; - julianToGregorian(m_jd, y, m, d); - return m; -} - -int CDate::day() const -{ - int y, m, d; - julianToGregorian(m_jd, y, m, d); - return d; -} - -uint CDate::gregorianToJulian(int y, int m, int d) const -{ - uint c, ya; - if (y <= 99) - y += 1900; - if (m > 2) { - m -= 3; - } else { - m += 9; - y--; - } - c = y; // NOTE: Sym C++ 6.0 bug - c /= 100; - ya = y - 100*c; - return 1721119 + d + (146097*c)/4 + (1461*ya)/4 + (153*m+2)/5; -} - -void CDate::julianToGregorian(uint jd, int &y, int &m, int &d) const -{ - uint x; - uint j = jd - 1721119; - y = (j*4 - 1)/146097; - j = j*4 - 146097*y - 1; - x = j/4; - j = (x*4 + 3) / 1461; - y = 100*y + j; - x = (x*4) + 3 - 1461*j; - x = (x + 4)/4; - m = (5*x - 3)/153; - x = 5*x - 3 - 153*m; - d = (x + 5)/5; - if (m < 10) { - m += 3; - } else { - m -= 9; - y++; - } -} - -void KeyDecoder::encodeBaseX(uint k, char *str) -{ - memset(str, 0, MAX_STRSIZE); - - do { - str[strlen(str)] = Xalphabet[ k % XAlphabetSize ]; - k /= XAlphabetSize; - } while (k > 0u); -} - -uint KeyDecoder::decodeBaseX(const char *str) -{ - uint k = 0; - int i = (int)strlen(str); - while (i > 0) { - i--; - const char *p = strchr(Xalphabet, str[i]); - if (p == 0) { - return 0; - } else { - k = (k * XAlphabetSize) + (p - Xalphabet); - } - } - return k; -} - -void KeyDecoder::encodedExpiryDate(const CDate &date, char *str) -{ - encodeBaseX(date.julianDate() ^ ExpiryDateMagic, str); -} - -CDate KeyDecoder::decodedExpiryDate(const char *encodedDate) -{ - uint y = decodeBaseX(encodedDate); - uint x = y ^ ExpiryDateMagic; - - CDate date(x); - - char str[MAX_STRSIZE]; - encodedExpiryDate(date, str); - - if (strcmp(encodedDate, str) != 0) - return CDate(); - return date; -} - -ushort KeyDecoder::qChecksum(const char *data, uint len) -{ - ushort crc = 0xffff; - uchar c; - const uchar *p = reinterpret_cast<const uchar *>(data); - while (len--) { - c = *p++; - crc = ((crc >> 4) & 0x0fff) ^ crc_tbl[((crc ^ c) & 15)]; - c >>= 4; - crc = ((crc >> 4) & 0x0fff) ^ crc_tbl[((crc ^ c) & 15)]; - } - return ~crc & 0xffff; -} - -KeyDecoder::KeyDecoder(const char *clicenseKey) - : products(0), platforms(0), licenseSchema(0), licenseFeatures(0), licenseID(0), m_valid(false) -{ - static const int MAXCHARS = 7; - static const char * const SEP = "-"; - -#ifndef _WIN32_WCE - char *buffer = strdup(clicenseKey); -#else - char *buffer = (char*) malloc(strlen(clicenseKey) + 1); - strcpy(buffer, clicenseKey); -#endif - char *licenseParts[NUMBER_OF_PARTS]; - int partNumber = 0; - - for (char *part = strtok(buffer, SEP); part != 0; part = strtok(0, SEP)) - licenseParts[partNumber++] = part; - - if (partNumber < (NUMBER_OF_PARTS-1)) { - free(buffer); - return; //invalid key - } - - int crcPeices = NUMBER_OF_PARTS - 1; - char *crcCheckKey = (char*)calloc(crcPeices * MAXCHARS + crcPeices, sizeof(char)); - for (int i = 0; i < crcPeices; ++i) { - if (i != 0) - strncat(crcCheckKey, SEP, 1); - strncat(crcCheckKey, licenseParts[i], MAXCHARS); - } - - int crc = qChecksum(crcCheckKey, (uint)strlen(crcCheckKey)); - - char checksumVerification[5]; -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) - _snprintf(checksumVerification, 5, "%.2X%.2X", (crc & 0xff), (crc >> 8 & 0xff)); -#else - snprintf(checksumVerification, 5, "%.2X%.2X", (crc & 0xff), (crc >> 8 & 0xff)); -#endif - - if (strncmp(checksumVerification, licenseParts[6], 5) != 0) { - free(buffer); - free(crcCheckKey); - return; //invalid checksum - } - - products = decodeBaseX(licenseParts[0]) ^ ProductMagic; - platforms = decodeBaseX(licenseParts[1]) ^ PlatformMagic; - licenseSchema = decodeBaseX(licenseParts[2]) ^ LicenseSchemaMagic; - licenseFeatures = decodeBaseX(licenseParts[3]) ^ FeatureMagic; - licenseID = decodeBaseX(licenseParts[4]) ^ LicenseIDMagic; - expiryDate = decodedExpiryDate(licenseParts[5]); - - m_valid = true; - free(buffer); - free(crcCheckKey); -} diff --git a/util/scripts/mac-binary/package/InstallerPane/keydec.h b/util/scripts/mac-binary/package/InstallerPane/keydec.h deleted file mode 100644 index ef1db96..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/keydec.h +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef KEYDEC_H -#define KEYDEC_H - -typedef unsigned int uint; -typedef unsigned short ushort; -typedef unsigned char uchar; - -class CDate -{ -public: - CDate(); - CDate(int y, int m, int d); - CDate(CDate *d); - CDate(uint julianDays); - - int year() const; - int month() const; - int day() const; - uint julianDate() const { return m_jd; } - -private: - uint gregorianToJulian(int y, int m, int d) const; - void julianToGregorian(uint jd, int &y, int &m, int &d) const; - uint m_jd; -}; - -class KeyDecoder -{ -private: - static const ushort crc_tbl[16]; - static const CDate StartDate; - static const uint MaxDays; - - void encodeBaseX(uint k, char *str); - uint decodeBaseX(const char *str); - - void encodedExpiryDate(const CDate &date, char *str); - CDate decodedExpiryDate(const char *encodedDate); - - ushort qChecksum(const char *data, uint len); - - uint products; - uint platforms; - uint licenseSchema; - uint licenseFeatures; - uint licenseID; - CDate expiryDate; - bool m_valid; - -public: - // Magic values - enum { - ProductMagic = 0xB292, - PlatformMagic = 0x5C7E, - LicenseSchemaMagic = 0xE3B, - LicenseIDMagic = 0xCE57, - FeatureMagic = 0x4D5, - ExpiryDateMagic = 0x5B7EC4 - }; - static const char Xalphabet[]; - static const int XAlphabetSize; - - // Products - enum { - // the first 10 bits are reserved for Qt editions - QtUniversal = 0x00000001, - QtDesktop = 0x00000002, - QtDesktopLight = 0x00000004, - QtConsole = 0x00000008, - QtDesignerOnly = 0x00000010, - QtReserved1 = 0x00000020, - QtReserved2 = 0x00000040, - QtReserved3 = 0x00000080, - QtReserved4 = 0x00000100, - QtReserved5 = 0x00000200, - - // the next 10 bits are reserved for Qtopia editions - QtopiaPDA = 0x00000400, - QtopiaPhone = 0x00000800, - QtopiaRefboard = 0x00001000, - QtopiaReserved1 = 0x00002000, - QtopiaReserved2 = 0x00004000, - QtopiaReserved3 = 0x00008000, - QtopiaReserved4 = 0x00010000, - QtopiaReserved5 = 0x00020000, - QtopiaReserved6 = 0x00040000, - QtopiaReserved7 = 0x00080000, - - // other products get the upper 12 bits - Teambuilder = 0x00100000, - Solutions = 0x00200000, - QSA = 0x00400000, - OtherReserved1 = 0x00800000, - OtherReserved2 = 0x01000000, - OtherReserved3 = 0x02000000, - OtherReserved4 = 0x04000000, - OtherReserved5 = 0x08000000, - OtherReserved6 = 0x10000000, - OtherReserved7 = 0x20000000, - OtherReserved8 = 0x40000000, - OtherReserved9 = 0x80000000 - }; - - static const char *Products[]; - - // Platforms - enum { - X11 = 0x0001, - Embedded = 0x0002, - Windows = 0x0004, - Mac = 0x0008, - WinCE = 0x0010, - // Symbian = 0x0020, - - // Everything - AllOS = X11 | Embedded | Windows | Mac | WinCE // | Symbian - }; - static const char *Platforms[]; - - // License Schema - enum { - SupportedEvaluation = 0x0001, - UnsupportedEvaluation = 0x0002, - FullSourceEvaluation = 0x0004, - AnyEvaluation = SupportedEvaluation | UnsupportedEvaluation | FullSourceEvaluation, - - FullCommercial = 0x0008, - Academic = 0x0010, - Educational = 0x0020 - }; - static const char *LicenseSchemas[]; - - // License Feature - enum { - USCustomer = 0x0001, - FloatingLicense = 0x0002 - }; - static const char *LicenseFeatures[]; - - static const int NumberOfProducts; - static const int NumberOfPlatforms; - static const int NumberOfLicenseSchemas; - static const int NumberOfLicenseFeatures; - - KeyDecoder(const char *licenseKey); - - uint getProducts() {return products;} - uint getPlatforms() {return platforms;} - uint getLicenseSchema() {return licenseSchema;} - uint getLicenseFeatures() {return licenseFeatures;} - uint getLicenseID() {return licenseID;} - CDate getExpiryDate() {return expiryDate;} - - bool IsValid() { return m_valid; } -}; - -#endif //KEYDEC_H diff --git a/util/scripts/mac-binary/package/InstallerPane/version.plist b/util/scripts/mac-binary/package/InstallerPane/version.plist deleted file mode 100644 index bab2922..0000000 --- a/util/scripts/mac-binary/package/InstallerPane/version.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>BuildVersion</key> - <string>43</string> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>ProjectName</key> - <string>DevToolsWizardTemplates</string> - <key>SourceVersion</key> - <string>3670000</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/MetaPackage/Info.plist b/util/scripts/mac-binary/package/MetaPackage/Info.plist deleted file mode 100644 index a348db5..0000000 --- a/util/scripts/mac-binary/package/MetaPackage/Info.plist +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleGetInfoString</key> - <string>Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$.$VERSION_PATCH$</string> - <key>CFBundleIdentifier</key> - <string>Trolltech Qt Packages</string> - <key>CFBundleName</key> - <string>Qt by Trolltech</string> - <key>CFBundleShortVersionString</key> - <string>Qt$VERSION_MAJOR$.$VERSION_MINOR$</string> - <key>IFMajorVersion</key> - <integer>$VERSION_MAJOR$</integer> - <key>IFPkgFlagAuthorizationAction</key> - <string>AdminAuthorization</string> - <key>IFPkgFlagFollowLinks</key> - <true/> - <key>IFMinorVersion</key> - <integer>$VERSION_MINOR$</integer> - <key>IFPkgFlagComponentDirectory</key> - <string>../packages</string> - <key>IFPkgFlagPackageList</key> - <array> - <!-- PACKAGE_DICT --> - </array> - <key>IFPkgFormatVersion</key> - <real>0.10000000149011612</real> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/MetaPackage/PkgInfo b/util/scripts/mac-binary/package/MetaPackage/PkgInfo deleted file mode 100644 index 4cd3119..0000000 --- a/util/scripts/mac-binary/package/MetaPackage/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -pmkrpkg1
\ No newline at end of file diff --git a/util/scripts/mac-binary/package/MetaPackage/Resources/Description.plist b/util/scripts/mac-binary/package/MetaPackage/Resources/Description.plist deleted file mode 100644 index efcf4ce..0000000 --- a/util/scripts/mac-binary/package/MetaPackage/Resources/Description.plist +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IFPkgDescriptionDeleteWarning</key> - <string></string> - <key>IFPkgDescriptionDescription</key> - <string>Qt by Trolltech</string> - <key>IFPkgDescriptionTitle</key> - <string>Qt</string> - <key>IFPkgDescriptionVersion</key> - <string>Trolltech Qt$VERSION_MAJOR$.$VERSION_MINOR$</string> -</dict> -</plist> diff --git a/util/scripts/mac-binary/package/MetaPackage/Resources/Qt.info b/util/scripts/mac-binary/package/MetaPackage/Resources/Qt.info deleted file mode 100644 index d294490..0000000 --- a/util/scripts/mac-binary/package/MetaPackage/Resources/Qt.info +++ /dev/null @@ -1,16 +0,0 @@ -Title Qt -Version Trolltech Qt $VERSION_MAJOR$.$VERSION_MINOR$ -Description Qt by Trolltech -DefaultLocation (null) -DeleteWarning - -### Package Flags - -NeedsAuthorization NO -Required NO -Relocatable NO -RequiresReboot NO -UseUserMask YES -OverwritePermissions NO -InstallFat NO -RootVolumeOnly NO diff --git a/util/scripts/mac-binary/package/Resources/InstallationCheck b/util/scripts/mac-binary/package/Resources/InstallationCheck deleted file mode 100755 index d0df5cd..0000000 --- a/util/scripts/mac-binary/package/Resources/InstallationCheck +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -# We need to do things differently on different platforms -# <10.3.9 Can't install -# =10.3.9 Can install, but must check license manually -# >=10.4 Just jump out - -os_version=`sysctl kern.osrelease | awk '{ print $3 }'` -os_major=`echo $os_version | cut -d . -f 1` -os_minor=`echo $os_version | cut -d . -f 2` - -if [ $os_major -lt 7 -o $os_major -eq 7 -a $os_minor -lt 9 ]; then - exit $((96+19)) -elif [ $os_major -eq 7 -a $os_minor -eq 9 ]; then - [ -f $HOME/.qt-license ] || exit $((96+16)); - - . $HOME/.qt-license >/dev/null 2>&1 - [ -z "$LicenseKeyExt" -o -z "$Licensee" ] && exit $((96+17)) - - grep "Evaluation" "$1/Contents/Resources/Welcome.rtf" 2>&1 >/dev/null && LicenseType="Evaluation" || LicenseType="Commercial" - - # License key format is incorrect. - echo $LicenseKeyExt | grep ".....*-....*-....*-....*-.....*-.....*-...." 2>&1 >/dev/null || exit $((96+17)) - - #Test the key is correct. - productTest=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1` - platformTest=`echo $LicenseKeyExt | cut -f 2 -d - | cut -b 1` - licenseFeatureTest=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1` - licenseTypeTest=`echo $LicenseKeyExt | cut -f 3 -d - | cut -b 1` - - case $productTest in - F) - # Universal - ProductType="Universal" - ;; - B) - # Desktop - ProductType="Desktop" - ;; - L) - # Desktop Lite - ProductType="Desktop Light" - ;; - R) - # Console - ProductType="Console" - ;; - *) - exit $((96+18)) ;; - esac - - #check the palatform. - case $platformTest in - 4|L|5|G|Y|2|F|B) - # Qt/Mac - ;; - *) - exit $((96+18)) ;; - esac - - case $licenseTypeTest in - F|T|3) - licenseTest=Commercial - ;; - Z|R|Q) - licenseTest=Evaluation - ;; - *) - ;; - esac - - [ "$licenseTest" != "$LicenseType" ] && exit $((96+18)) - - expiryDate=`"$1/Contents/Resources/keydecoder" $LicenseKeyExt | sed -e s,-,,g` - if [ -z "$expiryDate" ]; then - exit $((96+18)) - fi - - packageDate=`cat "$1/Contents/Resources/.package_date" | sed -e s,-,,g` - today=`date +%Y%m%d` - - case $licenseTest in - Commercial) - if [ $packageDate -gt $expiryDate ]; then - exit $((96+20)) - fi - ;; - Evaluation) - if [ $today -gt $expiryDate ]; then - exit $((96+21)) - fi - ;; - esac -fi - -exit 0 diff --git a/util/scripts/mac-binary/package/Resources/InstallationCheck.strings b/util/scripts/mac-binary/package/Resources/InstallationCheck.strings Binary files differdeleted file mode 100644 index 0ddbcd2..0000000 --- a/util/scripts/mac-binary/package/Resources/InstallationCheck.strings +++ /dev/null diff --git a/util/scripts/mac-binary/package/Resources/background.jpg b/util/scripts/mac-binary/package/Resources/background.jpg Binary files differdeleted file mode 100644 index 0b0840f..0000000 --- a/util/scripts/mac-binary/package/Resources/background.jpg +++ /dev/null diff --git a/util/scripts/mac-binary/package/Welcome-commercial.rtf b/util/scripts/mac-binary/package/Welcome-commercial.rtf deleted file mode 100644 index c217aa6..0000000 --- a/util/scripts/mac-binary/package/Welcome-commercial.rtf +++ /dev/null @@ -1,25 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;} -{\colortbl;\red255\green255\blue255;} -{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} -\margl1440\margr1440\vieww7840\viewh7700\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Welcome to the Qt installer! This will guide you through the steps to getting \ul Qt $VERSION_MAJOR$.$VERSION_MINOR$\ulnone Commercial Edition installed on your machine! \ -\ -After a successful install, you can find most new things in /Developer. Specifically things will be located in the following places:\ -\ -\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural -\ls1\ilvl0\cf0 {\listtext \'a5 }Qt Designer, Qt Linguist: /Developer/Applications/Qt\ -{\listtext \'a5 }Qt Documentation: /Developer/Documentation/Qt\ -{\listtext \'a5 }Qt Examples: /Developer/Examples/Qt\ -{\listtext \'a5 }Qt Plugins: /Developer/Applications/Plugins\ -{\listtext \'a5 }Qt Frameworks: /Library/Frameworks\ -{\listtext \'a5 }Qt Libraries: /usr/lib\ -{\listtext \'a5 }qmake, moc, uic, etc.: /Developer/Tools (symlink to /usr/bin)\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural -\cf0 \ -Please contact -\f1\b support@trolltech.com -\f0\b0 for any issues you have with this release of Qt/Mac.}
\ No newline at end of file diff --git a/util/scripts/mac-binary/package/Welcome-eval.rtf b/util/scripts/mac-binary/package/Welcome-eval.rtf deleted file mode 100644 index e720beb..0000000 --- a/util/scripts/mac-binary/package/Welcome-eval.rtf +++ /dev/null @@ -1,28 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;} -{\colortbl;\red255\green255\blue255;} -{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} -\margl1440\margr1440\vieww7820\viewh6620\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Welcome to the Qt installer! This will guide you through the steps to getting \ul Qt $VERSION_MAJOR$.$VERSION_MINOR$\ulnone Evaluation Edition installed on your machine! \ -\ -After a successful install, you can find most new things in /Developer. Specifically things will be located in the following places:\ -\ -\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural -\ls1\ilvl0\cf0 {\listtext \'a5 }Qt Designer, Qt Linguist: /Developer/Applications/Qt\ -{\listtext \'a5 }Qt Documentation: /Developer/Documentation/Qt\ -{\listtext \'a5 }Qt Examples: /Developer/Examples/Qt\ -{\listtext \'a5 }Qt Plugins: /Developer/Applications/Plugins\ -{\listtext \'a5 }Qt Frameworks: /Library/Frameworks\ -{\listtext \'a5 }Qt Libraries: /usr/lib\ -{\listtext \'a5 }qmake, moc, uic, etc.: /Developer/Tools (symlink to /usr/bin)\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural -\cf0 \ -Please use the bug report form located at\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f1\b \cf0 http://qtsoftware.com/bugreport-form -\f0\b0 \ -if you have any issues.}
\ No newline at end of file diff --git a/util/scripts/mac-binary/package/Welcome-opensource.rtf b/util/scripts/mac-binary/package/Welcome-opensource.rtf deleted file mode 100644 index 27b0617..0000000 --- a/util/scripts/mac-binary/package/Welcome-opensource.rtf +++ /dev/null @@ -1,28 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;} -{\colortbl;\red255\green255\blue255;} -{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} -\margl1440\margr1440\vieww7840\viewh7700\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f0\fs24 \cf0 Welcome to the Qt installer! This will guide you through the steps to getting \ul Qt $VERSION_MAJOR$.$VERSION_MINOR$\ulnone Opensource Edition installed on your machine! \ -\ -After a successful install, you can find most new things in /Developer. Specifically things will be located in the following places:\ -\ -\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural -\ls1\ilvl0\cf0 {\listtext \'a5 }Qt Designer, Qt Linguist: /Developer/Applications/Qt\ -{\listtext \'a5 }Qt Documentation: /Developer/Documentation/Qt\ -{\listtext \'a5 }Qt Examples: /Developer/Examples/Qt\ -{\listtext \'a5 }Qt Plugins: /Developer/Applications/Plugins\ -{\listtext \'a5 }Qt Frameworks: /Library/Frameworks\ -{\listtext \'a5 }Qt Libraries: /usr/lib\ -{\listtext \'a5 }qmake, moc, uic, etc.: /Developer/Tools (symlink to /usr/bin)\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural -\cf0 \ -Please use the bug report form located at\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural - -\f1\b \cf0 http://qtsoftware.com/bugreport-form -\f0\b0 \ -if you have any issues.}
\ No newline at end of file diff --git a/util/scripts/mac-binary/package/backgrounds/DiskImage-Commercial.png b/util/scripts/mac-binary/package/backgrounds/DiskImage-Commercial.png Binary files differdeleted file mode 100644 index 8174ff4..0000000 --- a/util/scripts/mac-binary/package/backgrounds/DiskImage-Commercial.png +++ /dev/null diff --git a/util/scripts/mac-binary/package/backgrounds/DiskImage-Eval.png b/util/scripts/mac-binary/package/backgrounds/DiskImage-Eval.png Binary files differdeleted file mode 100644 index 0abcd3d..0000000 --- a/util/scripts/mac-binary/package/backgrounds/DiskImage-Eval.png +++ /dev/null diff --git a/util/scripts/mac-binary/package/backgrounds/DiskImage-Opensource.png b/util/scripts/mac-binary/package/backgrounds/DiskImage-Opensource.png Binary files differdeleted file mode 100644 index 4a60a81..0000000 --- a/util/scripts/mac-binary/package/backgrounds/DiskImage-Opensource.png +++ /dev/null diff --git a/util/scripts/mac-binary/package/backgrounds/DriveIcon.icns b/util/scripts/mac-binary/package/backgrounds/DriveIcon.icns Binary files differdeleted file mode 100644 index 72fbe63..0000000 --- a/util/scripts/mac-binary/package/backgrounds/DriveIcon.icns +++ /dev/null diff --git a/util/scripts/mac-binary/package/make-model-ds_store.applescript b/util/scripts/mac-binary/package/make-model-ds_store.applescript deleted file mode 100644 index 757a3fd..0000000 --- a/util/scripts/mac-binary/package/make-model-ds_store.applescript +++ /dev/null @@ -1,41 +0,0 @@ -(* This script works by using FileStorm to create a disk image that you can then use as a model .DS_Store file in - the disk image. Here's what you need to do: - - Run this script, adjusting the path to the items and versions as necessary. If all items don't exist, - then it won't finish correctly. - - Afterwords, mount the final disk image and make sure that it looks OK, sometimes FileStorm - messes this up. - - If it's OK, copy /Volumes/Qt-x.y.z/.DS_Store to safe location (call it model-DS_Store.x.y.z) - - Edit this file and replace all occurences of backgroundXXXXXXXXXXXX (21 chars) with - findersbackground.png. - - Save the file and you should be ready to go. - - I believe this is as automated as I can get it. - - FileStorm 1.9.1 has some new issues: - * The file is invisible as well, you can use '/Developer/Tools/SetFile -a v' to make - it visible if you need to use a GUI app to edit it. -*) - -tell application "FileStorm" - activate - make new document at before first document with properties {name:"diskimage"} - - tell first document - set disk image name to "/Users/twschulz/Desktop/qt-mac-commercial-4.4.5.dmg" - set {volume name} to {"Qt 4.4.5"} - set icon path to "/Users/twschulz/troll/qt/4.4/util/scripts/mac-binary/package/backgrounds/DriveIcon.icns" - set background image path to "/Users/twschulz/troll/qt/4.4/util/scripts/mac-binary/package/backgrounds/DiskImage-Commercial.png" - set height to 660 - make new file at before first file with properties {file path:"/Users/twschulz/Desktop/foo/Qt.mpkg", left position:85, top position:117} - make new file at before first file with properties {file path:"//Users/twschulz/Desktop/foo/ReadMe.txt", left position:85, top position:297} - make new file at before first file with properties {file path:"/Users/twschulz/Desktop/foo/packages", left position:150, top position:640} - tell application "FileStorm" to set bounds of window "diskimage" to {100, 100, 640, 660} - finalize image with rebuilding - end tell - -end tell diff --git a/util/scripts/mac-binary/package/mkcommercialpackage b/util/scripts/mac-binary/package/mkcommercialpackage deleted file mode 100755 index ca8747f..0000000 --- a/util/scripts/mac-binary/package/mkcommercialpackage +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# This is a simple press-one-button-to-build-a-binary-package script. -# You specify your version number, and it will download the source package -# from the web and build a binary from it. -# -# Usage: mkcommersialpackage [version] -# Where version is for example 4.1.0 -# - -BASE_URL=http://releases.dev.troll.no/~espenr/packages/ -PACKAGE_NAME=qt-mac-commercial-src- -SUFFIX=.tar.gz - -PACKAGE_FILE_NAME=${PACKAGE_NAME}${1}${SUFFIX} -COMPLETE_URL=${BASE_URL}${PACKAGE_FILE_NAME} - -DOWNLOAD_COMMAND="curl -O "${COMPLETE_URL} -echo Running ${DOWNLOAD_COMMAND} -$DOWNLOAD_COMMAND - -MKPACKAGE_LOCATION=${PWD}/`dirname $0`/mkpackage -MKPACKAGE_COMMAND=${MKPACKAGE_LOCATION}" -qtpackage "${PWD}/${PACKAGE_FILE_NAME} -echo Running $MKPACKAGE_COMMAND -$MKPACKAGE_COMMAND
\ No newline at end of file diff --git a/util/scripts/mac-binary/package/mkpackage b/util/scripts/mac-binary/package/mkpackage deleted file mode 100755 index 21a2eaa..0000000 --- a/util/scripts/mac-binary/package/mkpackage +++ /dev/null @@ -1,842 +0,0 @@ -#!/bin/sh - -#options -export MACOSX_DEPLOYMENT_TARGET=10.3 -OUTPUT_DIR=`pwd`/outputs -cd `dirname $0` #now we live in the mkpackage location -USE_SEPARATE=no -TMP_DIR=/tmp/qt-stuff -PACKAGE_DIR=`(cd ../install && pwd)` -PACKAGE_OPTIONS= -PACKAGES= -COMMAND_PAX="/System/Library/PrivateFrameworks/Installation.framework/Resources/pax" #yes that pax, don't ask! -README= -LICENSE_EMBEDDED= -LICENSE_EMBEDDED_US= -LICENSE_ALLOS= -LICENSE_ALLOS_US= -LICENSE= # This is now the Desktop License (or Open Source) -LICENSE_US= # Also abused for GPL3 -LICENSETYPE= -MAKE_META= -MAKE_IMAGE= -DO_CLEANUP=yes - -#versioning -QT_SET_VERSION=no -QT_MAJOR_VERSION=4 -QT_MINOR_VERSION=0 -QT_PATCH_VERSION=0 -QT_VERSION_STRING=${QT_MAJOR_VERSION}.${QT_MINOR_VERSION}.${QT_PATCH_VERSION} - -# Build Date -QT_PACKAGEDATE_STRING=`date +%F` - -#QTDIR stuff -BINARY_DIR= -SOURCE_DIR= -SOURCE_PACKAGE= -EVAL_PATCHES= -CONFIGURE_ARGS="-qt-libpng -qt-libjpeg -plugin-sql-sqlite -plugin-sql-odbc -plugin-sql-psql -framework -confirm-license -no-rpath -I/usr/local/pgsql/include -L/usr/local/pgsql/lib -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk -optimized-qmake" - -doStringReplace() -{ - sed -e "s,\\\$VERSION_MAJOR\\\$,$QT_MAJOR_VERSION,g" -e "s,\\\$VERSION_MINOR\\\$,$QT_MINOR_VERSION,g" \ - -e "s,\\\$VERSION_PATCH\\\$,$QT_PATCH_VERSION,g" "$1" >tmp.out - - mv -f tmp.out "$2" -} - -createLicenseRTF() -{ - rm -f "$2" - cat >>"$2" <<EOF -{\rtf1\mac\ansicpg10000\cocoartf102 -{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Oblique;\f2\fswiss\fcharset77 Helvetica-Bold; -} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww9000\viewh9000\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural -EOF - sed -e 's,\(^[A-Z][A-Z :-]*$\),\\f2\\b \1 \\f0\\b0,g' \ - -e 's,^\(Qt COMMERCIAL\) \(LICENSE AGREEMENT\)$,\\f0\\fs24 \\cf0 \\ul \\ulc0 \1 \\ulnone \2 \\f0\\i0,g' \ - -e 's,^\([0-9]*\)\. ,\\f2\\b \1 \\f0\\b0. ,g' \ - -e 's,\(^Agreement version [0-9].[0-9]$\),\\f1\\i \1 \\f0\\i0,g' \ - -e 's,^\(.*\)$,\1\\,g' \ - "$1" >>"$2" - echo "}" >>"$2" - -} - -while [ -n "$1" ]; do - CACHE_1="$1" - OPTION= - ARG= - case $1 in - -*=*) #gnu style - OPTION=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\1,'` - ARG=`echo $1 | sed 's,-\([^=]*\)=\(.*\),\2,'` - ;; - -output|-packages|-qtbins|-qtsrcs|-qtdir|-qtpackage|-version|-license|-licensetype|-license_us|-license_allos_us|-license_allos|license_embedded_us|license_embedded|-readme|-evalpatches) #second arg style - OPTION=`echo $1 | sed 's,-\([^=]*\),\1,'` - shift - ARG=$1 - ;; - -no-*) #no style - OPTION=`echo $1 | sed 's,-no-\([^=]*\),\1,'` - ARG=no - ;; - -*) #yes style - OPTION=`echo $1 | sed 's,-\([^=]*\),\1,'` - ARG=yes - ;; - *) #other - OPTION=package - ARG="$1" - ;; - esac - shift - case "$OPTION" in - help) - if [ "$ARG" = "yes" ]; then - echo "$0 <options> <packages>" - echo - echo " -output <directory> Where to write the generated files to" - echo " -packages <directory> Where to find packages to create" - echo " -qtbins <directory> Where your Qt binaries live" - echo " -qtsrcs <directory> Where to find our Qt sources (if -qtbins not set defaults to same)" - echo " -qtpackage <package> Given a package it will be untar'd configured and built and used." - echo " -version <version> What version the package is creating for (falls back to qglobal.h)" - echo " -license <license> Where your desktop license (or opensource) file lives" - echo " -license_us <license> Where your U.S. desktop (or GPLv3) license file lives" - echo " -license_allos <license> Where your All-OS license file lives" - echo " -license_allos_us <license> Where your U.S. All-OS license file lives" - echo " -license_embedded <license> Where your Embedded license file lives" - echo " -license_embedded_us <license> Where your U.S. Embedded license file lives" - echo " -licensetype <commercial|eval|opensource|preview-commercial|preview-opensource> The license for the package you are building" - echo " -readme <readme> Where your readme file lives" - echo " -image Create a disk image of the outputs" - echo " -meta Create a meta package for all the outputs" - echo " -evalpatches <evalpatches> Eval patches can be found here" - echo " -no-cleanup Don't remove files (can be used to restart a previous run)" - exit 0 - fi - ;; - readme) README="$ARG" ;; - license) LICENSE="$ARG" ;; - licensetype) LICENSETYPE="$ARG" ;; - all) USE_SEPARATE="$ARG" ;; - qtpackage) SOURCE_PACKAGE="$ARG" ;; - qtsrcs) SOURCE_DIR="$ARG" ;; - qtbins|qtdir) BINARY_DIR="$ARG" ;; - output) OUTPUT_DIR="$ARG" ;; - packages) PACKAGE_DIR="$ARG" ;; - meta) MAKE_META="$ARG" ;; - package) PACKAGES="$PACKAGES $ARG" ;; - image) MAKE_IMAGE="$ARG" ;; - evalpatches) EVAL_PATCHES="$ARG" ;; - cleanup) DO_CLEANUP="$ARG" ;; - version) - VERSION="$ARG" - MAJOR=`echo $VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'` - if [ -n "$MAJOR" ]; then - MINOR=`echo $VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'` - [ -z "$MINOR" ] && MINOR=0 - PATCH=`echo $VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'` - [ -z "$PATCH" ] && PATCH=0 - QT_SET_VERSION=yes - QT_VERSION_STRING="$VERSION" - QT_MAJOR_VERSION="$MAJOR" - QT_MINOR_VERSION="$MINOR" - QT_PATCH_VERSION="$PATCH" - else - echo "Invalid version: $VERSION" - fi - ;; - help|*) - [ "$OPTION" = "help" ] || echo "Unknown option $CACHE_1!" - echo "Help!!" - exit 888; - ;; - esac -done - -# No license type specified, so try to get it from the package. If we don't have a package, -# default to commercial -if [ -z "$LICENSETYPE" ]; then - if [ ! -z "$SOURCE_PACKAGE" ]; then - LICENSETYPE=`basename "$SOURCE_PACKAGE" | cut -d - -f 3` - else - LICENSETYPE="commercial" - fi -fi - -# If it's a preview license strip the preview out because there are some things -# that are exactly the same to what we do in the non-preview case, since the -# "preview" variant can be a "child" of the main license, we'll call it the -# parent license. -PARENTLICENSE=$LICENSETYPE -if [ "$LICENSETYPE" = "preview-commercial" ]; then - PARENTLICENSE="commercial" -elif [ "$LICENSETYPE" = "preview-opensource" ]; then - PARENTLICENSE="opensource" -fi - -#get the QTDIR setup -[ -z "$BINARY_DIR" ] && [ -z "$SOURCE_PACKAGE" ] && BINARY_DIR="$QTDIR" -if [ ! -z "$BINARY_DIR" ] && [ -z "$SOURCE_PACKAGE" ]; then - if [ -z "$SOURCE_DIR" ]; then - if [ -e "$BINARY_DIR/.qmake.cache" ]; then - SOURCE_DIR=`perl -n -e 'next unless /^QT_SOURCE_TREE *= *(.*)/; - s/\$\$quote\((.*)\)/\1/; - print "$1\n"; exit' "$BINARY_DIR/.qmake.cache"` - else - SOURCE_DIR="$BINARY_DIR" - fi - fi -elif [ ! -z "$SOURCE_PACKAGE" ]; then - if [ "$DO_CLEANUP" = "yes" ]; then - rm -rf "$TMP_DIR/source" - mkdir -p "$TMP_DIR/source" - fi - PACKAGE_NAME=`basename "$SOURCE_PACKAGE"` - CHECKLICENSETYPE=$PARENTLICENSE - if [ "$LICENSETYPE" = "eval" ]; then - CHECKLICENSETYPE="commercial" - fi - - if [ -z `echo $PACKAGE_NAME | grep $CHECKLICENSETYPE` ]; then - echo "I must have the $CHECKLICENSETYPE package, you gave me $SOURCE_PACKAGE" - rm -rf "$TMP_DIR" - exit 7 - fi - EXTENSION=`echo "$PACKAGE_NAME" | sed -e 's,.*\.tar\.\(.*\),\1,'` - PACKAGE_DEST=`echo "$PACKAGE_NAME" | sed -e 's,\(.*\)\.tar.*,\1,'` - if [ "$LICENSETYPE" = "eval" ]; then - CONFIGURE_ARGS="$CONFIGURE_ARGS -DQT_EVAL -release" - # If you didn't set the eval patches, I'll try in the same place as the package - if [ -z "$EVAL_PATCHES" ]; then - PACKAGE_VERSION=`echo $PACKAGE_DEST | sed -e 's,.*src-\(.*\),\1,'` - EVAL_PATCHES=`dirname "$SOURCE_PACKAGE"`/qt-mac-evalpatches-src-$PACKAGE_VERSION.tar.$EXTENSION - fi - # unzip the eval patches first since it _shouldn't_ matter. - (cd "$TMP_DIR/source" && gunzip -c "$EVAL_PATCHES" | tar xf -); - fi - - export QTDIR=$TMP_DIR/source/$PACKAGE_DEST - export DYLD_LIBRARY_PATH=$QTDIR/lib:$DYLD_LIBRARY_PATH - export DYLD_FRAMEWORK_PATH=$QTDIR/lib:$DYLD_FRAMEWORK_PATH - export PATH=$QTDIR/bin:$PATH - if [ "$DO_CLEANUP" = "yes" ]; then - if (cd "$TMP_DIR/source" && gunzip -c "$SOURCE_PACKAGE" | tar xf -); then - realUsageReporter="$QTDIR/bin/qtusagereporter" - tmpUsageReporter="$TMP_DIR/qtusagereporter" - if [ -e "$realUsageReporter" ]; then - cp "$realUsageReporter" "$tmpUsageReporter" - fi - if (cd "$QTDIR" && ./configure $CONFIGURE_ARGS); then - if [ -e "$tmpUsageReporter" ]; then - mv "$tmpUsageReporter" "$realUsageReporter" - fi - else - echo "Configure error" - exit 1 - fi - if !(cd "$QTDIR" && make); then - echo "Build error" - exit 2 - fi - fi - fi - SOURCE_DIR="$QTDIR" - BINARY_DIR="$SOURCE_DIR" -else - echo "Only a source package or a source/binary directory can be specified!" - exit 3 -fi - - -#License Stuff. - -if [ "$LICENSETYPE" = "eval" ]; then - if [ -z "$LICENSE" ]; then - DEPOT_LICENSE="$SOURCE_DIR/dist/eval/LICENSE-EVALUATION" - PACKAGE_LICENSE="$SOURCE_DIR/.LICENSE-EVALUATION" - if [ -e "$DEPOT_LICENSE" ]; then - LICENSE=$DEPOT_LICENSE - elif [ -e "$PACKAGE_LICENSE" ]; then - LICENSE="$PACKAGE_LICENSE" - fi - fi - - if [ -z "$LICENSE_US" ]; then - DEPOT_LICENSE_US="$SOURCE_DIR/dist/eval/LICENSE-EVALUATION-US" - PACKAGE_LICENSE_US="$SOURCE_DIR/.LICENSE-EVALUATION-US" - if [ -e "$DEPOT_LICENSE_US" ]; then - LICENSE_US=$DEPOT_LICENSE_US - elif [ -e "$PACKAGE_LICENSE_US" ]; then - LICENSE_US="$PACKAGE_LICENSE_US" - fi - fi -elif [ "$LICENSETYPE" = "opensource" ]; then - DEPOT_LICENSE="$SOURCE_DIR/dist/opensource/LICENSE.GPL2" - PACKAGE_LICENSE="$SOURCE_DIR/LICENSE.GPL2" - if [ -e "$DEPOT_LICENSE" ]; then - LICENSE=$DEPOT_LICENSE - elif [ -e "$PACKAGE_LICENSE" ]; then - LICENSE="$PACKAGE_LICENSE" - fi - - if [ -z "$LICENSE_US" ]; then - DEPOT_LICENSE_US="$SOURCE_DIR/dist/opensource/LICENSE.GPL3" - PACKAGE_LICENSE_US="$SOURCE_DIR/LICENSE.GPL3" - if [ -e "$DEPOT_LICENSE_US" ]; then - LICENSE_US=$DEPOT_LICENSE_US - elif [ -e "$PACKAGE_LICENSE_US" ]; then - LICENSE_US="$PACKAGE_LICENSE_US" - elif [ -e "../../../../dist/opensource/LICENSE.GPL3" ]; then - LICENSE_US="../../../../dist/opensource/LICENSE.GPL3" - fi - fi -elif [ "$LICENSETYPE" = "commercial" ]; then -#Find the All-OS and Embedded License for commercial - LICENSE="$SOURCE_DIR/.LICENSE" - if [ -e "$LICENSE" ]; then - # Generic license - LICENSE_US="${LICENSE}-US" - LICENSE_ALLOS= - LICENSE_ALLOS_US= - LICENSE_EMBEDDED= - LICENSE_EMBEDDED_US= - else - DEPOT_LICENSE="$SOURCE_DIR/dist/commercial/LICENSE-DESKTOP" - PACKAGE_LICENSE="$SOURCE_DIR/.LICENSE-DESKTOP" - if [ -e "$DEPOT_LICENSE" ]; then - LICENSE=$DEPOT_LICENSE - elif [ -e "$PACKAGE_LICENSE" ]; then - LICENSE="$PACKAGE_LICENSE" - fi - - if [ -z "$LICENSE_US" ]; then - DEPOT_LICENSE_US="$SOURCE_DIR/dist/commercial/LICENSE-DESKTOP-US" - PACKAGE_LICENSE_US="$SOURCE_DIR/.LICENSE-DESKTOP-US" - if [ -e "$DEPOT_LICENSE_US" ]; then - LICENSE_US=$DEPOT_LICENSE_US - elif [ -e "$PACKAGE_LICENSE_US" ]; then - LICENSE_US="$PACKAGE_LICENSE_US" - elif [ -e "../../../../dist/commercial/LICENSE-US" ]; then - LICENSE_US="../../../../dist/commercial/LICENSE-US" - fi - fi - if [ -z "$LICENSE_ALLOS" ]; then - DEPOT_LICENSE_ALLOS="$SOURCE_DIR/dist/commercial/LICENSE-ALLOS" - PACKAGE_LICENSE_ALLOS="$SOURCE_DIR/.LICENSE-ALLOS" - if [ -e "$DEPOT_LICENSE_ALLOS" ]; then - LICENSE_ALLOS=$DEPOT_LICENSE_ALLOS - elif [ -e "$PACKAGE_LICENSE_ALLOS" ]; then - LICENSE_ALLOS="$PACKAGE_LICENSE_ALLOS" - fi - fi - if [ -z "$LICENSE_ALLOS_US" ]; then - DEPOT_LICENSE_ALLOS_US="$SOURCE_DIR/dist/commercial/LICENSE-ALLOS-US" - PACKAGE_LICENSE_ALLOS_US="$SOURCE_DIR/.LICENSE-ALLOS-US" - if [ -e "$DEPOT_LICENSE_ALLOS_US" ]; then - LICENSE_ALLOS_US=$DEPOT_LICENSE_ALLOS_US - elif [ -e "$PACKAGE_LICENSE_ALLOS_US" ]; then - LICENSE_ALLOS_US="$PACKAGE_LICENSE_ALLOS_US" - fi - fi - if [ -z "$LICENSE_EMBEDDED" ]; then - DEPOT_LICENSE_EMBEDDED="$SOURCE_DIR/dist/commercial/LICENSE-EMBEDDED" - PACKAGE_LICENSE_EMBEDDED="$SOURCE_DIR/.LICENSE-EMBEDDED" - if [ -e "$DEPOT_LICENSE_EMBEDDED" ]; then - LICENSE_EMBEDDED=$DEPOT_LICENSE_EMBEDDED - elif [ -e "$PACKAGE_LICENSE_EMBEDDED" ]; then - LICENSE_EMBEDDED="$PACKAGE_LICENSE_EMBEDDED" - fi - fi - if [ -z "$LICENSE_EMBEDDED_US" ]; then - DEPOT_LICENSE_EMBEDDED_US="$SOURCE_DIR/dist/commercial/LICENSE-EMBEDDED-US" - PACKAGE_LICENSE_EMBEDDED_US="$SOURCE_DIR/.LICENSE-EMBEDDED-US" - if [ -e "$DEPOT_LICENSE_EMBEDDED_US" ]; then - LICENSE_EMBEDDED_US=$DEPOT_LICENSE_EMBEDDED_US - elif [ -e "$PACKAGE_LICENSE_EMBEDDED_US" ]; then - LICENSE_EMBEDDED_US="$PACKAGE_LICENSE_EMBEDDED_US" - fi - fi - fi -fi - -#find the README -if [ -z "$README" ]; then - DEPOT_README="$SOURCE_DIR/dist/README" - PACKAGE_README="$SOURCE_DIR/README" - if [ -e "$DEPOT_README" ]; then - README="$DEPOT_README" - elif [ -e "$PACKAGE_README" ]; then - README="$PACKAGE_README" - elif [ -e "../../../../dist/README" ]; then - README="../../../../dist/README" - fi -fi - -#find the version from the source package -if [ "$QT_SET_VERSION" = "no" ] && [ ! -z "$SOURCE_DIR" ]; then - VERSION=`grep '^# *define *QT_VERSION_STR' $SOURCE_DIR/src/corelib/global/qglobal.h` - if [ -n "$VERSION" ]; then - VERSION=`echo $VERSION | sed 's,^# *define *QT_VERSION_STR "*\([^ ]*\)"$,\1,'` - MAJOR=`echo $VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'` - if [ -n "$MAJOR" ]; then - MINOR=`echo $VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'` - [ -z "$MINOR" ] && MINOR=0 - PATCH=`echo $VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'` - [ -z "$PATCH" ] && PATCH=0 - QT_VERSION_STRING="$VERSION" - QT_MAJOR_VERSION="$MAJOR" - QT_MINOR_VERSION="$MINOR" - QT_PATCH_VERSION="$PATCH" - else - echo "Cannot process version from qglobal.h: $VERSION" - fi - fi -fi - -if [ "$LICENSETYPE" != "opensource" ]; then - if [ ! -z "$SOURCE_DIR" ]; then - PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' $SOURCE_DIR/src/corelib/global/qglobal.h` - if [ -n "$PACKAGEDATE" ]; then - PACKAGEDATE=`echo $PACKAGEDATE | sed 's,^# *define *QT_PACKAGEDATE_STR "*\([^ ]*\)"$,\1,'` - QT_PACKAGEDATE_STRING=$PACKAGEDATE - else - echo "Cannot process date information from qglobal.h: $PACKAGEDATE" - fi - fi -fi - -# Put the date in a little file so we can access in later -PACKAGEDATE_FILE="Resources/.package_date" -if [ -e "$PACKAGEDATE_FILE" ]; then - rm -rf "$PACKAGEDATE_FILE" -fi - -echo $QT_PACKAGEDATE_STRING > $PACKAGEDATE_FILE - -#just do all the packages -if [ -z "$PACKAGES" ]; then - [ -z "$MAKE_META" ] && MAKE_META=yes - [ -z "$MAKE_IMAGE" ] && MAKE_IMAGE=yes - for a in $PACKAGE_DIR/*; do - if [ -d "$a" ]; then - package=`basename $a` - [ "$USE_SEPARATE" = "no" ] && [ -e "$a/.build_separate" ] && continue - PACKAGES="$PACKAGES $package" - fi - done -fi - -#setup some default package options -[ -z "$SOURCE_PACKAGE" ] || PACKAGE_OPTIONS="$PACKAGE_OPTIONS --qtpackage=${SOURCE_PACKAGE}" -[ -z "$SOURCE_DIR" ] || PACKAGE_OPTIONS="$PACKAGE_OPTIONS --qtsrc=${SOURCE_DIR}" -[ -z "$BINARY_DIR" ] || PACKAGE_OPTIONS="$PACKAGE_OPTIONS --qtbin=${BINARY_DIR}" -PACKAGE_OPTIONS="$PACKAGE_OPTIONS --debug=yes" - -mkdir -p "$TMP_DIR" -find .. -name '*~' -exec rm {} \; #just get rid of these before they end up in my package - -#create the license information -if [ -e "$LICENSE" ]; then - mkdir -p "$TMP_DIR/licenses" - - echo "Creating desktop license richtext for rest of the world" - createLicenseRTF "$LICENSE" "$TMP_DIR/licenses/License.rtf" -else - echo "No license file found!" - exit 4 -fi - -if [ -e "$LICENSE_US" ]; then - echo "Creating desktop license richtext for U.S. (GPL3 for opensource)" - createLicenseRTF "$LICENSE_US" "$TMP_DIR/licenses/License-US.rtf" -else - echo "No U.S. (GPL3 for opensource) license file found!" - exit 5 -fi - -if [ "$LICENSETYPE" = "commercial" ] && [ -n "$LICENSE_ALLOS" ]; then - if [ -e "$LICENSE_ALLOS" ]; then - mkdir -p "$TMP_DIR/licenses" - - echo "Creating all OS license richtext for rest of the world" - createLicenseRTF "$LICENSE_ALLOS" "$TMP_DIR/licenses/License-AllOS.rtf" - else - echo "No all OS license file found!" - exit 6 - fi - - if [ -e "$LICENSE_ALLOS_US" ]; then - echo "Creating desktop license richtext for U.S. (GPL3 for opensource)" - createLicenseRTF "$LICENSE_ALLOS_US" "$TMP_DIR/licenses/License-AllOS-US.rtf" - else - echo "No U.S. all OS license file found!" - exit 7 - fi - - if [ -e "$LICENSE_EMBEDDED" ]; then - mkdir -p "$TMP_DIR/licenses" - - echo "Creating embedded license richtext for rest of the world" - createLicenseRTF "$LICENSE_EMBEDDED" "$TMP_DIR/licenses/License-Embedded.rtf" - else - echo "No embedded license file found!" - exit 8 - fi - - if [ -e "$LICENSE_EMBEDDED_US" ]; then - echo "Creating embedded license richtext for U.S. (GPL3 for opensource)" - createLicenseRTF "$LICENSE_EMBEDDED_US" "$TMP_DIR/licenses/License-Embedded-US.rtf" - else - echo "No U.S. embedded license file found!" - exit 9 - fi -fi - -# Build our license checking plugin! -if [ "$PARENTLICENSE" = "commercial" ] || [ "$PARENTLICENSE" = "eval" ]; then - # build the InstallerPane plugin - INSTALLERPANE_PATH=InstallerPane - INSTALLERPANE_CONFIGURATION="Release-$PARENTLICENSE" - INSTALLERPANE_BUILDPARAMS="-project ""$INSTALLERPANE_PATH/InstallerPane.xcodeproj"" -configuration ""$INSTALLERPANE_CONFIGURATION" - - echo "/usr/bin/xcodebuild $INSTALLERPANE_BUILDPARAMS" - if !(/usr/bin/xcodebuild $INSTALLERPANE_BUILDPARAMS || grep '** BUILD SUCCEEDED **'); then - echo "Could not build installer pane plugin" - exit 100; - fi - - # Create the key decoder for the script version - BUILD_LINE="keydecoder/main.cpp $INSTALLERPANE_PATH/keydec.cpp -o Resources/keydecoder -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" - /usr/bin/g++-4.0 $BUILD_LINE -fi - -#create the packages -PKG_CREATED= -for package in $PACKAGES; do - if [ "$LICENSETYPE" = "eval" ] && [ "$package" = "debuglibraries" ]; then - continue - fi - - [ "$package" = "none" ] && continue - if [ ! -e "$PACKAGE_DIR/$package/Info.plist" ]; then - echo "$package is not a valid package!!" - continue - fi - rm -rf "$TMP_DIR/package" #cleanup - - #create files - echo "Creating package [$package]..." - mkdir -p "$TMP_DIR/package" - if [ -x "$PACKAGE_DIR/$package/create_package.sh" ]; then - if (cd $PACKAGE_DIR/$package/ && VERSION_MAJOR="$QT_MAJOR_VERSION" VERSION_MINOR="$QT_MINOR_VERSION" VERSION_STRING="$QT_VERSION_STRING" VERSION_PATCH="$QT_PATCH_VERSION" "$PACKAGE_DIR/$package/create_package.sh" $PACKAGE_OPTIONS --outdir="$TMP_DIR/package"); then - true - # Copy the uninstall script in for all of the packages - mkdir -p "$TMP_DIR/package/Developer/Tools" - cp "uninstall-qt.py" "$TMP_DIR/package/Developer/Tools" - else - echo " Package failed" - continue - fi - fi - - #create .pkg - package_dir="$OUTPUT_DIR/packages/Qt_${package}.pkg" - rm -rf "$package_dir" - mkdir -p "$package_dir" - echo " Creating installation.. ($package_dir)" - doStringReplace "$PACKAGE_DIR/$package/Info.plist" "$TMP_DIR/Info.plist" - if !(/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker --root "$TMP_DIR/package" --out "$package_dir" --info "$TMP_DIR/Info.plist" --filter '\.DS_Store' -v); then - echo " Error creating package ($package_dir)" - continue - fi - - sed '/IFPkgPathMappings/,${/[[:space:]]/d;}' $package_dir/Contents/Info.plist > cleaned - mv cleaned $package_dir/Contents/Info.plist - - rm -rf "$TMP_DIR/Info.plist" - rm -rf $package_dir/Contents/Resources/*.lproj - #merge resources - cp -R Resources/* "$package_dir/Contents/Resources" - cp -R "$PACKAGEDATE_FILE" "$package_dir/Contents/Resources" - cp -R $PACKAGE_DIR/$package/Resources/* "$package_dir/Contents/Resources" - cp "Welcome-$PARENTLICENSE.rtf" "$package_dir/Contents/Resources/Welcome.rtf" - cp "$README" "$package_dir/Contents/Resources/ReadMe.txt" - if [ -n "$LICENSE_ALLOS" ] && [ "$PARENTLICENSE" = "commercial" ] || [ "$PARENTLICENSE" = "eval" ]; then - # Release licenses - for lang in "Desktop North and South America" "Desktop rest of the world" "All OS North and South America" "All OS rest of the World" "Embedded North and South America" "Embedded rest of the world"; do - LOCALDIR="$package_dir/Contents/Resources/${lang}.lproj" - if [ "$lang" = "Desktop North and South America" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-US.rtf" - elif [ "$lang" = "All OS North and South America" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-AllOS.rtf" - elif [ "$lang" = "Embedded North and South America" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-Embedded.rtf" - elif [ "$lang" = "All OS rest of the world" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-AllOS.rtf" - elif [ "$lang" = "Embedded rest of the world" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-Embedded.rtf" - else - LOCALLICENSE="$TMP_DIR/licenses/License.rtf" - fi - - if [ -e "$LOCALLICENSE" ]; then - mkdir -p "$LOCALDIR" - cp "$LOCALLICENSE" "$LOCALDIR/License.rtf" - fi - done - elif [ "$PARENTLICENSE" = "commercial" ]; then - # Non-release license - for lang in "North and South America" "Rest of the world"; do - LOCALDIR="$package_dir/Contents/Resources/${lang}.lproj" - mkdir -p "$LOCALDIR" - if [ "$lang" = "North and South America" ]; then - cp "$TMP_DIR/licenses/License-US.rtf" "$LOCALDIR/License.rtf" - else - cp "$TMP_DIR/licenses/License.rtf" "$LOCALDIR" - fi - done - elif [ "$PARENTLICENSE" = "opensource" ]; then - for lang in "GNU Lesser General Public License Version 2.1" "GNU General Public License Version 3"; do - LOCALDIR="$package_dir/Contents/Resources/${lang}.lproj" - mkdir -p "$LOCALDIR" - if [ "$lang" = "GNU General Public License Version 3" ]; then - cp "$TMP_DIR/licenses/License-US.rtf" "$LOCALDIR/License.rtf" - else - cp "$TMP_DIR/licenses/License.rtf" "$LOCALDIR" - fi - done - rm -f "$package_dir/Contents/Resources/InstallationCheck" - rm -f "$package_dir/Contents/Resources/InstallationCheck.strings" - cp opensourceStuff/InstallationCheck "$package_dir/Contents/Resources" - cp opensourceStuff/InstallationCheck.strings "$package_dir/Contents/Resources" - if [ "$package" = "libraries" ] || [ "$package" = "tools" ] || [ "$package" = "headers" ] || [ "$package" = "debuglibraries" ]; then - rm -f "$package_dir/Contents/Resources/postflight" - fi - - fi - for a in $package_dir/Contents/Resources/*.plist $package_dir/Contents/Resources/*.info $package_dir/Contents/Resources/*flight $package_dir/Contents/Resources/*.rtf; do - [ -e "$a" ] && doStringReplace "$a" "$a" - done - if [ -e "$package_dir/Contents/Resources/$package.info" ]; then - cp "$package_dir/Contents/Resources/$package.info" "$package_dir/Contents/Resources/Qt_${package}.info" - fi - for a in $package_dir/Contents/Resources/*flight; do - [ -e "$a" ] && chmod a+x $a #exe - done - for a in $package_dir/Contents/Resources/*Check; do - if [ -e "$a" ]; then - chmod a+x "$a" - if false && [ -e "${a}.strings" ]; then - for lang in English Norwegian French German Spanish; do - LOCALDIR="$package_dir/Contents/Resources/${lang}.lproj" - mkdir -p "$LOCALDIR" - cp "${a}.strings" "$LOCALDIR" - done - #rm -f "${a}.strings" - fi - fi - done - if [ "$PARENTLICENSE" = "commercial" ] || [ "$PARENTLICENSE" = "eval" ]; then - # Copy over the plugin - plugin_dir="$package_dir/Contents/Plugins" - mkdir "$plugin_dir" - cp -r "$INSTALLERPANE_PATH/build/$INSTALLERPANE_CONFIGURATION/InstallerPane.bundle" "$plugin_dir" - cp "$INSTALLERPANE_PATH/InstallerSections.plist" "$plugin_dir" - - fi - - if [ "$package" != "debuglibraries" ]; then - PKG_CREATED="$PKG_CREATED $package_dir" - fi -done -if [ -z "$PKG_CREATED" ] && [ "$PACKAGES" = " none" ]; then - if [ "$MAKE_META" = "yes" ] || [ "$MAKE_IMAGE" = "yes" ]; then - PKG_CREATED=$OUTPUT_DIR/packages/*.pkg - [ -z "$MAKE_META" ] && MAKE_META=yes - fi -fi - -#create meta package -if [ "$MAKE_META" = "yes" ]; then - echo "Creating meta package.." - rm -rf "$OUTPUT_DIR/Qt.mpkg/" - mkdir -p "$OUTPUT_DIR/Qt.mpkg/" - cp -R "MetaPackage" "$OUTPUT_DIR/Qt.mpkg/Contents" - - if [ "$PARENTLICENSE" = "commercial" ] || [ "$PARENTLICENSE" = "eval" ]; then - # Copy over the plugin - plugin_dir="$OUTPUT_DIR/Qt.mpkg/Contents/Plugins" - mkdir -p "$plugin_dir" - cp -r "$INSTALLERPANE_PATH/build/$INSTALLERPANE_CONFIGURATION/InstallerPane.bundle" "$plugin_dir" - cp "$INSTALLERPANE_PATH/InstallerSections.plist" "$plugin_dir" - fi - - mkdir -p "$OUTPUT_DIR/Qt.mpkg/Contents/Resources" - cp -R Resources/* "$OUTPUT_DIR/Qt.mpkg/Contents/Resources" - cp -R "$PACKAGEDATE_FILE" "$OUTPUT_DIR/Qt.mpkg/Contents/Resources" - cp "Welcome-${PARENTLICENSE}.rtf" "$OUTPUT_DIR/Qt.mpkg/Contents/Resources/Welcome.rtf" - cp "$README" "$OUTPUT_DIR/Qt.mpkg/Contents/Resources/ReadMe.txt" - if [ -n "$LICENSE_ALLOS" ] && [ "$PARENTLICENSE" = "commercial" ] || [ "$PARENTLICENSE" = "eval" ]; then - # Release licenses - for lang in "Desktop North and South America" "Desktop rest of the world" "All OS North and South America" "All OS rest of the World" "Embedded North and South America" "Embedded rest of the world"; do - LOCALDIR="$OUTPUT_DIR/Qt.mpkg/Contents/Resources/${lang}.lproj" - if [ "$lang" = "Desktop North and South America" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-US.rtf" - elif [ "$lang" = "All OS North and South America" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-AllOS.rtf" - elif [ "$lang" = "Embedded North and South America" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-Embedded.rtf" - elif [ "$lang" = "All OS rest of the world" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-AllOS.rtf" - elif [ "$lang" = "Embedded rest of the world" ]; then - LOCALLICENSE="$TMP_DIR/licenses/License-Embedded.rtf" - else - LOCALLICENSE="$TMP_DIR/licenses/License.rtf" - fi - - if [ -e "$LOCALLICENSE" ]; then - mkdir -p "$LOCALDIR" - cp "$LOCALLICENSE" "$LOCALDIR/License.rtf" - fi - done - elif [ "$PARENTLICENSE" = "commercial" ]; then - # Non-release license - for lang in "North and South America" "Rest of the world"; do - LOCALDIR="$OUTPUT_DIR/Qt.mpkg/Contents/Resources/${lang}.lproj" - mkdir -p "$LOCALDIR" - if [ "$lang" = "North and South America" ]; then - cp "$TMP_DIR/licenses/License-US.rtf" "$LOCALDIR/License.rtf" - else - cp "$TMP_DIR/licenses/License.rtf" "$LOCALDIR" - fi - done - elif [ "$PARENTLICENSE" = "opensource" ]; then - for lang in "GNU General Public License Version 2" "GNU General Public License Version 3"; do - LOCALDIR="$OUTPUT_DIR/Qt.mpkg/Contents/Resources/${lang}.lproj" - mkdir -p "$LOCALDIR" - if [ "$lang" = "GNU General Public License Version 3" ]; then - cp "$TMP_DIR/licenses/License-US.rtf" "$LOCALDIR/License.rtf" - else - cp "$TMP_DIR/licenses/License.rtf" "$LOCALDIR" - fi - done - rm -f "$OUTPUT_DIR/Qt.mpkg/Contents/Resources/InstallationCheck" - rm -f "$OUTPUT_DIR/Qt.mpkg/Contents/Resources/InstallationCheck.strings" - cp opensourceStuff/InstallationCheck "$OUTPUT_DIR/Qt.mpkg/Contents/Resources" - cp opensourceStuff/InstallationCheck.strings "$OUTPUT_DIR/Qt.mpkg/Contents/Resources" - fi - for a in $OUTPUT_DIR/Qt.mpkg/Contents/*.plist $OUTPUT_DIR/Qt.mpkg/Contents/Resources/*.info $OUTPUT_DIR/Qt.mpkg/Contents/Resources/*.plist $OUTPUT_DIR/Qt.mpkg/Contents/Resources/*.rtf; do - doStringReplace "$a" "$a" - done - for a in $OUTPUT_DIR/Qt.mpkg/Contents/Resources/*Check; do - if [ -e "$a" ]; then - chmod a+x "$a" - if false && [ -e "${a}.strings" ]; then - for lang in English Norwegian French German Spanish; do - LOCALDIR="$OUTPUT_DIR/Qt.mpkg/Contents/Resources/${lang}.lproj" - mkdir -p "$LOCALDIR" - cp "${a}.strings" "$LOCALDIR" - done - #rm -f "${a}.strings" - fi - fi - done - - PACKAGE_DICT="$TMP_DIR/pkg.dict" - >"$PACKAGE_DICT" - for package in $PKG_CREATED; do - package_name=`basename $package` - package_type=selected - if [ "$package_name" = "Qt_libraries.pkg" ] || [ "$package_name" = "Qt_tools.pkg" ]; then - package_type=required - fi - cat >"${PACKAGE_DICT}.tmp" <<EOF - <dict> - <key>IFPkgFlagPackageLocation</key> - <string>${package_name}</string> - <key>IFPkgFlagPackageSelection</key> - <string>${package_type}</string> - </dict> -EOF - if [ "$package_type" = "required" ]; then - cat "${PACKAGE_DICT}.tmp" "$PACKAGE_DICT" >"$TMP_DIR/dict.combined" - mv "$TMP_DIR/dict.combined" "$PACKAGE_DICT" - else - cat "${PACKAGE_DICT}.tmp" >>"$PACKAGE_DICT" - fi - rm -f "${PACKAGE_DICT}.tmp" - done - sed "/PACKAGE_DICT/r $PACKAGE_DICT" "$OUTPUT_DIR/Qt.mpkg/Contents/Info.plist" >"${TMP_DIR}/Info.plist" - chflags nouchg "$OUTPUT_DIR/Qt.mpkg/Contents/Info.plist" - rm -f "$OUTPUT_DIR/Qt.mpkg/Contents/Info.plist" - cp "${TMP_DIR}/Info.plist" "$OUTPUT_DIR/Qt.mpkg/Contents/Info.plist" - rm -f "${TMP_DIR}/Info.plist" - - PKG_CREATED="$PKG_CREATED $OUTPUT_DIR/Qt.mpkg" -fi - -#create disk image -if [ "$MAKE_IMAGE" = "yes" ] && [ ! -z "$PKG_CREATED" ]; then - echo "Creating disk image..." - IMAGE_NAME="Qt ${QT_VERSION_STRING}" - IMAGE="$OUTPUT_DIR/qt-mac-${PARENTLICENSE}-${QT_VERSION_STRING}.dmg" - TMPIMAGE="$OUTPUT_DIR/qt-mac-${PARENTLICENSE}-${QT_VERSION_STRING}-RW.dmg" - rm -f "$IMAGE" #remove old - - #copy - echo " Copying..." - DISKIMAGE="$TMP_DIR/diskimage" - mkdir -p "$DISKIMAGE/.background" - cp "backgrounds/DiskImage-${PARENTLICENSE}.png" "$DISKIMAGE/.background/findersbackground.png" - cp model-DS_Store-${QT_VERSION_STRING} "$DISKIMAGE/.DS_Store" - chmod 755 "$DISKIMAGE/.DS_Store" - cp "backgrounds/DriveIcon.icns" "$DISKIMAGE/.VolumeIcon.icns" - - for package in $PKG_CREATED; do - [ -z "$package" ] && continue - OUT_PACKAGE=`echo $package | sed "s,^$OUTPUT_DIR,$DISKIMAGE/,"` - mkdir -p "`dirname "$OUT_PACKAGE"`" - cp -R "$package" "$OUT_PACKAGE" - done - [ -e "$README" ] && cp "$README" "$DISKIMAGE/ReadMe.txt" - - echo -n " Creating Image..." - hdiutil create -format UDRW -volname "$IMAGE_NAME" -srcfolder "$DISKIMAGE" "$TMPIMAGE" | grep -v ^created: - mountpoint=`hdiutil attach "$TMPIMAGE" | grep '/Volumes' | cut -f 3` - /Developer/Tools/SetFile -a C "$mountpoint" - hdiutil detach "$mountpoint" - hdiutil convert "$TMPIMAGE" -format UDZO -o "$IMAGE" -imagekey zlib-level=9 | grep -v ^created: - rm "$TMPIMAGE" - echo " done!" -fi - -# Create the disk image for the debug libraries too -if [ "$MAKE_IMAGE" = "yes" ] && [ "$PARENTLICENSE" != "eval" ]; then - echo "Creating the debug libraries disk image..." - IMAGE_NAME="Qt ${QT_VERSION_STRING} Debug Libraries" - IMAGE="$OUTPUT_DIR/qt-mac-${PARENTLICENSE}-${QT_VERSION_STRING}-debug-libs.dmg" - DISKIMAGE="$TMP_DIR/diskimage" - - #remove the old stuff - rm -f "$IMAGE" - rm -rf "$DISKIMAGE" - mkdir -p "$DISKIMAGE" - cp -R "$OUTPUT_DIR/packages/Qt_debuglibraries.pkg" "$DISKIMAGE" - hdiutil create -srcfolder "$DISKIMAGE" -o "$IMAGE" -volname "$IMAGE_NAME" -imagekey zlib-level=9 - echo " done!" -fi - - -#cleanup -if [ "$DO_CLEANUP" = "yes" ]; then - rm -rf "$TMP_DIR" -fi -echo "Done!" diff --git a/util/scripts/mac-binary/package/model-DS_Store b/util/scripts/mac-binary/package/model-DS_Store Binary files differdeleted file mode 100644 index c9ffdf2..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.0.0 b/util/scripts/mac-binary/package/model-DS_Store-4.0.0 Binary files differdeleted file mode 100755 index 2b78907..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.0.0 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.0.1 b/util/scripts/mac-binary/package/model-DS_Store-4.0.1 Binary files differdeleted file mode 100644 index 8d6cf56..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.0.1 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.1.0 b/util/scripts/mac-binary/package/model-DS_Store-4.1.0 Binary files differdeleted file mode 100644 index 1ca8894..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.1.0 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.1.1 b/util/scripts/mac-binary/package/model-DS_Store-4.1.1 Binary files differdeleted file mode 100644 index e470afb..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.1.1 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.1.2 b/util/scripts/mac-binary/package/model-DS_Store-4.1.2 Binary files differdeleted file mode 100644 index b40119e..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.1.2 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.1.3 b/util/scripts/mac-binary/package/model-DS_Store-4.1.3 Binary files differdeleted file mode 100644 index baa4439..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.1.3 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.1.4 b/util/scripts/mac-binary/package/model-DS_Store-4.1.4 Binary files differdeleted file mode 100644 index 63b76b0..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.1.4 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.1.5 b/util/scripts/mac-binary/package/model-DS_Store-4.1.5 Binary files differdeleted file mode 100644 index bc5d42f..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.1.5 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.1.6 b/util/scripts/mac-binary/package/model-DS_Store-4.1.6 Binary files differdeleted file mode 100644 index 7102dfa..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.1.6 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.2.0 b/util/scripts/mac-binary/package/model-DS_Store-4.2.0 Binary files differdeleted file mode 100644 index 8cd1ef7..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.2.0 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.2.0-rc1 b/util/scripts/mac-binary/package/model-DS_Store-4.2.0-rc1 Binary files differdeleted file mode 100644 index eb7b463..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.2.0-rc1 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.2.1 b/util/scripts/mac-binary/package/model-DS_Store-4.2.1 Binary files differdeleted file mode 100644 index 32ce427..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.2.1 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.2.2 b/util/scripts/mac-binary/package/model-DS_Store-4.2.2 Binary files differdeleted file mode 100644 index 711c8a1..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.2.2 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.2.3 b/util/scripts/mac-binary/package/model-DS_Store-4.2.3 Binary files differdeleted file mode 100644 index d7f36f6..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.2.3 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.2.4 b/util/scripts/mac-binary/package/model-DS_Store-4.2.4 Binary files differdeleted file mode 100644 index 29bc0da..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.2.4 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.2.5 b/util/scripts/mac-binary/package/model-DS_Store-4.2.5 Binary files differdeleted file mode 100644 index 3e261a1..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.2.5 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.3.0 b/util/scripts/mac-binary/package/model-DS_Store-4.3.0 Binary files differdeleted file mode 100644 index 9bb3bf2..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.3.0 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.3.1 b/util/scripts/mac-binary/package/model-DS_Store-4.3.1 Binary files differdeleted file mode 100644 index 1a9e331..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.3.1 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.3.2 b/util/scripts/mac-binary/package/model-DS_Store-4.3.2 Binary files differdeleted file mode 100644 index 17e267c..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.3.2 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.3.3 b/util/scripts/mac-binary/package/model-DS_Store-4.3.3 Binary files differdeleted file mode 100644 index ded1369..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.3.3 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.3.4 b/util/scripts/mac-binary/package/model-DS_Store-4.3.4 Binary files differdeleted file mode 100644 index 15e0d99..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.3.4 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.3.5 b/util/scripts/mac-binary/package/model-DS_Store-4.3.5 Binary files differdeleted file mode 100644 index 6ac254a..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.3.5 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.4.0 b/util/scripts/mac-binary/package/model-DS_Store-4.4.0 Binary files differdeleted file mode 100644 index fee7663..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.4.0 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.4.0-rc1 b/util/scripts/mac-binary/package/model-DS_Store-4.4.0-rc1 Binary files differdeleted file mode 100644 index 367faae..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.4.0-rc1 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.4.1 b/util/scripts/mac-binary/package/model-DS_Store-4.4.1 Binary files differdeleted file mode 100644 index b891927..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.4.1 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.4.2 b/util/scripts/mac-binary/package/model-DS_Store-4.4.2 Binary files differdeleted file mode 100644 index c781394..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.4.2 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.4.3 b/util/scripts/mac-binary/package/model-DS_Store-4.4.3 Binary files differdeleted file mode 100644 index c326d4a..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.4.3 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.4.4 b/util/scripts/mac-binary/package/model-DS_Store-4.4.4 Binary files differdeleted file mode 100644 index 5145329..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.4.4 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.4.5 b/util/scripts/mac-binary/package/model-DS_Store-4.4.5 Binary files differdeleted file mode 100644 index 22eeb4e..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.4.5 +++ /dev/null diff --git a/util/scripts/mac-binary/package/model-DS_Store-4.5.0 b/util/scripts/mac-binary/package/model-DS_Store-4.5.0 Binary files differdeleted file mode 100644 index 4ac1714..0000000 --- a/util/scripts/mac-binary/package/model-DS_Store-4.5.0 +++ /dev/null diff --git a/util/scripts/mac-binary/package/opensourceStuff/InstallationCheck b/util/scripts/mac-binary/package/opensourceStuff/InstallationCheck deleted file mode 100755 index f1cd8ad..0000000 --- a/util/scripts/mac-binary/package/opensourceStuff/InstallationCheck +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# We need to do things differently on different platforms -# <10.3.9 Can't install -# =10.3.9 Can install, but must check license manually -# >=10.4 Just jump out - -os_version=`sysctl kern.osrelease | awk '{ print $3 }'` -os_major=`echo $os_version | cut -d . -f 1` -os_minor=`echo $os_version | cut -d . -f 2` - -if [ $os_major -lt 7 -o $os_major -eq 7 -a $os_minor -lt 9 ]; then - exit $((96+19)) -fi -exit 0 diff --git a/util/scripts/mac-binary/package/opensourceStuff/InstallationCheck.strings b/util/scripts/mac-binary/package/opensourceStuff/InstallationCheck.strings Binary files differdeleted file mode 100644 index 4b82b30..0000000 --- a/util/scripts/mac-binary/package/opensourceStuff/InstallationCheck.strings +++ /dev/null diff --git a/util/scripts/mac-binary/package/uninstall-qt.py b/util/scripts/mac-binary/package/uninstall-qt.py deleted file mode 100755 index 2e5cfdc..0000000 --- a/util/scripts/mac-binary/package/uninstall-qt.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -## -## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -## Contact: Qt Software Information (qt-info@nokia.com) -## -## This file is part of the $MODULE$ of the Qt Toolkit. -## -## $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 either Technology Preview License Agreement or the -## Beta Release License Agreement. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 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.0, 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. -## -## If you are unsure which license is appropriate for your use, please -## contact the sales department at qt-sales@nokia.com. -## $QT_END_LICENSE$ -## -## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -## -############################################################################# - -import commands, sys, os, shutil, glob - -trace = False -justTest = False -# Globals -AllPackages = ['docs', 'headers', 'examples', 'plugins', 'tools', 'libraries', 'debuglibraries', 'translations' ] - -packagesToRemove = AllPackages - -# Travese the list and remove values that won't work. -def realPackagesToRemove(packageList): - for package in packageList: - if package not in AllPackages: - print "%s is NOT a valid package, removing it from the list" % (package) - packageList.remove(package) - return packageList - -#Remove the files in the list -def removeFiles(fileList, helperFunc=0): - directories = [] - for file in fileList: - file = file[1:] - if not os.path.islink(file) and os.path.isdir(file): - directories.append(file) - elif len(file) > 0: - if os.path.exists(file) or os.path.islink(file): - if trace: - print "remove file: " + file - if not justTest: - os.remove(file) - else: - print "file: %s does not exist, skipping" % file - - - # Now remove any empty directories - directories.reverse() - for dir in directories: - if helperFunc: - helperFunc(dir) - if (os.path.exists(dir)) and len(os.listdir(dir)) == 0: - if trace: - print "remove dir: " + dir - if not justTest: - os.rmdir(dir) - elif trace and os.path.exists(dir): - print "NOT removing " + dir - -def removeExampleGeneratedFiles(dir): - extraList = [] - extraList.append(os.path.join(dir, "Info.plist")) - extraList.append(os.path.join(dir, ".DS_Store")) - extraList.append(os.path.join(dir, ".qmake.cache")) - extraList.append(os.path.join(dir, "Makefile")) - extraList.append(os.path.join(dir, ".obj")) - extraList.append(os.path.join(dir, ".moc")) - - xcodeprojects = glob.glob(dir + "/*" + os.path.basename(dir) + "*.xcode*") - xcodeprojects += glob.glob(dir + "/.xcode*") # Grab the items from qmake mess-up in 4.0.1 - - for file in xcodeprojects: - if trace: - print " removing the tree in " + file - shutil.rmtree(file) - - for file in extraList: - if os.path.exists(file): - if trace: - print " removing the file in " + file - if os.path.isdir(file): - shutil.rmtree(file) - else: - os.remove(file) - - -# Remove the package -def removePackage(package): - print "removing package " + package - realPackageName = "/Library/Receipts/Qt_" + package + ".pkg" - bomLocation = os.path.join(realPackageName, "Contents/Archive.bom") - if os.path.exists(realPackageName) and os.path.isdir(realPackageName): - fileList = commands.getoutput("/usr/bin/lsbom -f -p f -d -l " + bomLocation).split() - if len(fileList) > 0: - if (package == "examples"): - removeFiles(fileList, removeExampleGeneratedFiles) - else: - removeFiles(fileList) - shutil.rmtree(realPackageName) - else: - print "%s is not installed, skipping." % package - - -################# Here's where the actual script starts ######################################## -if os.getuid() != 0: - print sys.argv[0] + ": This script must be run as root or with sudo, exiting now." - sys.exit(-1) - -# Take the names of packages on the command-line -if len(sys.argv) > 1: - packagesToRemove = sys.argv[1:] - -packagesToRemove = realPackagesToRemove(packagesToRemove) - -if len(packagesToRemove) < 1: - print "\nNo valid packages to uninstall.\nusage: %s [package ...]" % (sys.argv[0]) - sys.exit(1) - -for package in packagesToRemove: - removePackage(package) diff --git a/util/scripts/make_qfeatures_dot_h b/util/scripts/make_qfeatures_dot_h new file mode 100755 index 0000000..c434649 --- /dev/null +++ b/util/scripts/make_qfeatures_dot_h @@ -0,0 +1,118 @@ +#!/usr/bin/perl +# +# Usage: make_qfeatures_dot_h +# +# Generates core/base/qfeatures.h from core/base/qfeatures.txt. +# +# The tools/qfeatures.txt file can contain redundancies, and this program +# will show them. +# + +open FL, "$ENV{QTDIR}/src/corelib/global/qfeatures.txt" + or die "Cannot open $ENV{QTDIR}/src/corelib/global/qfeatures.txt"; + +while (<FL>) { + if ( /^Feature: (\S*)/ ) { + print STDERR "Duplicate: $1\n" if $macro{$1}; + $macro{$macro=$1}=1; + } elsif ( /^Requires: (.*?)\s*$/ ) { + $deps{$macro}=$1; + map { $dep{"$macro $_"}=1 } split /\s+/, $1; + } elsif ( /^Name: (.*?)\s*$/ ) { + $label{$macro}=$1; + } +} + +close FL; + +sub depends { + my($x,$y) = @_; + return 1 if $dep{"$x $y"}; + return 0 if $dep{"$y $x"}; + return 0 if $x eq $y; + my $d; + for $d (split /\s+/, $deps{$x}) { + return 1 if depends($d,$y); + } + return 0; +} +sub dependants_rec { + my($x) = @_; + my $n = 0; + my $d = 0; + $dependants_rec_count++; + if ( $dependants_rec_count > $dependants_rec_limit ) { + if ( $circularity_start eq $x ) { + print STDERR "Circular dependency: $circularity\n"; + exit; + } + $circularity_start=$x if !$circularity_start; + $circularity="$x $circularity"; + } + for $d (split /\s+/, $deps{$x}) { + $n += 1 + dependants_rec($d); + } + $dependants_rec_count--; + return $n; +} +sub dependants { + $dependants_rec_limit=keys %macro if !$dependants_rec_limit; + $dependants_rec_count=0; + return dependants_rec @_; +} +sub dependencysort { + my($x, $y) = @_; + my $xd = dependants($x); + my $yd = dependants($y); + return $xd-$yd if $xd != $yd; + return $x cmp $y; +} + +@macros = sort { dependencysort($a,$b) } keys %macro; + +for $macro ( @macros ) { + for $d1 (split /\s+/, $deps{$macro} ) { + for $d2 (split /\s+/, $deps{$macro} ) { + print STDERR "Redundancy in $macro - $d1 depends on $d2\n" if depends($d1,$d2); + } + print STDERR "Unknown in $macro - $d1\n" if !$macro{$d1}; + } +} + +open OUT, ">$ENV{QTDIR}/src/corelib/global/qfeatures.h" + or die "Cannot open $ENV{QTDIR}/src/corelib/global/qfeatures.h for writing"; + +print OUT +"/**************************************************************************** +** +** Copyright (C) 1992-\$THISYEAR\$ \$TROLLTECH\$. All rights reserved. +** +** This file is part of the \$MODULE\$ of the Qt Toolkit. +** +** \$TROLLTECH_DUAL_LICENSE\$ +** +****************************************************************************/ + +/* + * All features and their dependencies. + * + * This list is generated from \$QTDIR/src/corelib/global/qfeatures.txt + */ + +"; + +for $macro ( @macros ) { + print OUT "// $label{$macro}\n"; + if ( $deps{$macro} ) { + print OUT "#if !defined(QT_NO_$macro)"; + print OUT " && (", (join " || ", map { "defined(QT_NO_$_)" } split /\s+/, $deps{$macro}), ")"; + print OUT "\n"; + print OUT "#define QT_NO_$macro\n"; + print OUT "#endif\n"; + } else { + print OUT "//#define QT_NO_$macro\n"; + } + print OUT "\n"; +} + +close OUT; diff --git a/util/scripts/win-binary/batch/build.bat b/util/scripts/win-binary/batch/build.bat deleted file mode 100755 index 2d81b6f..0000000 --- a/util/scripts/win-binary/batch/build.bat +++ /dev/null @@ -1,121 +0,0 @@ -call :%1 %2 -goto END - -:begin -for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_COMPILER=%%~m& set IWMAKE_TMP=%%~n - -if "%IWMAKE_TMP%"=="" set IWMAKE_TMP=build_%IWMAKE_COMPILER% -set IWMAKE_BUILD=%IWMAKE_ROOT%\%IWMAKE_TMP% -if not exist %IWMAKE_BUILD% mkdir %IWMAKE_BUILD% - -set IWMAKE_OLD_PATH=%PATH% -if not "%QMAKESPEC%"=="" set IWMAKE_OLD_QMAKESPEC=%QMAKESPEC% -if not "%QTDIR%"=="" set IWMAKE_OLD_QTDIR=%QTDIR% -if not "%INCLUDE%"=="" set IWMAKE_OLD_INCLUDE=%INCLUDE% -if not "%LIB%"=="" set IWMAKE_OLD_LIB=%LIB% - -set PATH=%IWMAKE_BUILD%\bin;%PATH% -set QTDIR=%IWMAKE_BUILD% - -if "%IWMAKE_COMPILER%"=="vs2003" goto VS2003Env -if "%IWMAKE_COMPILER%"=="vs2002" goto VS2002Env -if "%IWMAKE_COMPILER%"=="vs2005" goto VS2005Env -if "%IWMAKE_COMPILER%"=="vs2008" goto VS2008Env -if "%IWMAKE_COMPILER%"=="vc60" goto VC60Env -if "%IWMAKE_COMPILER%"=="mingw" goto MinGWEnv -goto :eof - -:VS2003Env -set QMAKESPEC=win32-msvc2003 -set IWMAKE_MAKE=nmake -goto :eof - -:VS2002Env -set QMAKESPEC=win32-msvc2002 -set IWMAKE_MAKE=nmake -goto :eof - -:VS2005Env -set QMAKESPEC=win32-msvc2005 -set IWMAKE_MAKE=nmake -goto :eof - -:VS2008Env -set QMAKESPEC=win32-msvc2008 -set IWMAKE_MAKE=nmake -goto :eof - -:VC60Env -set QMAKESPEC=win32-msvc -set IWMAKE_MAKE=nmake -goto :eof - -:SetVSEnvironment -if not exist %1 echo %1 not found >> %IWMAKE_LOGFILE% & exit /b 1 -call %1 >> %IWMAKE_LOGFILE% -goto :eof - -:MinGWEnv -set QMAKESPEC=win32-g++ -set IWMAKE_MAKE=mingw32-make -goto :eof - -:finish - if not "%IWMAKE_OLD_PATH%"=="" set PATH=%IWMAKE_OLD_PATH%& set IWMAKE_OLD_PATH= - if not "%IWMAKE_OLD_QMAKESPEC%"=="" set QMAKESPEC=%IWMAKE_OLD_QMAKESPEC%& set IWMAKE_OLD_QMAKESPEC= - if not "%IWMAKE_OLD_QTDIR%"=="" set QTDIR=%IWMAKE_OLD_QTDIR%& set IWMAKE_OLD_QTDIR= - if not "%IWMAKE_OLD_INCLUDE%"=="" set INCLUDE=%IWMAKE_OLD_INCLUDE%& set IWMAKE_OLD_INCLUDE= - if not "%IWMAKE_OLD_LIB%"=="" set LIB=%IWMAKE_OLD_LIB%& set IWMAKE_OLD_LIB= -goto :eof - -:configure - pushd %IWMAKE_BUILD% - configure %~1 >> %IWMAKE_LOGFILE% 2>&1 - popd -goto :eof - -:shadowconfigure - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - pushd %IWMAKE_BUILD% - %IWMAKE_ROOT%\%IWMAKE_TMP%\configure %IWMAKE_TMP2% >> %IWMAKE_LOGFILE% 2>&1 - popd -goto :eof - -:setcepaths - call %IWMAKE_BUILD%\bin\setcepaths.bat %~1 >> %IWMAKE_LOGFILE% 2>&1 -goto :eof - -:bin - pushd %IWMAKE_BUILD% - %IWMAKE_MAKE% %~1 >>%IWMAKE_LOGFILE% 2>&1 - popd -goto :eof - -:binInDir - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - pushd %IWMAKE_BUILD%\%IWMAKE_TMP% - %IWMAKE_MAKE% %IWMAKE_TMP2% >> %IWMAKE_LOGFILE% 2>&1 - popd -goto :eof - -:DBPlugins - call "%IWMAKE_SCRIPTDIR%\batch\copy.bat" extsync sql - set IWMAKE_SQL_OLD_LIB=%LIB% - - set LIB=%IWMAKE_ROOT%\sql\%IWMAKE_COMPILER%;%IWMAKE_SQL_OLD_LIB% - pushd %IWMAKE_BUILD%\src\plugins\sqldrivers\psql - qmake "INCLUDEPATH+=%IWMAKE_ROOT%\sql\include\psql" "LIBS+=libpqd.lib ws2_32.lib advapi32.lib shfolder.lib shell32.lib" >> %IWMAKE_LOGFILE% 2>&1 - %IWMAKE_MAKE% debug >> %IWMAKE_LOGFILE% 2>&1 - qmake "INCLUDEPATH+=%IWMAKE_ROOT%\sql\include\psql" "LIBS+=libpq.lib ws2_32.lib advapi32.lib shfolder.lib shell32.lib" >> %IWMAKE_LOGFILE% 2>&1 - %IWMAKE_MAKE% release >> %IWMAKE_LOGFILE% 2>&1 - popd - set LIB=%IWMAKE_SQL_OLD_LIB% - set IWMAKE_SQL_OLD_LIB= -goto :eof - -:root - set IWMAKE_BUILD=%~1 - if not exist %IWMAKE_BUILD% mkdir %IWMAKE_BUILD% -goto :eof - -:END diff --git a/util/scripts/win-binary/batch/copy.bat b/util/scripts/win-binary/batch/copy.bat deleted file mode 100755 index 95869ea..0000000 --- a/util/scripts/win-binary/batch/copy.bat +++ /dev/null @@ -1,91 +0,0 @@ -call :%1 %2 -goto END - -:dest - set IWMAKE_OUTDIR=%IWMAKE_ROOT%\%~1 - if not exist %IWMAKE_OUTDIR% mkdir %IWMAKE_OUTDIR% -goto :eof - -:src - set IWMAKE_SRCDIR=%IWMAKE_ROOT%\%~1 - if not exist %IWMAKE_SRCDIR% mkdir %IWMAKE_SRCDIR% -goto :eof - -:destAbs - set IWMAKE_OUTDIR=%1 - if not exist %IWMAKE_OUTDIR% mkdir %IWMAKE_OUTDIR% -goto :eof - -:srcAbs - set IWMAKE_SRCDIR=%1 - if not exist %IWMAKE_SRCDIR% mkdir %IWMAKE_SRCDIR% -goto :eof - -:extsync - echo Copying %IWMAKE_EXTERNAL%\%~1 to %IWMAKE_ROOT%\%~1 >> %IWMAKE_LOGFILE% - if exist %IWMAKE_ROOT%\%~1 rd /S /Q %IWMAKE_ROOT%\%~1 >> %IWMAKE_LOGFILE% - xcopy /H /Y /Q /I /R /E %IWMAKE_EXTERNAL%\%~1 %IWMAKE_ROOT%\%~1 >> %IWMAKE_LOGFILE% -goto :eof - -:all - xcopy /H /Y /Q /I /R /S %IWMAKE_SRCDIR%\%~1 %IWMAKE_OUTDIR%\ >> %IWMAKE_LOGFILE% -goto :eof - -:filesEx - for /F "tokens=1,2*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n& set IWMAKE_TMP3=%%~o - echo %IWMAKE_TMP3% > %IWMAKE_ROOT%\iwmake_exclude - xcopy /H /Y /Q /I /R /S /EXCLUDE:%IWMAKE_ROOT%\iwmake_exclude %IWMAKE_SRCDIR%\%IWMAKE_TMP% %IWMAKE_OUTDIR%\%IWMAKE_TMP2% >> %IWMAKE_LOGFILE% -goto :eof - -:file - set IWMAKE_TMP=%~1 - set IWMAKE_TMP2=%~nx1 - echo set IWMAKE_TMP3=%%IWMAKE_TMP:%IWMAKE_TMP2%=%%>"%IWMAKE_ROOT%\iwmake_tmp.bat" - call %IWMAKE_ROOT%\iwmake_tmp.bat - if not exist "%IWMAKE_OUTDIR%\%IWMAKE_TMP3%" mkdir "%IWMAKE_OUTDIR%\%IWMAKE_TMP3%" - xcopy /H /Y /Q /I /R %IWMAKE_SRCDIR%\%IWMAKE_TMP% %IWMAKE_OUTDIR%\%IWMAKE_TMP3% >> %IWMAKE_LOGFILE% -goto :eof - -:fileAndRename - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n& set IWMAKE_TMP4=%%~nxn - echo set IWMAKE_TMP3=%%IWMAKE_TMP2:%IWMAKE_TMP4%=%%>"%IWMAKE_ROOT%\iwmake_tmp.bat" - call %IWMAKE_ROOT%\iwmake_tmp.bat - if not exist "%IWMAKE_OUTDIR%\%IWMAKE_TMP3%" mkdir "%IWMAKE_OUTDIR%\%IWMAKE_TMP3%" - echo > %IWMAKE_OUTDIR%\%IWMAKE_TMP2% - xcopy /H /Y /Q /R %IWMAKE_SRCDIR%\%IWMAKE_TMP% %IWMAKE_OUTDIR%\%IWMAKE_TMP2% >> %IWMAKE_LOGFILE% - set IWMAKE_TMP4= -goto :eof - -:files - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - if not exist "%IWMAKE_OUTDIR%\%IWMAKE_TMP2%" mkdir "%IWMAKE_OUTDIR%\%IWMAKE_TMP2%" - xcopy /H /Y /Q /I /R /S %IWMAKE_SRCDIR%\%IWMAKE_TMP% %IWMAKE_OUTDIR%\%IWMAKE_TMP2% >> %IWMAKE_LOGFILE% -goto :eof - -:runtime - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - if "%IWMAKE_TMP2%" == "" set IWMAKE_TMP2=bin - if "%IWMAKE_TMP%" == "mingw" ( - xcopy /H /Y /Q /I /R %IWMAKE_MINGWPATH%\bin\mingwm*.dll %IWMAKE_OUTDIR%\%IWMAKE_TMP2%\ >> %IWMAKE_LOGFILE% - ) else ( - xcopy /H /Y /Q /I /R %SystemRoot%\system32\msvcr%IWMAKE_TMP%.dll %IWMAKE_OUTDIR%\%IWMAKE_TMP2%\ >> %IWMAKE_LOGFILE% - xcopy /H /Y /Q /I /R %SystemRoot%\system32\msvcp%IWMAKE_TMP%.dll %IWMAKE_OUTDIR%\%IWMAKE_TMP2%\ >> %IWMAKE_LOGFILE% - ) -goto :eof - -:external - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - xcopy /H /Y /Q /I /R %IWMAKE_TMP% %IWMAKE_OUTDIR%\%IWMAKE_TMP2%\ >> %IWMAKE_LOGFILE% -goto :eof - -:syncqt - pushd %IWMAKE_OUTDIR% - if exist "include" rd /S /Q include - if not "%QTDIR%"=="" set IWMAKE_OLD_QTDIR=%QTDIR% - set QTDIR=%IWMAKE_OUTDIR% - "%IWMAKE_PERLPATH%\perl" %QTDIR%\bin\syncqt -copy >> %IWMAKE_LOGFILE% 2>&1 - if not "%IWMAKE_OLD_QTDIR%"=="" set QTDIR=%IWMAKE_OLD_QTDIR% - popd -goto :eof - -:END diff --git a/util/scripts/win-binary/batch/delete.bat b/util/scripts/win-binary/batch/delete.bat deleted file mode 100755 index cd751fd..0000000 --- a/util/scripts/win-binary/batch/delete.bat +++ /dev/null @@ -1,41 +0,0 @@ -call :%1 %2 -goto END - -:destDir - if exist "%IWMAKE_OUTDIR%\%~1" rd /S /Q %IWMAKE_OUTDIR%\%~1 -goto :eof - -:dir - if exist "%IWMAKE_ROOT%\%~1" rd /S /Q %IWMAKE_ROOT%\%~1 -goto :eof - -:dirAbs - if exist "%~1" rd /S /Q %~1 -goto :eof - -:file - del /Q /F %IWMAKE_OUTDIR%\%~1 >> %IWMAKE_LOGFILE% 2>&1 - exit /b 0 -goto :eof - -:files - del /S /Q /F %IWMAKE_OUTDIR%\%~1 >> %IWMAKE_LOGFILE% 2>&1 - exit /b 0 -goto :eof - -:line - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - if exist "%IWMAKE_ROOT%\tmp_line.txt" del /Q /F "%IWMAKE_ROOT%\tmp_line.txt" >> %IWMAKE_LOGFILE% - type "%IWMAKE_ROOT%\%IWMAKE_TMP%" | %WINDIR%\system32\find /V "%IWMAKE_TMP2%" >> "%IWMAKE_ROOT%\tmp_line.txt" - xcopy /Y /Q /R %IWMAKE_ROOT%\tmp_line.txt %IWMAKE_ROOT%\%IWMAKE_TMP% >> %IWMAKE_LOGFILE% -goto :eof - -:dirs - for /R "%IWMAKE_OUTDIR%" %%d in ("%~1") do ( - if exist %%d ( - rd /S /Q %%d >> %IWMAKE_LOGFILE% 2>&1 - ) - ) -goto :eof - -:END diff --git a/util/scripts/win-binary/batch/env.bat b/util/scripts/win-binary/batch/env.bat deleted file mode 100755 index 302a855..0000000 --- a/util/scripts/win-binary/batch/env.bat +++ /dev/null @@ -1,101 +0,0 @@ -call :%1 %2 -goto END - -:setglobals -set IWMAKE_PARSESECTION=1 -set IWMAKE_MINGWPATH=c:\MinGW\bin -set IWMAKE_STARTDIR=%CD% -set IWMAKE_NSISCONF=%IWMAKE_SCRIPTDIR%\nsis\config.nsh -set IWMAKE_ROOT=c:\package -set IWMAKE_OUTDIR=%IWMAKE_ROOT% -set IWMAKE_SRCDIR=%IWMAKE_ROOT% -set IWMAKE_EXTRACTDEST=%IWMAKE_ROOT% -set IWMAKE_NSISPATH=%PROGRAMFILES%\NSIS -call %IWMAKE_SCRIPTDIR%\batch\log.bat fileAbs "%IWMAKE_STARTDIR%\log.txt" -goto :eof - -:signPath - set IWMAKE_SIGNPATH=%~1 -goto :eof - -:wgetPath - set IWMAKE_WGET=%~1 -goto :eof - -:wgetDir - set IWMAKE_WGET=%IWMAKE_ROOT%\%~1 -goto :eof - -:NSISPath - set IWMAKE_NSISPATH=%~1 -goto :eof - -:PerlPath - set IWMAKE_PERLPATH=%~1 -goto :eof - -:MinGWPath - set IWMAKE_MINGWPATH=%~1 -goto :eof - -:unzipApp - set IWMAKE_UNZIPAPP=%~1 -goto :eof - -:releaseLocation - set IWMAKE_WGETUSER= - set IWMAKE_WGETPASS= - for /F "tokens=1,2*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& if not "%%~n"=="" set IWMAKE_TMP2=%%~n& if not "%%~o"=="" set IWMAKE_TMP3=%%~o - if not "%IWMAKE_TMP2%"=="" set IWMAKE_WGETUSER=--http-user=%IWMAKE_TMP2% - if not "%IWMAKE_TMP3%"=="" set IWMAKE_WGETPASS=--http-passwd=%IWMAKE_TMP3% - set IWMAKE_RELEASELOCATION=%IWMAKE_TMP% -goto :eof - -:removeglobals -if not "%IWMAKE_OLD_PATH%"=="" call %IWMAKE_SCRIPTDIR%\batch\build.bat finish -set IWMAKE_RELEASELOCATION= -set IWMAKE_NSISPATH= -set IWMAKE_SECTION= -set IWMAKE_WGET= -set IWMAKE_WGETUSER= -set IWMAKE_WGETPASS= -set IWMAKE_UNZIPAPP= -set IWMAKE_MINGWPATH= -set IWMAKE_MAKE= -set IWMAKE_PERLPATH= -set IWMAKE_STARTDIR= -set IWMAKE_SCRIPTDIR= -set IWMAKE_NSISCONF= -set IWMAKE_RESULT= -set IWMAKE_TMP= -set IWMAKE_TMP2= -set IWMAKE_TMP3= -set IWMAKE_STATUS= -set IWMAKE_LOGFILE= -set IWMAKE_BUILD= -set IWMAKE_ROOT= -set IWMAKE_OUTDIR= -set IWMAKE_EXTERNAL= -set IWMAKE_OLD_PATH= -set IWMAKE_OLD_QMAKESPEC= -set IWMAKE_OLD_QTDIR= -set IWMAKE_OLD_INCLUDE= -set IWMAKE_OLD_LIB= -set IWMAKE_COMPILER= -set IWMAKE_SRCDIR= -set IWMAKE_EXTRACTSRC= -set IWMAKE_EXTRACTDEST= -set IWMAKE_PARSESECTION= -set IWMAKE_OUTPUT_FILE= -set IWMAKE_SIGNPATH= -goto :eof - -:root -set IWMAKE_ROOT=%~1 -goto :eof - -:extroot -set IWMAKE_EXTERNAL=%~1 -goto :eof - -:END diff --git a/util/scripts/win-binary/batch/extract.bat b/util/scripts/win-binary/batch/extract.bat deleted file mode 100755 index c5a9a23..0000000 --- a/util/scripts/win-binary/batch/extract.bat +++ /dev/null @@ -1,47 +0,0 @@ -call :%1 %2 -goto END - -:dest - set IWMAKE_EXTRACTDEST=%IWMAKE_ROOT%\%~1 -goto :eof - -:src - set IWMAKE_EXTRACTSRC=%~1 -goto :eof - -:extUnpack - set IWMAKE_EXTRACTSRC=%~n1 - pushd %IWMAKE_ROOT% - if exist "%IWMAKE_EXTRACTSRC%.zip" del /Q /F "%IWMAKE_EXTRACTSRC%.zip" - %IWMAKE_WGET%\wget %IWMAKE_WGETUSER% %IWMAKE_WGETPASS% %IWMAKE_RELEASELOCATION%/%IWMAKE_EXTRACTSRC%.zip >> %IWMAKE_LOGFILE% 2>&1 - popd - call :unpack "%~1" -goto :eof - -:unpack - set IWMAKE_EXTRACTSRC=%~n1 - pushd %IWMAKE_ROOT% - if exist "%IWMAKE_EXTRACTDEST%" rd /S /Q %IWMAKE_EXTRACTDEST% >> %IWMAKE_LOGFILE% 2>&1 - if exist "%IWMAKE_EXTRACTSRC%" rd /S /Q %IWMAKE_EXTRACTSRC% >> %IWMAKE_LOGFILE% 2>&1 - %IWMAKE_UNZIPAPP% -q %IWMAKE_EXTRACTSRC%.zip >> %IWMAKE_LOGFILE% - popd - move %IWMAKE_ROOT%\%IWMAKE_EXTRACTSRC% %IWMAKE_EXTRACTDEST% >> %IWMAKE_LOGFILE% -goto :eof - -:extPatch - pushd %IWMAKE_ROOT% - if exist "%~1" del /Q /F "%~1" - %IWMAKE_WGET%\wget %IWMAKE_WGETUSER% %IWMAKE_WGETPASS% %IWMAKE_RELEASELOCATION%/%~1 >> %IWMAKE_LOGFILE% 2>&1 - popd - call :patch "%~1" -goto :eof - -:patch - pushd %IWMAKE_ROOT% - %IWMAKE_UNZIPAPP% %~1 >> %IWMAKE_LOGFILE% - popd - xcopy /R /I /S /Q /Y %IWMAKE_ROOT%\%IWMAKE_EXTRACTSRC%\*.* %IWMAKE_EXTRACTDEST%\ >> %IWMAKE_LOGFILE% - rd /S /Q %IWMAKE_ROOT%\%IWMAKE_EXTRACTSRC% >> %IWMAKE_LOGFILE% -goto :eof - -:END diff --git a/util/scripts/win-binary/batch/installer.bat b/util/scripts/win-binary/batch/installer.bat deleted file mode 100755 index 74887ee..0000000 --- a/util/scripts/win-binary/batch/installer.bat +++ /dev/null @@ -1,227 +0,0 @@ -call :%1 %2 -goto END - -:begin - call :reset - echo !define PRODUCT_NAME "%~1" >> %IWMAKE_NSISCONF% - echo !define INSTALL_ROOT "%IWMAKE_ROOT%" >> %IWMAKE_NSISCONF% -goto :eof - -:output - set IWMAKE_OUTPUT_FILE=%~1 - echo !define OUTPUT_FILE "%~1" >> %IWMAKE_NSISCONF% -goto :eof - -:module - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %~1 - echo !define MODULE_%IWMAKE_RESULT% >> %IWMAKE_NSISCONF% -goto :eof - -:enable - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %~1 - echo !define USE_%IWMAKE_RESULT:"=% >> %IWMAKE_NSISCONF% -goto :eof - -:disable - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %~1 - echo !undef USE_%IWMAKE_RESULT:"=% >> %IWMAKE_NSISCONF% -goto :eof - -:startmenu - echo !define DEFAULT_STARTMENU_STRING "%~1" >> %IWMAKE_NSISCONF% -goto :eof - -:reset - if exist "%IWMAKE_NSISCONF%" del /Q /F "%IWMAKE_NSISCONF%" -goto :eof - -:instdir - for /F "tokens=1,2*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n& set IWMAKE_TMP3="%%~o" - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP% - echo !define INSTDIR_%IWMAKE_TMP2% %IWMAKE_RESULT:"=% >> "%IWMAKE_NSISCONF%" - echo !define INSTDIR_%IWMAKE_TMP2%_TEXT %IWMAKE_TMP3% >> "%IWMAKE_NSISCONF%" -goto :eof - -:version - echo !define PRODUCT_VERSION "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:readme - echo !define README_FILE "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:licenseFile - echo !define LICENSE_FILE "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:runfunction - echo !define RUN_FUNCTION "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:readmefunction - echo !define README_FUNCTION "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:readmestartpage - echo !define README_STARTPAGE "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:welcomenote - echo !define WELCOME_NOTE "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:welcometitle - echo !define WELCOME_TITLE "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:welcomeicon - echo !define WELCOME_ICON "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:finishtitle - echo !define FINISH_TITLE "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:updateplugins - call "%IWMAKE_SCRIPTDIR%\batch\copy.bat" extsync INetLoad - xcopy /Q /Y /R "%IWMAKE_ROOT%\INetLoad\INetLoad.dll" "%IWMAKE_NSISPATH%\Plugins\" >> %IWMAKE_LOGFILE% - xcopy /Q /Y /R "%IWMAKE_SCRIPTDIR%\nsis\qtnsisext\qtnsisext.dll" "%IWMAKE_NSISPATH%\Plugins\" >> %IWMAKE_LOGFILE% -goto :eof - -:defineDir - for /F "tokens=1,2*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n& set IWMAKE_TMP3=%%~o - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP% - set IWMAKE_TMP=%IWMAKE_RESULT% - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP2% - set IWMAKE_TMP2=%IWMAKE_RESULT% - echo !define MODULE_%IWMAKE_TMP%_%IWMAKE_TMP2% "%IWMAKE_ROOT%\%IWMAKE_TMP3%" >> "%IWMAKE_NSISCONF%" -goto :eof - -:define - for /F "tokens=1,2*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n& set IWMAKE_TMP3="%%~o" - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP% - set IWMAKE_TMP=%IWMAKE_RESULT% - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP2% - set IWMAKE_TMP2=%IWMAKE_RESULT% - if %IWMAKE_TMP3%=="" set IWMAKE_TMP3= - echo !define MODULE_%IWMAKE_TMP%_%IWMAKE_TMP2% %IWMAKE_TMP3% >> "%IWMAKE_NSISCONF%" -goto :eof - -:src - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP% - set IWMAKE_TMP=%IWMAKE_RESULT% - set IWMAKE_TMP3="%IWMAKE_ROOT%\%IWMAKE_TMP2%" - echo !define MODULE_%IWMAKE_TMP%_ROOT %IWMAKE_TMP3% >> "%IWMAKE_NSISCONF%" -goto :eof - -:buildDir - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP% - set IWMAKE_TMP=%IWMAKE_RESULT% - set IWMAKE_TMP3="%IWMAKE_ROOT%\%IWMAKE_TMP2%" - echo !define MODULE_%IWMAKE_TMP%_BUILDDIR %IWMAKE_TMP3% >> "%IWMAKE_NSISCONF%" - for /F "eol=- tokens=1,2,3" %%m in ('%WINDIR%\system32\find "QT_PACKAGEDATE_STR" %IWMAKE_ROOT%\%IWMAKE_TMP2%\src\corelib\global\qglobal.h') do echo !define MODULE_LICENSECHECK_PACKAGEDATE %%o >> "%IWMAKE_NSISCONF%" -goto :eof - -:compile - call :required - pushd %IWMAKE_SCRIPTDIR%\nsis - "%IWMAKE_NSISPATH%\makensis.exe" installer.nsi >> %IWMAKE_LOGFILE% - popd -goto :eof - -:required - call :setrequired PRODUCT_NAME - call :setrequired INSTALL_ROOT - call :setrequired PRODUCT_VERSION - call :setrequired OUTPUT_FILE - call :setrequired INSTDIR_0 - call :setrequired DEFAULT_STARTMENU_STRING -goto :eof - -:setrequired - echo !ifndef %1 >> "%IWMAKE_NSISCONF%" - echo !error "%1 must be in the .conf file..." >> "%IWMAKE_NSISCONF%" - echo !endif >> "%IWMAKE_NSISCONF%" -goto :eof - -:makeFileList - for /F "tokens=1*" %%m in ("%~1") do set IWMAKE_TMP=%%~m& set IWMAKE_TMP2=%%~n - call "%IWMAKE_SCRIPTDIR%\batch\toupper.bat" %IWMAKE_TMP% - set IWMAKE_TMP=%IWMAKE_RESULT% - set IWMAKE_TMP3="%IWMAKE_ROOT%\%IWMAKE_TMP2%" - - - echo !macro MODULE_%IWMAKE_TMP%_INSTALLFILES >> "%IWMAKE_NSISCONF%" - - pushd %IWMAKE_TMP3% - - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$0=$$0%%> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$1=$$1%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$2=$$2%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$3=$$3%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$4=$$4%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$5=$$5%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$6=$$6%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$7=$$7%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$8=$$8%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:$9=$$9%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo set IWMAKE_TMP2=%%IWMAKE_TMP2:%CD%\=%%>> "%IWMAKE_ROOT%\iwmake_tmp.bat" - - dir /AD /B /S | sort /R > "%IWMAKE_ROOT%\iwmake_tmp.txt" - for /F "tokens=1" %%m in (%IWMAKE_ROOT%\iwmake_tmp.txt) do call :addInstallDirectory "%%m" - - - dir /A-D /B /S > "%IWMAKE_ROOT%\iwmake_tmp.txt" - for /F "tokens=1" %%m in (%IWMAKE_ROOT%\iwmake_tmp.txt) do call :addInstallFile "%%m" - - popd - echo !macroend >> "%IWMAKE_NSISCONF%" - - - echo !macro MODULE_%IWMAKE_TMP%_REMOVE removepath >> "%IWMAKE_NSISCONF%" - echo strcmp ${removepath} "" MODULE_%IWMAKE_TMP%_REMOVE_SAFETYLABEL >> "%IWMAKE_NSISCONF%" - pushd %IWMAKE_TMP3% - - dir /A-D /B /S > "%IWMAKE_ROOT%\iwmake_tmp.txt" - for /F "tokens=1" %%m in (%IWMAKE_ROOT%\iwmake_tmp.txt) do call :addRemoveFiles "%%m" - - dir /AD /B /S | sort /R > "%IWMAKE_ROOT%\iwmake_tmp.txt" - for /F "tokens=1" %%m in (%IWMAKE_ROOT%\iwmake_tmp.txt) do call :addRemoveDirectory "%%m" - - popd - echo MODULE_%IWMAKE_TMP%_REMOVE_SAFETYLABEL: >> "%IWMAKE_NSISCONF%" - echo !macroend >> "%IWMAKE_NSISCONF%" -goto :eof - -:addInstallFile - set IWMAKE_TMP2=%~1 - call "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo File "/oname=%IWMAKE_TMP2%" "%~1" >> "%IWMAKE_NSISCONF%" -goto :eof - -:addInstallDirectory - set IWMAKE_TMP2=%~1 - call "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo CreateDirectory "$OUTDIR\%IWMAKE_TMP2%" >> "%IWMAKE_NSISCONF%" -goto :eof - -:addRemoveDirectory - set IWMAKE_TMP2=%~1 - call "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo RMDir ${removepath}\%IWMAKE_TMP2% >> "%IWMAKE_NSISCONF%" -goto :eof - -:addRemoveFiles - set IWMAKE_TMP2=%~1 - call "%IWMAKE_ROOT%\iwmake_tmp.bat" - echo Delete ${removepath}\%IWMAKE_TMP2% >> "%IWMAKE_NSISCONF%" -goto :eof - -:sign - echo Signing Installer ... - %IWMAKE_SIGNPATH%\signtool.exe sign /v /t http://timestamp.verisign.com/scripts/timestamp.dll /f "%IWMAKE_SIGNPATH%\keys.pfx" "%IWMAKE_OUTPUT_FILE%" >> %IWMAKE_LOGFILE% -goto :eof - -:END diff --git a/util/scripts/win-binary/batch/log.bat b/util/scripts/win-binary/batch/log.bat deleted file mode 100755 index 6186ff1..0000000 --- a/util/scripts/win-binary/batch/log.bat +++ /dev/null @@ -1,18 +0,0 @@ -call :%1 %2 -goto END - -:file -set IWMAKE_LOGFILE=%IWMAKE_ROOT%\%~1 -call :reset -goto :eof - -:fileAbs -set IWMAKE_LOGFILE=%1 -call :reset -goto :eof - -:reset -date /T > %IWMAKE_LOGFILE% -goto :eof - -:END diff --git a/util/scripts/win-binary/batch/toupper.bat b/util/scripts/win-binary/batch/toupper.bat deleted file mode 100755 index cc4365a..0000000 --- a/util/scripts/win-binary/batch/toupper.bat +++ /dev/null @@ -1,29 +0,0 @@ -set IWMAKE_RESULT=%1 -if [%IWMAKE_RESULT%]==[] goto :eof -set IWMAKE_RESULT=%IWMAKE_RESULT:a=A% -set IWMAKE_RESULT=%IWMAKE_RESULT:b=B% -set IWMAKE_RESULT=%IWMAKE_RESULT:c=C% -set IWMAKE_RESULT=%IWMAKE_RESULT:d=D% -set IWMAKE_RESULT=%IWMAKE_RESULT:e=E% -set IWMAKE_RESULT=%IWMAKE_RESULT:f=F% -set IWMAKE_RESULT=%IWMAKE_RESULT:g=G% -set IWMAKE_RESULT=%IWMAKE_RESULT:h=H% -set IWMAKE_RESULT=%IWMAKE_RESULT:i=I% -set IWMAKE_RESULT=%IWMAKE_RESULT:j=J% -set IWMAKE_RESULT=%IWMAKE_RESULT:k=K% -set IWMAKE_RESULT=%IWMAKE_RESULT:l=L% -set IWMAKE_RESULT=%IWMAKE_RESULT:m=M% -set IWMAKE_RESULT=%IWMAKE_RESULT:n=N% -set IWMAKE_RESULT=%IWMAKE_RESULT:o=O% -set IWMAKE_RESULT=%IWMAKE_RESULT:p=P% -set IWMAKE_RESULT=%IWMAKE_RESULT:q=Q% -set IWMAKE_RESULT=%IWMAKE_RESULT:r=R% -set IWMAKE_RESULT=%IWMAKE_RESULT:s=S% -set IWMAKE_RESULT=%IWMAKE_RESULT:t=T% -set IWMAKE_RESULT=%IWMAKE_RESULT:u=U% -set IWMAKE_RESULT=%IWMAKE_RESULT:v=V% -set IWMAKE_RESULT=%IWMAKE_RESULT:w=W% -set IWMAKE_RESULT=%IWMAKE_RESULT:x=X% -set IWMAKE_RESULT=%IWMAKE_RESULT:y=Y% -set IWMAKE_RESULT=%IWMAKE_RESULT:z=Z% - diff --git a/util/scripts/win-binary/config/addin.conf b/util/scripts/win-binary/config/addin.conf deleted file mode 100644 index ad7daa4..0000000 --- a/util/scripts/win-binary/config/addin.conf +++ /dev/null @@ -1,42 +0,0 @@ -Section GETFILES -copy extsync addin7x -copy extsync addin60 -copy extsync debugext -copy extsync vsip -SectionEnd - -Section NSIS -# general installer options -installer begin "QMsAddin Collection" -installer version "2.1" -installer output "c:\iwmake\qt-vsaddin-collection-2.1.3.exe" -installer startmenu "QMsAddin Collection v2.1" -installer enable component_page -installer enable directory_page -installer enable admin_check -installer enable uninstall_previous -installer enable warn_no_qt_found -installer enable optional_shortcutcreation -installer instdir addin 0 "Add-ins Installation Directory" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "addin7x" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation|Academic|Educational" - -# addin options -installer module addin7x - -# addin60 options -installer module addin60 - -# debugext options -installer module debugext - -# help options -installer module help - -# compile the package -installer compile -installer sign -SectionEnd
\ No newline at end of file diff --git a/util/scripts/win-binary/config/addin7x.conf b/util/scripts/win-binary/config/addin7x.conf deleted file mode 100644 index 34edb7b..0000000 --- a/util/scripts/win-binary/config/addin7x.conf +++ /dev/null @@ -1,48 +0,0 @@ -Section GETFILES -copy extsync addin7x -#copy extsync addin60 -copy extsync debugext -#copy extsync vsip -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt4 Visual Studio Add-in" -installer version "1.0b2" -installer output "c:\iwmake\qt-vs-addin-1.0.0-beta2.exe" -installer startmenu "Qt4 Visual Studio Add-in v1.0b2" -installer enable component_page -installer enable directory_page -installer enable admin_check -installer enable uninstall_previous -#installer enable warn_no_qt_found -installer enable optional_shortcutcreation -installer instdir addin 0 "Add-ins Installation Directory" - -# license checking -#installer module licensecheck -#installer defineDir licensecheck licenseDir "addin7x" -#installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation|Academic|Educational" -installer licenseFile "%IWMAKE_ROOT%\LICENSE.QT4VSADDIN" - -# addin options -installer module addin7x - -# addin60 options -#installer module addin60 - -# debugext options -installer module debugext -installer define debugext novc60 -installer define debugext novs2002 -installer define debugext novs2003 - -# help options -installer module help -installer define help novs2002 -installer define help novs2003 - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/config.aeryn b/util/scripts/win-binary/config/config.aeryn deleted file mode 100644 index 48408a8..0000000 --- a/util/scripts/win-binary/config/config.aeryn +++ /dev/null @@ -1,2 +0,0 @@ -env perlPath c:\bin\perl\bin -env NSISPath "c:\program files (x86)\NSIS" diff --git a/util/scripts/win-binary/config/config.alessandro64 b/util/scripts/win-binary/config/config.alessandro64 deleted file mode 100644 index b6233a3..0000000 --- a/util/scripts/win-binary/config/config.alessandro64 +++ /dev/null @@ -1,11 +0,0 @@ -#where to find nsis -env NSISPath "%ProgramFiles(x86)%\NSIS" - -#where to find perl -env perlPath "c:\Perl64\bin" - -#where to find all external files -env extroot "c:\temp\eclipse\binaries" - -#where to find packages -env releaseLocation "http://localhost/qtpackagesforinstallertests" diff --git a/util/scripts/win-binary/config/config.chiana b/util/scripts/win-binary/config/config.chiana deleted file mode 100644 index 3380376..0000000 --- a/util/scripts/win-binary/config/config.chiana +++ /dev/null @@ -1 +0,0 @@ -env extroot \\tirion-nokia.troll.no\binaries
\ No newline at end of file diff --git a/util/scripts/win-binary/config/config.default b/util/scripts/win-binary/config/config.default deleted file mode 100644 index b515c54..0000000 --- a/util/scripts/win-binary/config/config.default +++ /dev/null @@ -1,17 +0,0 @@ -#root directory -env root "c:\iwmake" - -#where to find all external files -env extroot "\\tirion\binaries" - -#where to find mingw -env mingwPath "c:\mingw" - -#where to find nsis -env NSISPath "%ProgramFiles%\NSIS" - -#where to find perl -env perlPath "c:\Perl\bin" - -#where to find packages -env releaseLocation "http://tirion.troll.no/~qt/packages/%QT_VERSION%" diff --git a/util/scripts/win-binary/config/config.innsikt b/util/scripts/win-binary/config/config.innsikt deleted file mode 100644 index 5290526..0000000 --- a/util/scripts/win-binary/config/config.innsikt +++ /dev/null @@ -1 +0,0 @@ -env perlPath "C:\Program Files\activestateperl\bin" diff --git a/util/scripts/win-binary/config/config.kepler b/util/scripts/win-binary/config/config.kepler deleted file mode 100644 index 1958c03..0000000 --- a/util/scripts/win-binary/config/config.kepler +++ /dev/null @@ -1,14 +0,0 @@ -#root directory -env root "f:\iwmake" - -#where to find mingw -env mingwPath "f:\mingw" - -#where to find nsis -env NSISPath "%ProgramFiles%\NSIS" - -#where to find perl -env perlPath "f:\Perl\bin" - -#where to find packages -env releaseLocation "http://ares.troll.no/~harald/packages" diff --git a/util/scripts/win-binary/config/config.planck b/util/scripts/win-binary/config/config.planck deleted file mode 100644 index cc95a1f..0000000 --- a/util/scripts/win-binary/config/config.planck +++ /dev/null @@ -1,17 +0,0 @@ -env extroot "c:\lupinella" -#env extroot "\\tirion.nokia.troll.no\binaries" - -#root directory -env root "c:\iwmake" - -#where to find mingw -env mingwPath "c:\mingw" - -#where to find nsis -env NSISPath "%ProgramFiles%\NSIS" - -#where to find perl -env perlPath "c:\Perl\bin" - -#where to find packages -env releaseLocation "http://tirion.troll.no/~qt/packages" diff --git a/util/scripts/win-binary/config/config.radeberger b/util/scripts/win-binary/config/config.radeberger deleted file mode 100644 index e0606c6..0000000 --- a/util/scripts/win-binary/config/config.radeberger +++ /dev/null @@ -1,17 +0,0 @@ -#root directory -env root "c:\iwmake" - -#where to find all external files -env extroot "\\lupinella\public\binaries" - -#where to find mingw -env mingwPath "c:\mingw" - -#where to find nsis -env NSISPath "%ProgramFiles%\NSIS" - -#where to find perl -env perlPath "c:\Perl\bin" - -#where to find packages -env releaseLocation "http://becks.troll.no/~espenr/" diff --git a/util/scripts/win-binary/config/config.samarin b/util/scripts/win-binary/config/config.samarin deleted file mode 100644 index 512abbd..0000000 --- a/util/scripts/win-binary/config/config.samarin +++ /dev/null @@ -1 +0,0 @@ -env NSISPath "c:\program files (x86)\NSIS"
\ No newline at end of file diff --git a/util/scripts/win-binary/config/eclipse.conf b/util/scripts/win-binary/config/eclipse.conf deleted file mode 100644 index 2969dd4..0000000 --- a/util/scripts/win-binary/config/eclipse.conf +++ /dev/null @@ -1,20 +0,0 @@ -Section GETFILES -copy extsync eclipse -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Eclipse Integration" -installer version "1.4.0" -installer output "c:\iwmake\qt-eclipse-integration-win32-${PRODUCT_VERSION}.exe" -installer startmenu "Qt Eclipse Integration v${PRODUCT_VERSION}" -installer licenseFile "%IWMAKE_ROOT%\eclipse\plugins\com.trolltech.qtcpp.feature_${PRODUCT_VERSION}\license.txt" -installer enable directory_page -installer enable uninstall_previous -installer instdir eclipse 0 "Integration Installation Directory" - -installer module eclipse - -# compile the package -installer compile -SectionEnd diff --git a/util/scripts/win-binary/config/mingw-opensource.conf b/util/scripts/win-binary/config/mingw-opensource.conf deleted file mode 100644 index 88e8c9e..0000000 --- a/util/scripts/win-binary/config/mingw-opensource.conf +++ /dev/null @@ -1,95 +0,0 @@ -#extracts the package to buildDir - -extract dest "build_mingw_opensource" -Section EXTRACT -extract extUnpack "qt-win-opensource-src-%QT_VERSION%.zip" -SectionEnd - -#build the binaries -build begin mingw "build_mingw_opensource" - -Section CONFIGURE -build configure "-confirm-license -debug-and-release -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl" -SectionEnd - -Section BUILD -build bin -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_mingw_opensource" - -copy dest "release_mingw_opensource" -copy src "build_mingw_opensource" - -# extract everything once more -extract dest "release_mingw_opensource" -extract unpack "qt-win-opensource-src-%QT_VERSION%.zip" - -# qconfig.h -copy file "src\corelib\global\qconfig.h" -copy file "include\QtCore\qconfig.h" -copy file "include\Qt\qconfig.h" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.a" -copy all "*.exe" -copy all "*.dll" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" - -# copy InetLoad license info -copy files "..\INetLoad\Readme.txt" "src\3rdparty\InetLoad\" - -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt OpenSource" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-opensource-%QT_VERSION%-mingw.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (OpenSource)" -installer enable component_page -installer enable directory_page -installer enable startmenu_page -installer instdir mingw 0 "Qt Installation Directory" -installer licenseFile "%IWMAKE_ROOT%\release_mingw_opensource\.LICENSE-MERGED-GPL2-GPL3" -#installer licenseFile "%IWMAKE_ROOT%\release_mingw_opensource\LICENSE.PREVIEW.OPENSOURCE" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -installer module registeruiext -installer module opensource - -# mingw options -installer module mingw -installer src mingw "release_mingw_opensource" -installer makeFileList mingw "release_mingw_opensource" -installer buildDir mingw "build_mingw_opensource" -installer enable nodirlengthcheck -SectionEnd - -# compile the package -Section NSIS_COMPILE -installer compile -SectionEnd diff --git a/util/scripts/win-binary/config/qsa.conf b/util/scripts/win-binary/config/qsa.conf deleted file mode 100644 index f585515..0000000 --- a/util/scripts/win-binary/config/qsa.conf +++ /dev/null @@ -1,34 +0,0 @@ -env releaseLocation "http://anarki.troll.no/~gunnar/packages" "" "" - -Section EXTRACT -extract dest "qsa" -extract extUnpack "qsa-win-commercial-%QSA_VERSION_NUMBER%.zip" -SectionEnd - -Section NSIS -# general installer options -installer begin "QSA" -installer version "%QSA_VERSION_NUMBER%" -installer output "c:\iwmake\qsa-win-commercial-%QSA_VERSION_NUMBER%.exe" -installer startmenu "Trolltech QSA v%QSA_VERSION_NUMBER%" -installer enable directory_page -installer enable admin_check -installer instdir qsa 0 "QSA Installation Directory" - -installer welcomenote "This wizard will guide you through the installation of QSA v%QSA_VERSION_NUMBER%.\r\n\r\nQSA %QSA_VERSION_NUMBER% requires Qt 4.0.1 snapshots or later.\r\n\r\nThe installer will try to determine your development environment. If you experience problems installing QSA %QSA_VERSION_NUMBER%, please make sure the PATH and QMAKESPEC environment variables are set up correctly and try again.\r\n\r\nClick Next to continue." - -#installer licenseFile "%IWMAKE_ROOT%\qsa\LICENSE.PREVIEW" - -# key checker -installer module licensecheck -installer defineDir licensecheck licenseDir "qsa" -installer define licensecheck productlist "Universal|Desktop" -installer define licensecheck checkproduct "QSA" - -# INSERT qsa module (specify root if path to sources is different than qsa) -installer module qsa - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/qsa_eval.conf b/util/scripts/win-binary/config/qsa_eval.conf deleted file mode 100644 index 5f595e5..0000000 --- a/util/scripts/win-binary/config/qsa_eval.conf +++ /dev/null @@ -1,36 +0,0 @@ -env releaseLocation "http://anarki.troll.no/~gunnar/packages" "" "" - -Section EXTRACT -extract dest "qsa" -extract extUnpack "qsa-win-eval-1.2.2.zip" -SectionEnd - -Section NSIS -# general installer options -installer begin "QSA" -installer version "1.2.2" -installer output "c:\iwmake\qsa-win-eval-1.2.2.exe" -installer startmenu "Trolltech QSA v1.2.2" -installer enable directory_page -# installer enable admin_check -installer instdir qsa 0 "QSA Installation Directory" - -installer welcomenote "This wizard will guide you through the installation of QSA v1.2.2.\r\n\r\nQSA 1.2.2 requires Qt 4.0.1 snapshots or later.\r\n\r\nThe installer will try to determine your development environment. If you experience problems installing QSA 1.2.2, please make sure the PATH and QMAKESPEC environment variables are set up correctly and try again.\r\n\r\nClick Next to continue." - -# installer licenseFile "%IWMAKE_ROOT%\qsa\LICENSE.PREVIEW" - -# key checker -installer module licensecheck -installer defineDir licensecheck licenseDir "qsa" -installer define licensecheck license "LICENSE.EVAL" -installer define licensecheck uslicense "LICENSE.EVAL" -installer define licensecheck productlist "UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation|Desktop|Universal" -installer define licensecheck checkproduct "QSA" - -# INSERT qsa module (specify root if path to sources is different than qsa) -installer module qsa - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/qsa_gpl.conf b/util/scripts/win-binary/config/qsa_gpl.conf deleted file mode 100644 index e599605..0000000 --- a/util/scripts/win-binary/config/qsa_gpl.conf +++ /dev/null @@ -1,34 +0,0 @@ -env releaseLocation "http://anarki.troll.no/~gunnar/packages" "" "" - -Section EXTRACT -extract dest "qsa" -extract extUnpack "qsa-win-opensource-1.2.2.zip" -SectionEnd - -Section NSIS -# general installer options -installer begin "QSA" -installer version "1.2.2" -installer output "c:\iwmake\qsa-win-opensource-1.2.2.exe" -installer startmenu "Trolltech QSA v1.2.2" -installer enable directory_page -installer enable admin_check -installer instdir qsa 0 "QSA Installation Directory" - -installer welcomenote "This wizard will guide you through the installation of QSA v1.2.2.\r\n\r\nQSA 1.2.2 requires Qt 4.0.1 snapshots or later.\r\n\r\nThe installer will try to determine your development environment. If you experience problems installing QSA 1.2.2, please make sure the PATH and QMAKESPEC environment variables are set up correctly and try again.\r\n\r\nClick Next to continue." - -installer licenseFile "%IWMAKE_ROOT%\qsa\LICENSE.GPL" - -# key checker -#installer module licensecheck -#installer defineDir licensecheck license "qsa\.LICENSE" -#installer defineDir licensecheck uslicense "qsa\.LICENSE-US" -#installer define licensecheck productlist "Universal|Desktop" -#installer define licensecheck checkproduct "QSA" - -# INSERT qsa module (specify root if path to sources is different than qsa) -installer module qsa - -# compile the package -installer compile -SectionEnd diff --git a/util/scripts/win-binary/config/qtjambi-commercial.conf b/util/scripts/win-binary/config/qtjambi-commercial.conf deleted file mode 100644 index 3ce1e76..0000000 --- a/util/scripts/win-binary/config/qtjambi-commercial.conf +++ /dev/null @@ -1,33 +0,0 @@ -env releaseLocation "http://anarki.troll.no/~gunnar/packages/commercial" - -delete dir "qtjambi_commercial" -extract dest "qtjambi_commercial" -extract extUnpack "qtjambi-win32-commercial-%QTJAMBI_VERSION%.zip" - -Section NSIS -# general installer options -installer begin "Qt Jambi" -installer version "%QTJAMBI_VERSION%" -installer output "x:\public_html\packages\commercial\qtjambi-win32-commercial-%QTJAMBI_VERSION%.exe" -installer startmenu "Qt Jambi by Nokia v4.3.3_01" -installer makeFileList qtjambi "qtjambi_commercial" - -installer enable directory_page -installer enable startmenu_page -installer instdir qtjambi 0 "Qt Jambi Installation Directory" - -# license checking -installer module licensecheck -installer define licensecheck license "LICENSE" -installer define licensecheck uslicense "LICENSE" -installer defineDir licensecheck licenseDir "qtjambi_commercial" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" - -installer module qtjambi - -# compile the package -installer compile -installer sign -SectionEnd - - diff --git a/util/scripts/win-binary/config/qtjambi-eval.conf b/util/scripts/win-binary/config/qtjambi-eval.conf deleted file mode 100644 index 4411ca3..0000000 --- a/util/scripts/win-binary/config/qtjambi-eval.conf +++ /dev/null @@ -1,34 +0,0 @@ -env releaseLocation "http://anarki.troll.no/~gunnar/packages/eval" - -delete dir "qtjambi_evaluation" -extract dest "qtjambi_evaluation" -extract extUnpack "qtjambi-win32-eval-%QTJAMBI_VERSION%.zip" - -Section NSIS -# general installer options -installer begin "Qt Jambi Evaluation" -installer version "%QTJAMBI_VERSION%" -installer output "x:\public_html\packages\eval\qtjambi-win32-eval-%QTJAMBI_VERSION%.exe" -installer startmenu "Qt Jambi by Nokia v4.3.3_01" -installer makeFileList qtjambi "qtjambi_evaluation" - -installer enable directory_page -installer enable startmenu_page -installer instdir qtjambi 0 "Qt Jambi Installation Directory" - -# license checking -installer module licensecheck -installer define licensecheck license "LICENSE.EVAL" -installer define licensecheck uslicense "LICENSE.EVAL" -installer defineDir licensecheck licenseDir "qtjambi_evaluation" -installer define licensecheck productlist "UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation" - -installer module qtjambi -installer module evaluation - -# compile the package -installer compile -installer sign -SectionEnd - - diff --git a/util/scripts/win-binary/config/vc60-commercial.conf b/util/scripts/win-binary/config/vc60-commercial.conf deleted file mode 100644 index 1c2877d..0000000 --- a/util/scripts/win-binary/config/vc60-commercial.conf +++ /dev/null @@ -1,110 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vc60_commercial_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vc60_commercial_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -#build the binaries -build begin vc60 "build_vc60_commercial_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -no-phonon -openssl" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vc60_commercial" - -copy dest "release_vc60_commercial" -copy src "build_vc60_commercial_________________PADDING_________________" - -# extract everything once more -extract dest "release_vc60_commercial" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# moc files (exclude release moc files) -copy filesEx "src\moc_*.cpp" "src\" "release_shared" -copy filesEx "src\*.moc" "src\" "release_shared" - -# qconfig.h -copy file "src\corelib\global\qconfig.h" -copy file "include\QtCore\qconfig.h" -copy file "include\Qt\qconfig.h" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Commercial" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-commercial-%QT_VERSION%-vc60.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (VC60)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -#installer define licensecheck license "LICENSE.PREVIEW.COMMERCIAL" -#installer define licensecheck uslicense "LICENSE.PREVIEW.COMMERCIAL" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vc60_commercial" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" - -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vc60_commercial" -installer makeFileList msvc "release_vc60_commercial" -installer buildDir msvc "build_vc60_commercial_________________PADDING_________________" -installer define msvc vc60 - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vc60-eval.conf b/util/scripts/win-binary/config/vc60-eval.conf deleted file mode 100644 index f2fc154..0000000 --- a/util/scripts/win-binary/config/vc60-eval.conf +++ /dev/null @@ -1,133 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vc60_evaluation_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -extract extPatch "qt-win-evalpatches-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vc60_evaluation_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync addin60 -copy extsync debugext -SectionEnd - -#build the binaries -build begin vc60 "build_vc60_evaluation_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl -no-phonon -D QT_EVAL" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vc60_evaluation" - -copy dest "release_vc60_evaluation" -copy src "build_vc60_evaluation_________________PADDING_________________" - -# extract everything once more -extract dest "release_vc60_evaluation" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# create header files -copy syncqt - -delete destDir "src" -delete destDir "tools" -delete destDir "qmake" - -# phrasebooks & porting .xml file -copy files "tools\linguist\phrasebooks\*.qph" "phrasebooks\" -copy files "tools\porting\src\*.xml" "" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# qconfig.h -copy files "src\corelib\global\qconfig.h" "include\Qt\" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -delete file "configure.exe" - -# copy some activeqt stuff needed to compile examples -copy file "src\activeqt\control\qaxserver.rc" -copy file "src\activeqt\control\qaxserver.ico" -copy file "src\activeqt\control\qaxserver.def" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Evaluation" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-eval-%QT_VERSION%-vc60.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (Eval. VC60)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt v%QT_VERSION%:" -installer instdir addin 1 "Visual Studio Add-In:" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vc60_evaluation" -installer define licensecheck productlist "UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation" - -installer module evaluation -installer module environment -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vc60_evaluation" -installer makeFileList msvc "release_vc60_evaluation" -installer buildDir msvc "build_vc60_evaluation_________________PADDING_________________" -installer define msvc vc60 - -# help options -installer module addin60 - -# debugext options -installer module debugext - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2003-commercial-vsip.conf b/util/scripts/win-binary/config/vs2003-commercial-vsip.conf deleted file mode 100644 index 4f3ba8b..0000000 --- a/util/scripts/win-binary/config/vs2003-commercial-vsip.conf +++ /dev/null @@ -1,131 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2003_commercial_vsip_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2003_commercial_vsip_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync vsip -copy extsync debugext -SectionEnd - -#build the binaries -build begin vs2003 "build_vs2003_commercial_vsip_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2003_commercial_vsip" - -copy dest "release_vs2003_commercial_vsip" -copy src "build_vs2003_commercial_vsip_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2003_commercial_vsip" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# moc files (exclude release moc files) -copy filesEx "src\moc_*.cpp" "src\" "release_shared" -copy filesEx "src\*.moc" "src\" "release_shared" - -# qconfig.h -copy file "src\corelib\global\qconfig.h" -copy file "include\QtCore\qconfig.h" -copy file "include\Qt\qconfig.h" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# copy manifest files (vs2003 stuff) -copy all "*.manifest" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Commercial" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-commercial-vsintegration-%QT_VERSION%-vs2003.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (VS2003)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" -installer instdir vsip 1 "Visual Studio Integration:" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -#installer define licensecheck license "LICENSE.PREVIEW.COMMERCIAL" -#installer define licensecheck uslicense "LICENSE.PREVIEW.COMMERCIAL" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2003_commercial_vsip" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" - -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2003_commercial_vsip" -installer makeFileList msvc "release_vs2003_commercial_vsip" -installer buildDir msvc "build_vs2003_commercial_vsip_________________PADDING_________________" -installer define msvc vs2003 - -# vsip options -installer module vsip -installer define vsip version "1.4.0" -installer define vsip no2005 -installer define vsip no2008 - -# help options -installer module help - -# debugext options -installer module debugext - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2003-commercial.conf b/util/scripts/win-binary/config/vs2003-commercial.conf deleted file mode 100644 index 2d3a47f..0000000 --- a/util/scripts/win-binary/config/vs2003-commercial.conf +++ /dev/null @@ -1,110 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2003_commercial_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2003_commercial_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -#build the binaries -build begin vs2003 "build_vs2003_commercial_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2003_commercial" - -copy dest "release_vs2003_commercial" -copy src "build_vs2003_commercial_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2003_commercial" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# moc files (exclude release moc files) -copy filesEx "src\moc_*.cpp" "src\" "release_shared" -copy filesEx "src\*.moc" "src\" "release_shared" - -# qconfig.h -copy file "src\corelib\global\qconfig.h" -copy file "include\QtCore\qconfig.h" -copy file "include\Qt\qconfig.h" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Commercial" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-commercial-%QT_VERSION%-vs2003.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (VS2003)" -installer enable component_page -installer enable directory_page -installer enable startmenu_page -installer instdir msvc 0 "Qt Installation Directory" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -#installer define licensecheck license "LICENSE.PREVIEW.COMMERCIAL" -#installer define licensecheck uslicense "LICENSE.PREVIEW.COMMERCIAL" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2003_commercial" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" - -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2003_commercial" -installer makeFileList msvc "release_vs2003_commercial" -installer buildDir msvc "build_vs2003_commercial_________________PADDING_________________" -installer define msvc vs2003 -SectionEnd - -# compile the package -Section NSIS_COMPILE -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2003-demo.conf b/util/scripts/win-binary/config/vs2003-demo.conf deleted file mode 100644 index ef2d48d..0000000 --- a/util/scripts/win-binary/config/vs2003-demo.conf +++ /dev/null @@ -1,58 +0,0 @@ -#extracts the package to buildDir -Section Extract -copy dest "build_vs2003_demo_________________PADDING_________________" -copy package "qt-win-commercial-desktop-4.0.0.zip" -SectionEnd - -#build the binaries -build begin vs2003 "build_vs2003_demo_________________PADDING_________________" - -Section Configure -build configure "-confirm-license -release -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg" -SectionEnd - -Section Build -build bin -SectionEnd - -build finish - -# organize release files -Section Organize -delete dir "release_vs2003_demo" - -copy dest "release_vs2003_demo" -copy src "build_vs2003_demo_________________PADDING_________________" - -copy files "bin\*.dll" "bin\" -copy files "doc\*" "doc\" -copy files "demos\*.exe" "demos\" -copy files "examples\*.exe" "examples\" -copy file "bin\qtdemo.exe" "bin\" -copy file "bin\assistant.exe" "bin\" -copy runtime "71" -SectionEnd - -# update the nsis plugins -installer updateplugins - -# general installer options -installer begin "Qt Demos" -installer version "4.0.0" -installer output "c:\iwmake\qt-demos_4.0.0.exe" -installer startmenu "Qt Demos v4.0.0" -installer enable component_page -installer enable directory_page -installer instdir msvc 0 "Qt Installation Directory" - -installer module environment -installer module registeruiext - -# msvc7x options -installer module msvc -installer define msvc nodefault -installer src msvc "release_vs2003_demo" -installer buildDir msvc "build_vs2003_demo_________________PADDING_________________" - -# compile the package -installer compile
\ No newline at end of file diff --git a/util/scripts/win-binary/config/vs2003-eval.conf b/util/scripts/win-binary/config/vs2003-eval.conf deleted file mode 100644 index d139fc9..0000000 --- a/util/scripts/win-binary/config/vs2003-eval.conf +++ /dev/null @@ -1,124 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2003_evaluation_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -extract extPatch "qt-win-evalpatches-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2003_evaluation_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync debugext -SectionEnd - -#build the binaries -build begin vs2003 "build_vs2003_evaluation_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl -D QT_EVAL" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2003_evaluation" - -copy dest "release_vs2003_evaluation" -copy src "build_vs2003_evaluation_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2003_evaluation" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# create header files -copy syncqt - -delete destDir "src" -delete destDir "tools" -delete destDir "qmake" - -# phrasebooks & porting .xml file -copy files "tools\linguist\phrasebooks\*.qph" "phrasebooks\" -copy files "tools\porting\src\*.xml" "" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# qconfig.h -copy files "src\corelib\global\qconfig.h" "include\Qt\" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -delete file "configure.exe" - -# copy some activeqt stuff needed to compile examples -copy file "src\activeqt\control\qaxserver.rc" -copy file "src\activeqt\control\qaxserver.ico" -copy file "src\activeqt\control\qaxserver.def" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Evaluation" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-eval-%QT_VERSION%-vs2003.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (Eval. VS2003)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt v%QT_VERSION%:" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2003_evaluation" -installer define licensecheck productlist "UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation" - -installer module evaluation -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2003_evaluation" -installer makeFileList msvc "release_vs2003_evaluation" -installer buildDir msvc "build_vs2003_evaluation_________________PADDING_________________" -installer define msvc vs2003 - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2005-ce-commercial.conf b/util/scripts/win-binary/config/vs2005-ce-commercial.conf deleted file mode 100644 index dbfaa41..0000000 --- a/util/scripts/win-binary/config/vs2005-ce-commercial.conf +++ /dev/null @@ -1,165 +0,0 @@ -# qt-%QT_VERSION% -env releaseLocation "http://tirion.troll.no/~qt/packages/%QT_VERSION%" - -#extracts the package to buildDir -extract dest "qtsources" -Section EXTRACT -# qt-%QT_VERSION% -extract extUnpack "qt-embedded-wince-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "qtsources\examples\examples.pro" "activeqt" - -SectionEnd - -#build the WIN32 binaries -build begin vs2005 "build_vs2005_ce_win32_commercial_________________PADDING_________________" -Section CONFIGUREWIN32 -build shadowconfigure "qtsources" "-confirm-license -no-webkit -no-phonon -qt-libpng -qt-libjpeg -no-openssl -no-incredibuild-xge" -SectionEnd -Section BUILDWIN32 -build bin sub-src -build binInDir "tools" -SectionEnd -build finish - -#build the WM50 binaries -build begin vs2005 "build_vs2005_ce_wm50_commercial_________________PADDING_________________" -Section CONFIGUREWM50 -build shadowconfigure "qtsources" "-confirm-license -xplatform wincewm50pocket-msvc2005 -no-openssl -no-incredibuild-xge" -SectionEnd -Section BUILDWM50 -build setcepaths "wincewm50pocket-msvc2005" -build bin sub-src -SectionEnd -build finish - -#build the ssdk50x86 binaries -build begin vs2005 "build_vs2005_ce_ssdk50x86_commercial_________________PADDING_________________" -Section CONFIGURESSDK50X86 -build shadowconfigure "qtsources" "-confirm-license -xplatform wince50standard-x86-msvc2005 -no-openssl -no-incredibuild-xge" -SectionEnd -Section BUILDSSDK50X86 -build setcepaths "wince50standard-x86-msvc2005" -build bin sub-src -SectionEnd -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2005_ce_commercial" -copy dest "release_vs2005_ce_commercial" - -# copy sources to "qtsources" -copy src "qtsources" -delete dir "release_vs2005_ce_commercial\qtsources" -copy dest "release_vs2005_ce_commercial\qtsources" -copy all "*" - -# copy WIN32 binaries -copy src "build_vs2005_ce_win32_commercial_________________PADDING_________________" -delete dir "release_vs2005_ce_commercial\win32binaries" -copy dest "release_vs2005_ce_commercial\win32binaries" -copy files "bin\*" "bin\" -copy files "lib\*.pdb" "bin\" -copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" - -copy src "release_vs2005_ce_commercial\qtsources\doc\html" -copy dest "release_vs2005_ce_commercial\win32binaries\doc\html" -copy all "*" -copy src "release_vs2005_ce_commercial\qtsources\doc\qch" -copy dest "release_vs2005_ce_commercial\win32binaries\doc\qch" -copy all "*" -delete dir "release_vs2005_ce_commercial\qtsources\doc\html" -#copy all "qch" -delete dir "release_vs2005_ce_commercial\qtsources\doc\qch" - -# copy WM50 binaries -copy src "build_vs2005_ce_wm50_commercial_________________PADDING_________________" -delete dir "release_vs2005_ce_commercial\wm50binaries" -copy dest "release_vs2005_ce_commercial\wm50binaries" -copy files "bin\*" "bin\" -copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "lib\*.pdb" "lib\" -copy files "lib\*.dll" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" - -# copy ssdk50x86 binaries -copy src "build_vs2005_ce_ssdk50x86_commercial_________________PADDING_________________" -delete dir "release_vs2005_ce_commercial\ssdk50x86binaries" -copy dest "release_vs2005_ce_commercial\ssdk50x86binaries" -copy files "bin\*" "bin\" -copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "lib\*.pdb" "lib\" -copy files "lib\*.dll" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" - -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt for Windows CE Commercial" -installer version "%QT_VERSION%" -installer welcometitle "Welcome to Qt for Windows CE" -installer finishtitle "Completing Qt for Windows CE" -installer output "c:\iwmake\qt-embedded-wince-commercial-%QT_VERSION%-vs2005.exe" -installer startmenu "Qt for Windows CE by Nokia v%QT_VERSION% (VS2005)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" - -installer readmefunction "Show Documentation" -# ### FIXME: Use start page as soon as assistant allows you to do so previously to loading documentation. -# installer readmestartpage "qthelp://com.trolltech.qt.440/qdoc/wince-with-qt-introduction.html" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2005_ce_commercial\qtsources" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" -installer define licensecheck wince - -#installer licenseFile "%IWMAKE_ROOT%\LICENSE.PREVIEW.COMMERCIAL" - -installer module registeruiext - -# msvc options -installer module msvc -installer makeFileList msvc "release_vs2005_ce_commercial" -installer buildDir msvc "build_vs2005_ce_win32_commercial_________________PADDING_________________" -installer defineDir msvc qtsourcetree "qtsources" -installer define msvc qtsourceinstalldirname "qtsources" -installer defineDir msvc win32buildtree "build_vs2005_ce_win32_commercial_________________PADDING_________________" -installer define msvc win32buildinstalldirname "win32binaries" -installer defineDir msvc wm50buildtree "build_vs2005_ce_wm50_commercial_________________PADDING_________________" -installer define msvc wm50buildinstalldirname "wm50binaries" -installer define msvc wm50sdk "wincewm50pocket-msvc2005" -installer define msvc wm50versionpretty "Windows Mobile 5 Pocket" -installer defineDir msvc ssdk50x86buildtree "build_vs2005_ce_ssdk50x86_commercial_________________PADDING_________________" -installer define msvc ssdk50x86buildinstalldirname "ssdk50x86binaries" -installer define msvc ssdk50x86sdk "wince50standard-x86-msvc2005" -installer define msvc ssdk50x86versionpretty "WinCE standard SDK 5 x86" -installer define msvc vs2005 -#installer define msvc skippatchlicenseinformation - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2005-ce-eval.conf b/util/scripts/win-binary/config/vs2005-ce-eval.conf deleted file mode 100644 index aadc04a..0000000 --- a/util/scripts/win-binary/config/vs2005-ce-eval.conf +++ /dev/null @@ -1,202 +0,0 @@ -# qt-%QT_VERSION% -env releaseLocation "http://tirion.troll.no/~qt/packages/%QT_VERSION%" - -#extracts the package to buildDir -extract dest "qtsources" -Section EXTRACT -# qt-%QT_VERSION% -extract extUnpack "qt-embedded-wince-commercial-src-%QT_VERSION%.zip" -# This is a little bit hacky: The eval patches unzip to qt-win... not to qt-wince -# Thus we keep extracting to that directory and copy it over to our target afterwards -extract src "qt-win-commercial-src-%QT_VERSION%" -extract extPatch "qt-win-evalpatches-src-%QT_VERSION%.zip" -extract src "qt-wince-commercial-src-%QT_VERSION%" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "qtsources\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync debugext -SectionEnd - - -#build the WIN32 binaries -build begin vs2005 "build_vs2005_ce_win32_evaluation_________________PADDING_________________" -Section CONFIGUREWIN32 -build shadowconfigure "qtsources" "-confirm-license -no-webkit -no-phonon -qt-libpng -qt-libjpeg -no-openssl -no-incredibuild-xge -D QT_EVAL" -SectionEnd -Section BUILDWIN32 -build bin sub-src -build binInDir "tools" -SectionEnd -build finish - -#build the WM50 binaries -build begin vs2005 "build_vs2005_ce_wm50_evaluation_________________PADDING_________________" -Section CONFIGUREWM50 -build shadowconfigure "qtsources" "-confirm-license -xplatform wincewm50pocket-msvc2005 -no-openssl -no-incredibuild-xge -D QT_EVAL" -SectionEnd -Section BUILDWM50 -build setcepaths "wincewm50pocket-msvc2005" -build bin sub-src -SectionEnd -build finish - -#build the ssdk50x86 binaries -build begin vs2005 "build_vs2005_ce_ssdk50x86_evaluation_________________PADDING_________________" -Section CONFIGURESSDK50X86 -build shadowconfigure "qtsources" "-confirm-license -xplatform wince50standard-x86-msvc2005 -no-openssl -no-incredibuild-xge -D QT_EVAL" -SectionEnd -Section BUILDSSDK50X86 -build setcepaths "wince50standard-x86-msvc2005" -build bin sub-src -SectionEnd -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2005_ce_evaluation" -copy dest "release_vs2005_ce_evaluation" - -# copy sources to "qtsources" -copy src "qtsources" -delete dir "release_vs2005_ce_evaluation\qtsources" -copy dest "release_vs2005_ce_evaluation\qtsources" -copy all "*" -# NOTE: The eval package must not contain sources. Thus we can only provide -# the binary builds we have to potential customers. -delete destdir "src" -delete destdir "tools" -delete destdir "qmake" -delete destdir "utils" -delete file "configure.exe" -copy dest "qtsources" -copy syncqt - -# copy WIN32 binaries -copy src "build_vs2005_ce_win32_evaluation_________________PADDING_________________" -delete dir "release_vs2005_ce_evaluation\win32binaries" -copy dest "release_vs2005_ce_evaluation\win32binaries" -copy files "bin\*" "bin\" -copy files "lib\*.pdb" "bin\" -#copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "include\Qt\qconfig.h" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" -# copy header files -copy src "qtsources\include" -copy dest "release_vs2005_ce_evaluation\win32binaries\include" -copy all "*" - -copy src "release_vs2005_ce_evaluation\qtsources\doc\html" -copy dest "release_vs2005_ce_evaluation\win32binaries\doc\html" -copy all "*" -copy src "release_vs2005_ce_evaluation\qtsources\doc\qch" -copy dest "release_vs2005_ce_evaluation\win32binaries\doc\qch" -copy all "*" -delete dir "release_vs2005_ce_evaluation\qtsources\doc\html" -#copy all "qch" -delete dir "release_vs2005_ce_evaluation\qtsources\doc\qch" - -# copy WM50 binaries -copy src "build_vs2005_ce_wm50_evaluation_________________PADDING_________________" -delete dir "release_vs2005_ce_evaluation\wm50binaries" -copy dest "release_vs2005_ce_evaluation\wm50binaries" -copy files "bin\*" "bin\" -#copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "lib\*.pdb" "lib\" -copy files "lib\*.dll" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "include\Qt\qconfig.h" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" -# copy header files -copy src "qtsources\include" -copy dest "release_vs2005_ce_evaluation\wm50binaries\include" -copy all "*" - -# copy ssdk50x86 binaries -copy src "build_vs2005_ce_ssdk50x86_evaluation_________________PADDING_________________" -delete dir "release_vs2005_ce_evaluation\ssdk50x86binaries" -copy dest "release_vs2005_ce_evaluation\ssdk50x86binaries" -copy files "bin\*" "bin\" -#copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "lib\*.pdb" "lib\" -copy files "lib\*.dll" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "include\Qt\qconfig.h" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" -# copy header files -copy src "qtsources\include" -copy dest "release_vs2005_ce_evaluation\ssdk50x86binaries\include" -copy all "*" - -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Evaluation for Windows CE" -installer version "%QT_VERSION%" -installer welcometitle "Welcome to Qt for Windows CE" -installer finishtitle "Completing Qt for Windows CE" -installer output "c:\iwmake\qt-embedded-wince-eval-%QT_VERSION%-vs2005.exe" -installer startmenu "Qt for Windows CE by Nokia v%QT_VERSION% (Eval. VS2005)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" - -installer readmefunction "Show Documentation" - -# ### FIXME: Use start page as soon as assistant allows you to do so previously to loading documentation. -# installer readmestartpage "qthelp://com.trolltech.qt.440/qdoc/wince-with-qt-introduction.html" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2005_ce_evaluation\qtsources" -installer define licensecheck productlist "UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation" -installer define licensecheck wince - -# ### FIXME: Remove once we have proper licenses -#installer licenseFile "%IWMAKE_ROOT%\LICENSE.PREVIEW.COMMERCIAL" - -# msvc options -installer module msvc -installer makeFileList msvc "release_vs2005_ce_evaluation" -#installer buildDir msvc "build_vs2005_ce_win32_evaluation_________________PADDING_________________" -installer buildDir msvc "qtsources" -installer defineDir msvc qtsourcetree "qtsources" -installer define msvc qtsourceinstalldirname "qtsources" -installer defineDir msvc win32buildtree "build_vs2005_ce_win32_evaluation_________________PADDING_________________" -installer define msvc win32buildinstalldirname "win32binaries" -installer defineDir msvc wm50buildtree "build_vs2005_ce_wm50_evaluation_________________PADDING_________________" -installer define msvc wm50buildinstalldirname "wm50binaries" -installer define msvc wm50sdk "wincewm50pocket-msvc2005" -installer define msvc wm50versionpretty "Windows Mobile 5 Pocket" -installer defineDir msvc ssdk50x86buildtree "build_vs2005_ce_ssdk50x86_evaluation_________________PADDING_________________" -installer define msvc ssdk50x86buildinstalldirname "ssdk50x86binaries" -installer define msvc ssdk50x86sdk "wince50standard-x86-msvc2005" -installer define msvc ssdk50x86versionpretty "WinCE standard SDK 5 x86" -installer define msvc vs2005 -#installer define msvc skippatchlicenseinformation - -installer module evaluation -installer module registeruiext - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2005-commercial-vsip.conf b/util/scripts/win-binary/config/vs2005-commercial-vsip.conf deleted file mode 100644 index 38885e7..0000000 --- a/util/scripts/win-binary/config/vs2005-commercial-vsip.conf +++ /dev/null @@ -1,131 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2005_commercial_vsip_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2005_commercial_vsip_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync vsip -copy extsync debugext -SectionEnd - -#build the binaries -build begin vs2005 "build_vs2005_commercial_vsip_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2005_commercial_vsip" - -copy dest "release_vs2005_commercial_vsip" -copy src "build_vs2005_commercial_vsip_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2005_commercial_vsip" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# moc files (exclude release moc files) -copy filesEx "src\moc_*.cpp" "src\" "release_shared" -copy filesEx "src\*.moc" "src\" "release_shared" - -# qconfig.h -copy file "src\corelib\global\qconfig.h" -copy file "include\QtCore\qconfig.h" -copy file "include\Qt\qconfig.h" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# copy manifest files (vs2005 stuff) -copy all "*.manifest" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Commercial" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-commercial-vsintegration-%QT_VERSION%-vs2005.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (VS2005)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" -installer instdir vsip 1 "Visual Studio Integration:" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -#installer define licensecheck license "LICENSE.PREVIEW.COMMERCIAL" -#installer define licensecheck uslicense "LICENSE.PREVIEW.COMMERCIAL" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2005_commercial_vsip" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" - -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2005_commercial_vsip" -installer makeFileList msvc "release_vs2005_commercial_vsip" -installer buildDir msvc "build_vs2005_commercial_vsip_________________PADDING_________________" -installer define msvc vs2005 - -# vsip options -installer module vsip -installer define vsip version "1.4.0" -installer define vsip no2003 -installer define vsip no2008 - -# help options -installer module help - -# debugext options -installer module debugext - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2005-commercial.conf b/util/scripts/win-binary/config/vs2005-commercial.conf deleted file mode 100644 index 1529638..0000000 --- a/util/scripts/win-binary/config/vs2005-commercial.conf +++ /dev/null @@ -1,113 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2005_commercial_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2005_commercial_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -#build the binaries -build begin vs2005 "build_vs2005_commercial_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2005_commercial" - -copy dest "release_vs2005_commercial" -copy src "build_vs2005_commercial_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2005_commercial" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# moc files (exclude release moc files) -copy filesEx "src\moc_*.cpp" "src\" "release_shared" -copy filesEx "src\*.moc" "src\" "release_shared" - -# qconfig.h -copy file "src\corelib\global\qconfig.h" -copy file "include\QtCore\qconfig.h" -copy file "include\Qt\qconfig.h" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# copy manifest files (vs2005 stuff) -copy all "*.manifest" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Commercial" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-commercial-%QT_VERSION%-vs2005.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (VS2005)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -#installer define licensecheck license "LICENSE.PREVIEW.COMMERCIAL" -#installer define licensecheck uslicense "LICENSE.PREVIEW.COMMERCIAL" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2005_commercial" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" - -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2005_commercial" -installer makeFileList msvc "release_vs2005_commercial" -installer buildDir msvc "build_vs2005_commercial_________________PADDING_________________" -installer define msvc vs2005 - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2005-eval.conf b/util/scripts/win-binary/config/vs2005-eval.conf deleted file mode 100644 index e4bdc1d..0000000 --- a/util/scripts/win-binary/config/vs2005-eval.conf +++ /dev/null @@ -1,127 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2005_evaluation_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -extract extPatch "qt-win-evalpatches-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2005_evaluation_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync debugext -SectionEnd - -#build the binaries -build begin vs2005 "build_vs2005_evaluation_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl -D QT_EVAL" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2005_evaluation" - -copy dest "release_vs2005_evaluation" -copy src "build_vs2005_evaluation_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2005_evaluation" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# create header files -copy syncqt - -delete destDir "src" -delete destDir "tools" -delete destDir "qmake" - -# phrasebooks & porting .xml file -copy files "tools\linguist\phrasebooks\*.qph" "phrasebooks\" -copy files "tools\porting\src\*.xml" "" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# qconfig.h -copy files "src\corelib\global\qconfig.h" "include\Qt\" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# copy manifest files (vs2005 stuff) -copy all "*.manifest" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -delete file "configure.exe" - -# copy some activeqt stuff needed to compile examples -copy file "src\activeqt\control\qaxserver.rc" -copy file "src\activeqt\control\qaxserver.ico" -copy file "src\activeqt\control\qaxserver.def" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Evaluation" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-eval-%QT_VERSION%-vs2005.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (Eval. VS2005)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt v%QT_VERSION%:" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2005_evaluation" -installer define licensecheck productlist "UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation" - -installer module evaluation -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2005_evaluation" -installer makeFileList msvc "release_vs2005_evaluation" -installer buildDir msvc "build_vs2005_evaluation_________________PADDING_________________" -installer define msvc vs2005 - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2005-qtdemo.conf b/util/scripts/win-binary/config/vs2005-qtdemo.conf deleted file mode 100644 index 7f4ba09..0000000 --- a/util/scripts/win-binary/config/vs2005-qtdemo.conf +++ /dev/null @@ -1,115 +0,0 @@ -# -# Qt-demo consists of the compiled demos + assistant -# -# Required manual steps -# - Download dxwebsetup.exe to C:\iwmake -# - Copy vcredist_x86.exe from VS8 folder to C:\iwmake -# - Set up environment to include ActiveX -# - set INCLUDE=C:\Program Files\Microsoft DirectX SDK (March 2008)\Include;C:\Program Files\Microsoft SDKs\Windows\v6.0\Include;%INCLUDE% -# - set LIB=C:\Program Files\Microsoft DirectX SDK (March 2008)\Lib\x86;C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib;%LIB% -# - Run EXTRACT -# - Patch demo/qtdemo/xml/examples.xml to only display startable demos -# - Copy examples/qtconcurrent/README from 4.4 depot -# - -#extracts the package to buildDir -Section EXTRACT -extract dest "build_msvc_qtdemo_________________PADDING_________________" -extract extUnpack qt-win-opensource-src-%QT_VERSION%.zip -SectionEnd - -#build the binaries -build begin vs2005 "build_msvc_qtdemo_________________PADDING_________________" - -Section CONFIGURE -# sqlite is needed by assistant -build configure "-confirm-license -release -plugin-sql-sqlite -qt-libpng -qt-libjpeg" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools\assistant" release -build binInDir "tools\designer" release -build binInDir "demos" release -build binInDir "examples" release -build finish -SectionEnd - - -# organize release files -Section ORGANIZE -delete dir "release_msvc_qtdemo" - -copy dest "release_msvc_qtdemo" -copy src "build_msvc_qtdemo_________________PADDING_________________" - -# copy all binary files -copy file "bin\qtdemo.exe" -copy file "bin\assistant.exe" -copy files "bin\*.dll" "bin" - -# copy documentation files -copy files "doc\qch\*.qch" "doc\qch" - -# copy plugins -copy files "plugins\accessible\*.dll" "plugins\accessible" -copy files "plugins\codecs\*.dll" "plugins\codecs" -copy files "plugins\iconengines\*.dll" "plugins\iconengines" -copy files "plugins\imageformats\*.dll" "plugins\imageformats" -copy files "plugins\sqldrivers\*.dll" "plugins\sqldrivers" -copy files "plugins\phonon_backend\*.dll" "plugins\phonon_backend" - -# copy demo & example files -copy files "demos" "demos" -copy files "examples" "examples" - -# copy external installers -copy external "%IWMAKE_ROOT%\dxwebsetup.exe" "prerequisites" -copy external "%IWMAKE_ROOT%\vcredist_x86.exe" "prerequisites" - -# delete build artifacts -delete files "ui_*.h" -delete files "Makefile" -delete files "*.Debug" -delete files "*.Release" -delete files "*.a" -delete files "*.lib" -delete files "*.vcproj" -delete dirs "tmp" -delete dirs ".obj" -delete dirs ".moc" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt" -installer version "demo-%QT_VERSION%" -installer output "%IWMAKE_ROOT%\qt-win-demo-%QT_VERSION%.exe" -installer startmenu "Qt Demo by Nokia v%QT_VERSION%" -installer welcomenote "Welcome to the Qt Demos and Examples application. This application illustrates some of the key features included the cross-platform application framework Qt. Many of these examples contain source code.\n\nFor a full, free product evaluation, please visit http://qtsoftware.com/evaluate/" -installer welcomeicon "images\qt-wizard-clean.bmp" - -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Demo Installation Directory" - -installer runfunction "Run Examples and Demos" -# installer readmefunction "Show Documentation" - -# options -installer module msvc -installer src msvc "release_msvc_qtdemo" -installer makeFileList msvc "release_msvc_qtdemo" -installer buildDir msvc "build_msvc_qtdemo_________________PADDING_________________" - -installer module qtdemo -installer define qtdemo vcredist "prerequisites\vcredist_x86.exe" -installer define qtdemo directx "prerequisites\dxwebsetup.exe" - -installer licenseFile "%IWMAKE_ROOT%\build_msvc_qtdemo_________________PADDING_________________\.LICENSE-MERGED-GPL2-GPL3" - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2008-ce-commercial.conf b/util/scripts/win-binary/config/vs2008-ce-commercial.conf deleted file mode 100644 index d730168..0000000 --- a/util/scripts/win-binary/config/vs2008-ce-commercial.conf +++ /dev/null @@ -1,97 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2008_commercial_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-embedded-wince-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -#delete line "build_vs2008_commercial_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -#build the binaries -build begin vs2008 "build_vs2008_commercial_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -qt-libpng -qt-libjpeg -qt-style-windowsce -qt-style-windowsmobile -no-opengl -no-qt3support -release" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools\assistant" release -build binInDir "tools\designer" release -build binInDir "tools\linguist" release -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2008_commercial" - -copy dest "release_vs2008_commercial" -copy src "build_vs2008_commercial_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2008_commercial" -extract unpack "qt-embedded-wince-commercial-src-%QT_VERSION%.zip" - -# copy all binary files -copy all "*.exe" -copy all "*.dll" - -# copy plugins to appropiate place -copy files "plugins\accessible\*.dll" "bin\accessible" -copy files "plugins\codecs\*.dll" "bin\codecs" -copy files "plugins\designer\*.dll" "bin\designer" -copy files "plugins\iconengines\*.dll" "bin\iconengines" -copy files "plugins\imageformats\*.dll" "bin\imageformats" -# remove unused stuff -delete files "lib\*.*" -delete destDir "plugins" - -# remove host tools being recompiled later -# unfortunately msvc.nsh depends on qmake.exe -# delete file "bin\qmake.exe" -delete file "bin\moc.exe" -delete file "bin\uic.exe" -delete file "bin\rcc.exe" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt for Windows CE Commercial" -installer version "%QT_VERSION%" -installer welcometitle "Welcome to Qt for Windows CE" -installer finishtitle "Completing Qt for Windows CE" -installer output "c:\iwmake\qt-embedded-wince-commercial-%QT_VERSION%-vs2008.exe" -installer startmenu "Qt for Windows CE by Nokia v%QT_VERSION% (VS2008)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" - -installer readmefunction "Show Documentation" -installer readmestartpage "wince-with-qt-introduction.html" - -#installer define licensecheck license "LICENSE.PREVIEW.COMMERCIAL" -#installer define licensecheck uslicense "LICENSE.PREVIEW.COMMERCIAL" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2008_commercial" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" -installer define licensecheck wince - -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2008_commercial" -installer makeFileList msvc "release_vs2008_commercial" -installer buildDir msvc "build_vs2008_commercial_________________PADDING_________________" -installer define msvc vs2008ce - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2008-ce-eval.conf b/util/scripts/win-binary/config/vs2008-ce-eval.conf deleted file mode 100644 index deef004..0000000 --- a/util/scripts/win-binary/config/vs2008-ce-eval.conf +++ /dev/null @@ -1,202 +0,0 @@ -# qt-%QT_VERSION% -env releaseLocation "http://tirion.troll.no/~qt/packages/%QT_VERSION%" - -#extracts the package to buildDir -extract dest "qtsources" -Section EXTRACT -# qt-%QT_VERSION% -extract extUnpack "qt-embedded-wince-commercial-src-%QT_VERSION%.zip" -# This is a little bit hacky: The eval patches unzip to qt-win... not to qt-wince -# Thus we keep extracting to that directory and copy it over to our target afterwards -extract src "qt-win-commercial-src-%QT_VERSION%" -extract extPatch "qt-win-evalpatches-src-%QT_VERSION%.zip" -extract src "qt-wince-commercial-src-%QT_VERSION%" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "qtsources\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync debugext -SectionEnd - - -#build the WIN32 binaries -build begin vs2008 "build_vs2008_ce_win32_evaluation_________________PADDING_________________" -Section CONFIGUREWIN32 -build shadowconfigure "qtsources" "-confirm-license -no-webkit -no-phonon -qt-libpng -qt-libjpeg -no-openssl -no-incredibuild-xge -D QT_EVAL" -SectionEnd -Section BUILDWIN32 -build bin sub-src -build binInDir "tools" -SectionEnd -build finish - -#build the WM50 binaries -build begin vs2008 "build_vs2008_ce_wm50_evaluation_________________PADDING_________________" -Section CONFIGUREWM50 -build shadowconfigure "qtsources" "-confirm-license -xplatform wincewm50pocket-msvc2008 -no-openssl -no-incredibuild-xge -D QT_EVAL" -SectionEnd -Section BUILDWM50 -build setcepaths "wincewm50pocket-msvc2008" -build bin sub-src -SectionEnd -build finish - -#build the ssdk50x86 binaries -build begin vs2008 "build_vs2008_ce_ssdk50x86_evaluation_________________PADDING_________________" -Section CONFIGURESSDK50X86 -build shadowconfigure "qtsources" "-confirm-license -xplatform wince50standard-x86-msvc2008 -no-openssl -no-incredibuild-xge -D QT_EVAL" -SectionEnd -Section BUILDSSDK50X86 -build setcepaths "wince50standard-x86-msvc2008" -build bin sub-src -SectionEnd -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2008_ce_evaluation" -copy dest "release_vs2008_ce_evaluation" - -# copy sources to "qtsources" -copy src "qtsources" -delete dir "release_vs2008_ce_evaluation\qtsources" -copy dest "release_vs2008_ce_evaluation\qtsources" -copy all "*" -# NOTE: The eval package must not contain sources. Thus we can only provide -# the binary builds we have to potential customers. -delete destdir "src" -delete destdir "tools" -delete destdir "qmake" -delete destdir "utils" -delete file "configure.exe" -copy dest "qtsources" -copy syncqt - -# copy WIN32 binaries -copy src "build_vs2008_ce_win32_evaluation_________________PADDING_________________" -delete dir "release_vs2008_ce_evaluation\win32binaries" -copy dest "release_vs2008_ce_evaluation\win32binaries" -copy files "bin\*" "bin\" -copy files "lib\*.pdb" "bin\" -#copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "include\Qt\qconfig.h" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" -# copy header files -copy src "qtsources\include" -copy dest "release_vs2008_ce_evaluation\win32binaries\include" -copy all "*" - -copy src "release_vs2008_ce_evaluation\qtsources\doc\html" -copy dest "release_vs2008_ce_evaluation\win32binaries\doc\html" -copy all "*" -copy src "release_vs2008_ce_evaluation\qtsources\doc\qch" -copy dest "release_vs2008_ce_evaluation\win32binaries\doc\qch" -copy all "*" -delete dir "release_vs2008_ce_evaluation\qtsources\doc\html" -#copy all "qch" -delete dir "release_vs2008_ce_evaluation\qtsources\doc\qch" - -# copy WM50 binaries -copy src "build_vs2008_ce_wm50_evaluation_________________PADDING_________________" -delete dir "release_vs2008_ce_evaluation\wm50binaries" -copy dest "release_vs2008_ce_evaluation\wm50binaries" -copy files "bin\*" "bin\" -#copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "lib\*.pdb" "lib\" -copy files "lib\*.dll" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "include\Qt\qconfig.h" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" -# copy header files -copy src "qtsources\include" -copy dest "release_vs2008_ce_evaluation\wm50binaries\include" -copy all "*" - -# copy ssdk50x86 binaries -copy src "build_vs2008_ce_ssdk50x86_evaluation_________________PADDING_________________" -delete dir "release_vs2008_ce_evaluation\ssdk50x86binaries" -copy dest "release_vs2008_ce_evaluation\ssdk50x86binaries" -copy files "bin\*" "bin\" -#copy files "include\*" "include\" -copy files "lib\*.prl" "lib\" -copy files "lib\*.lib" "lib\" -copy files "lib\*.pdb" "lib\" -copy files "lib\*.dll" "lib\" -copy files "mkspecs\*" "mkspecs\" -copy files "plugins\*" "plugins\" -copy file "include\Qt\qconfig.h" -copy file "src\corelib\global\qconfig.h" -copy file ".qmake.cache" -# copy header files -copy src "qtsources\include" -copy dest "release_vs2008_ce_evaluation\ssdk50x86binaries\include" -copy all "*" - -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Evaluation for Windows CE" -installer version "%QT_VERSION%" -installer welcometitle "Welcome to Qt for Windows CE" -installer finishtitle "Completing Qt for Windows CE" -installer output "c:\iwmake\qt-embedded-wince-eval-%QT_VERSION%-vs2008.exe" -installer startmenu "Qt for Windows CE by Nokia v%QT_VERSION% (Eval. VS2008)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" - -installer readmefunction "Show Documentation" - -# ### FIXME: Use start page as soon as assistant allows you to do so previously to loading documentation. -# installer readmestartpage "qthelp://com.trolltech.qt.440/qdoc/wince-with-qt-introduction.html" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2008_ce_evaluation\qtsources" -installer define licensecheck productlist "UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation" -installer define licensecheck wince - -# ### FIXME: Remove once we have proper licenses -#installer licenseFile "%IWMAKE_ROOT%\LICENSE.PREVIEW.COMMERCIAL" - -# msvc options -installer module msvc -installer makeFileList msvc "release_vs2008_ce_evaluation" -#installer buildDir msvc "build_vs2008_ce_win32_evaluation_________________PADDING_________________" -installer buildDir msvc "qtsources" -installer defineDir msvc qtsourcetree "qtsources" -installer define msvc qtsourceinstalldirname "qtsources" -installer defineDir msvc win32buildtree "build_vs2008_ce_win32_evaluation_________________PADDING_________________" -installer define msvc win32buildinstalldirname "win32binaries" -installer defineDir msvc wm50buildtree "build_vs2008_ce_wm50_evaluation_________________PADDING_________________" -installer define msvc wm50buildinstalldirname "wm50binaries" -installer define msvc wm50sdk "wincewm50pocket-msvc2008" -installer define msvc wm50versionpretty "Windows Mobile 5 Pocket" -installer defineDir msvc ssdk50x86buildtree "build_vs2008_ce_ssdk50x86_evaluation_________________PADDING_________________" -installer define msvc ssdk50x86buildinstalldirname "ssdk50x86binaries" -installer define msvc ssdk50x86sdk "wince50standard-x86-msvc2008" -installer define msvc ssdk50x86versionpretty "WinCE standard SDK 5 x86" -installer define msvc vs2008 -#installer define msvc skippatchlicenseinformation - -installer module evaluation -installer module registeruiext - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2008-commercial-vsip.conf b/util/scripts/win-binary/config/vs2008-commercial-vsip.conf deleted file mode 100644 index 01eb71e..0000000 --- a/util/scripts/win-binary/config/vs2008-commercial-vsip.conf +++ /dev/null @@ -1,131 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2008_commercial_vsip_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2008_commercial_vsip_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync vsip -copy extsync debugext -SectionEnd - -#build the binaries -build begin vs2008 "build_vs2008_commercial_vsip_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2008_commercial_vsip" - -copy dest "release_vs2008_commercial_vsip" -copy src "build_vs2008_commercial_vsip_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2008_commercial_vsip" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# moc files (exclude release moc files) -copy filesEx "src\moc_*.cpp" "src\" "release_shared" -copy filesEx "src\*.moc" "src\" "release_shared" - -# qconfig.h -copy file "src\corelib\global\qconfig.h" -copy file "include\QtCore\qconfig.h" -copy file "include\Qt\qconfig.h" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# copy manifest files (vs2008 stuff) -copy all "*.manifest" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Commercial" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-commercial-vsintegration-%QT_VERSION%-vs2008.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (VS2008)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" -installer instdir vsip 1 "Visual Studio Integration:" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -#installer define licensecheck license "LICENSE.PREVIEW.COMMERCIAL" -#installer define licensecheck uslicense "LICENSE.PREVIEW.COMMERCIAL" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2008_commercial_vsip" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" - -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2008_commercial_vsip" -installer makeFileList msvc "release_vs2008_commercial_vsip" -installer buildDir msvc "build_vs2008_commercial_vsip_________________PADDING_________________" -installer define msvc vs2008 - -# vsip options -installer module vsip -installer define vsip version "1.4.0" -installer define vsip no2003 -installer define vsip no2005 - -# help options -installer module help - -# debugext options -installer module debugext - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2008-commercial.conf b/util/scripts/win-binary/config/vs2008-commercial.conf deleted file mode 100644 index dba456e..0000000 --- a/util/scripts/win-binary/config/vs2008-commercial.conf +++ /dev/null @@ -1,113 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2008_commercial_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2008_commercial_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -#build the binaries -build begin vs2008 "build_vs2008_commercial_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2008_commercial" - -copy dest "release_vs2008_commercial" -copy src "build_vs2008_commercial_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2008_commercial" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# moc files (exclude release moc files) -copy filesEx "src\moc_*.cpp" "src\" "release_shared" -copy filesEx "src\*.moc" "src\" "release_shared" - -# qconfig.h -copy file "src\corelib\global\qconfig.h" -copy file "include\QtCore\qconfig.h" -copy file "include\Qt\qconfig.h" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# copy manifest files (vs2008 stuff) -copy all "*.manifest" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Commercial" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-commercial-%QT_VERSION%-vs2008.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (VS2008)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt Installation Directory" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -#installer define licensecheck license "LICENSE.PREVIEW.COMMERCIAL" -#installer define licensecheck uslicense "LICENSE.PREVIEW.COMMERCIAL" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2008_commercial" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|Console|FullSourceEvaluation|Academic|Educational" - -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2008_commercial" -installer makeFileList msvc "release_vs2008_commercial" -installer buildDir msvc "build_vs2008_commercial_________________PADDING_________________" -installer define msvc vs2008 - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vs2008-eval.conf b/util/scripts/win-binary/config/vs2008-eval.conf deleted file mode 100644 index 8f50ad0..0000000 --- a/util/scripts/win-binary/config/vs2008-eval.conf +++ /dev/null @@ -1,127 +0,0 @@ -#extracts the package to buildDir -extract dest "build_vs2008_evaluation_________________PADDING_________________" -Section EXTRACT -extract extUnpack "qt-win-commercial-src-%QT_VERSION%.zip" -extract extPatch "qt-win-evalpatches-src-%QT_VERSION%.zip" -#delete line with "activeqt" in examples.pro file (don't build this) -delete line "build_vs2008_evaluation_________________PADDING_________________\examples\examples.pro" "activeqt" -SectionEnd - -Section GETFILES -copy extsync debugext -SectionEnd - -#build the binaries -build begin vs2008 "build_vs2008_evaluation_________________PADDING_________________" - -Section CONFIGURE -build configure "-confirm-license -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl -D QT_EVAL" -SectionEnd - -Section BUILD -build bin sub-src -build binInDir "tools" -build binInDir "demos" release -build binInDir "examples" release -build dbPlugins -SectionEnd - -build finish - -# organize release files -Section ORGANIZE -delete dir "release_vs2008_evaluation" - -copy dest "release_vs2008_evaluation" -copy src "build_vs2008_evaluation_________________PADDING_________________" - -# extract everything once more -extract dest "release_vs2008_evaluation" -extract unpack "qt-win-commercial-src-%QT_VERSION%.zip" - -# create header files -copy syncqt - -delete destDir "src" -delete destDir "tools" -delete destDir "qmake" - -# phrasebooks & porting .xml file -copy files "tools\linguist\phrasebooks\*.qph" "phrasebooks\" -copy files "tools\porting\src\*.xml" "" - -# copying program database files -copy files "lib\*.pdb" "bin\" -copy files "src\winmain\*.pdb" "src\winmain\" - -# qconfig.h -copy files "src\corelib\global\qconfig.h" "include\Qt\" - -# qconfig.pri -copy file "mkspecs\qconfig.pri" - -# .qmake.cache -copy file ".qmake.cache" - -# default mkspec -copy files "mkspecs\default\*" "mkspecs\default\" - -# copy all binary files -copy all "*.lib" -copy all "*.exe" -copy all "*.dll" - -# copy manifest files (vs2008 stuff) -copy all "*.manifest" - -# .prl files -copy files "lib\*.prl" "lib\" - -# assistant help files -copy all "*.qch" - -# remove unused stuff -delete files "lib\*.dll" -delete file "configure.exe" - -# copy some activeqt stuff needed to compile examples -copy file "src\activeqt\control\qaxserver.rc" -copy file "src\activeqt\control\qaxserver.ico" -copy file "src\activeqt\control\qaxserver.def" -SectionEnd - -Section NSIS -# general installer options -installer begin "Qt Evaluation" -installer version "%QT_VERSION%" -installer output "c:\iwmake\qt-win-eval-%QT_VERSION%-vs2008.exe" -installer startmenu "Qt by Nokia v%QT_VERSION% (Eval. VS2008)" - -installer enable component_page -installer enable directory_page -installer enable startmenu_page - -installer instdir msvc 0 "Qt v%QT_VERSION%:" - -installer runfunction "Run Examples and Demos" -installer readmefunction "Show Documentation" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "release_vs2008_evaluation" -installer define licensecheck productlist "UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation" - -installer module evaluation -installer module registeruiext - -# msvc options -installer module msvc -installer src msvc "release_vs2008_evaluation" -installer makeFileList msvc "release_vs2008_evaluation" -installer buildDir msvc "build_vs2008_evaluation_________________PADDING_________________" -installer define msvc vs2008 - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/config/vsip.conf b/util/scripts/win-binary/config/vsip.conf deleted file mode 100644 index 6ddb23f..0000000 --- a/util/scripts/win-binary/config/vsip.conf +++ /dev/null @@ -1,41 +0,0 @@ -Section GETFILES -copy extsync vsip -copy extsync debugext -SectionEnd - -Section NSIS -installer begin "Qt Visual Studio Integration" -installer version "1.5.0" -installer output "c:\iwmake\qt-vsintegration-1.5.0.exe" -installer startmenu "Qt Visual Studio Integration" -installer readme readme.txt -installer enable component_page -installer enable directory_page -installer enable admin_check -installer enable uninstall_previous -installer enable warn_no_qt_found -installer enable optional_shortcutcreation -installer instdir vsip 0 "Integration Installation Directory" - -# license checking -installer module licensecheck -installer defineDir licensecheck licenseDir "vsip" -installer define licensecheck productlist "Universal|Desktop|DesktopLight|UnsupportedEvaluation|SupportedEvaluation|FullSourceEvaluation|Academic|Educational" - -# vsip options -installer module vsip -installer define vsip version "1.5.0" - -# help options -installer module help - -# debugext options -installer module debugext - -# ui extension registration -installer module registeruiext - -# compile the package -installer compile -installer sign -SectionEnd diff --git a/util/scripts/win-binary/doit/doit_2003.bat b/util/scripts/win-binary/doit/doit_2003.bat deleted file mode 100755 index 433d8fb..0000000 --- a/util/scripts/win-binary/doit/doit_2003.bat +++ /dev/null @@ -1,13 +0,0 @@ -@rem The qt_pkg_setup is a .bat file that must be in your PATH -@rem It should set the proper environment for the compiler requested -call qt_pkg_setup msvc2003 - -c: -cd \installer\win-binary -call iwmake.bat vs2003-commercial >out.txt -ren log.txt log-commercial.txt -call iwmake.bat vs2003-eval >>out.txt -ren log.txt log-eval.txt -pscp -batch -i c:\key1.ppk c:\iwmake\*.exe qt@tirion:public_html/packages/%QT_VERSION% - - diff --git a/util/scripts/win-binary/doit/doit_2005.bat b/util/scripts/win-binary/doit/doit_2005.bat deleted file mode 100755 index 202eeda..0000000 --- a/util/scripts/win-binary/doit/doit_2005.bat +++ /dev/null @@ -1,13 +0,0 @@ -@rem The qt_pkg_setup is a .bat file that must be in your PATH -@rem It should set the proper environment for the compiler requested -call qt_pkg_setup msvc2005 - -c: -cd \installer\win-binary -call iwmake.bat vs2005-commercial >out.txt -ren log.txt log-commercial.txt -call iwmake.bat vs2005-eval >>out.txt -ren log.txt log-eval.txt -pscp -batch -i c:\key1.ppk c:\iwmake\*.exe qt@tirion:public_html/packages/%QT_VERSION% - - diff --git a/util/scripts/win-binary/doit/doit_2008.bat b/util/scripts/win-binary/doit/doit_2008.bat deleted file mode 100755 index c6d4aae..0000000 --- a/util/scripts/win-binary/doit/doit_2008.bat +++ /dev/null @@ -1,12 +0,0 @@ -@rem The qt_pkg_setup is a .bat file that must be in your PATH -@rem It should set the proper environment for the compiler requested -call qt_pkg_setup msvc2008 - -c: -cd \installer\win-binary -call iwmake.bat vs2008-commercial >out.txt -ren log.txt log-commercial.txt -call iwmake.bat vs2008-eval >>out.txt -ren log.txt log-eval.txt -pscp -batch -i c:\key1.ppk c:\iwmake\*.exe qt@tirion:public_html/packages/%QT_VERSION% - diff --git a/util/scripts/win-binary/doit/doit_gcc.bat b/util/scripts/win-binary/doit/doit_gcc.bat deleted file mode 100755 index bc5b6ef..0000000 --- a/util/scripts/win-binary/doit/doit_gcc.bat +++ /dev/null @@ -1,9 +0,0 @@ -@rem The qt_pkg_setup is a .bat file that must be in your PATH -@rem It should set the proper environment for the compiler requested -call qt_pkg_setup mingw - -c: -cd \installer\win-binary -call iwmake.bat mingw-opensource >out.txt -pscp -batch -i c:\key1.ppk c:\iwmake\*.exe qt@tirion:public_html/packages/%QT_VERSION% - diff --git a/util/scripts/win-binary/doit/doit_vc60.bat b/util/scripts/win-binary/doit/doit_vc60.bat deleted file mode 100755 index 83f803e..0000000 --- a/util/scripts/win-binary/doit/doit_vc60.bat +++ /dev/null @@ -1,12 +0,0 @@ -@rem The qt_pkg_setup is a .bat file that must be in your PATH -@rem It should set the proper environment for the compiler requested -call qt_pkg_setup msvc60 - -c: -cd \installer\win-binary -call iwmake.bat vc60-commercial >out.txt -ren log.txt log-commercial.txt -call iwmake.bat vc60-eval >>out.txt -ren log.txt log-eval.txt -pscp -batch -i c:\key1.ppk c:\iwmake\*.exe qt@tirion:public_html/packages/%QT_VERSION% - diff --git a/util/scripts/win-binary/doit/doit_wince_2005.bat b/util/scripts/win-binary/doit/doit_wince_2005.bat deleted file mode 100644 index 4cdf3dc..0000000 --- a/util/scripts/win-binary/doit/doit_wince_2005.bat +++ /dev/null @@ -1,13 +0,0 @@ -@rem The qt_pkg_setup is a .bat file that must be in your PATH -@rem It should set the proper environment for the compiler requested -call qt_pkg_setup msvc2005 - -c: -cd \installer\win-binary -call iwmake.bat vs2005-ce-commercial >out.txt -ren log.txt log-commercial.txt -call iwmake.bat vs2005-ce-eval >> out.txt -ren log.txt log-eval.txt -pscp -batch -i c:\key1.ppk c:\iwmake\*.exe qt@tirion:public_html/packages/%QT_VERSION% - - diff --git a/util/scripts/win-binary/doit/doit_wince_2008.bat b/util/scripts/win-binary/doit/doit_wince_2008.bat deleted file mode 100755 index 0b424e4..0000000 --- a/util/scripts/win-binary/doit/doit_wince_2008.bat +++ /dev/null @@ -1,11 +0,0 @@ -@rem The qt_pkg_setup is a .bat file that must be in your PATH -@rem It should set the proper environment for the compiler requested -call qt_pkg_setup msvc2008 - -c: -cd \installer\win-binary -call iwmake.bat vs2008-ce-commercial >out.txt -ren log.txt log-commercial.txt -call iwmake.bat vs2008-ce-eval >> out.txt -ren log.txt log-eval.txt -pscp -batch -i c:\key1.ppk c:\iwmake\*.exe qt@tirion:public_html/packages/%QT_VERSION% diff --git a/util/scripts/win-binary/iwmake.bat b/util/scripts/win-binary/iwmake.bat deleted file mode 100755 index 90c54be..0000000 --- a/util/scripts/win-binary/iwmake.bat +++ /dev/null @@ -1,85 +0,0 @@ -rem @echo off -call :init -if "%QT_VERSION%" == "" goto FAILED -if "%IWMAKE_STATUS%"=="failed" goto FAILED -if not exist "%IWMAKE_SCRIPTDIR%\config\%1.conf" goto FAILED -if not "%~2"=="" set IWMAKE_SECTION=%~2 -for /F "eol=# tokens=1,2*" %%i in (%IWMAKE_SCRIPTDIR%\config\config.default) do set IWMAKE_TMP=%%k& call :func_delegate %%i %%j -if "%IWMAKE_STATUS%"=="failed" goto FAILED -if exist "%IWMAKE_SCRIPTDIR%\config\config.%COMPUTERNAME%" for /F "eol=# tokens=1,2*" %%i in (%IWMAKE_SCRIPTDIR%\config\config.%COMPUTERNAME%) do set IWMAKE_TMP=%%k& call :func_delegate %%i %%j -if "%IWMAKE_STATUS%"=="failed" goto FAILED -call :checkrequirements -if "%IWMAKE_STATUS%"=="failed" goto FAILED -for /F "eol=# tokens=1,2*" %%i in (%IWMAKE_SCRIPTDIR%\config\%1.conf) do set IWMAKE_TMP=%%k& call :func_delegate %%i %%j -if "%IWMAKE_STATUS%"=="failed" goto FAILED -goto DONE - -:func_delegate -if "%IWMAKE_STATUS%"=="failed" goto :eof -set IWMAKE_TMP="%IWMAKE_TMP:"=%" - -if /i "%1"=="sectionend" echo Leaving Section& set IWMAKE_PARSESECTION=1& goto :eof -if /i not "%1"=="section" goto callScript -echo Entering Section %~2 -for %%m in (%IWMAKE_SECTION%) do call :checkSection %%m %~2 -goto :eof - -:callScript -if "%IWMAKE_PARSESECTION%"=="0" goto :eof - -call "%IWMAKE_SCRIPTDIR%\batch\%1.bat" %2 %IWMAKE_TMP% -if not "%errorlevel%"=="0" echo %1 %2 "%IWMAKE_TMP%" failed! >> %IWMAKE_LOGFILE%& set IWMAKE_STATUS=failed -goto :eof - -:checkSection - if /i "%1"=="%2" echo Skipping Section& set IWMAKE_PARSESECTION=0 -goto :eof - -:checkrequirements - if not exist %IWMAKE_ROOT% mkdir %IWMAKE_ROOT% - if not "%IWMAKE_SIGNPATH%"=="" goto CheckSIGNOK - call "%IWMAKE_SCRIPTDIR%\batch\copy.bat" extsync sign - call "%IWMAKE_SCRIPTDIR%\batch\env.bat" signPath "%IWMAKE_ROOT%\sign" -:CheckSIGNOK - if not "%IWMAKE_WGET%"=="" goto CheckWGETOK - call "%IWMAKE_SCRIPTDIR%\batch\copy.bat" extsync wget - call "%IWMAKE_SCRIPTDIR%\batch\env.bat" wgetDir wget -:CheckWGETOK - if exist "%IWMAKE_PERLPATH%\perl.exe" goto CheckPerlOK - set IWMAKE_STATUS=failed - echo Perl not found in %IWMAKE_PERLPATH%! (check your config file) -:CheckPerlOK - if not "%IWMAKE_UNZIPAPP%"=="" goto CheckUNZIPOK - call "%IWMAKE_SCRIPTDIR%\batch\copy.bat" extsync unzip - call "%IWMAKE_SCRIPTDIR%\batch\env.bat" unzipApp "%IWMAKE_ROOT%\unzip\unzip.exe" -:CheckUNZIPOK - if exist "%IWMAKE_NSISPATH%\makensis.exe" goto CheckNSISOK - set IWMAKE_STATUS=failed - echo NSIS not found! (check your config file) -:CheckNSISOK - call "%IWMAKE_SCRIPTDIR%\batch\installer.bat" updateplugins -goto :eof - -:init - set IWMAKE_SCRIPTDIR=%~dp0 - set IWMAKE_SCRIPTDIR=%IWMAKE_SCRIPTDIR:~0,-1% - call "%IWMAKE_SCRIPTDIR%\batch\env.bat" setglobals -goto :eof - -:cleanup - pushd "%IWMAKE_STARTDIR%" - call "%IWMAKE_SCRIPTDIR%\batch\env.bat" removeglobals - popd -goto :eof - -:FAILED - call :cleanup - echo Failed! -goto END - -:DONE - call :cleanup - echo Done! -goto END - -:END diff --git a/util/scripts/win-binary/nsis/confirmpage.ini b/util/scripts/win-binary/nsis/confirmpage.ini deleted file mode 100644 index cf1fdab..0000000 --- a/util/scripts/win-binary/nsis/confirmpage.ini +++ /dev/null @@ -1,19 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=2 - -[Field 1] -Type=Label -Text=The following components will be uninstalled: -Left=1 -Right=298 -Top=1 -Bottom=12 - -[Field 2] -Type=Label -Left=16 -Right=298 -Top=16 -Bottom=136 - diff --git a/util/scripts/win-binary/nsis/eclipse.ini b/util/scripts/win-binary/nsis/eclipse.ini deleted file mode 100644 index 7e715b0..0000000 --- a/util/scripts/win-binary/nsis/eclipse.ini +++ /dev/null @@ -1,60 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=7 - -[Field 1] -Type=Groupbox -Text=MinGW Installation -Left=1 -Right=300 -Top=65 -Bottom=132 - -[Field 2] -Type=Groupbox -Text=Eclipse Installation -Left=1 -Right=300 -Top=8 -Bottom=59 - -[Field 3] -Type=DirRequest -State=C:\MinGW\bin -Left=12 -Right=286 -Top=91 -Bottom=102 - -[Field 4] -Type=Label -Text=Select where MinGW is installed (The directory where gcc.exe is located): -Left=13 -Right=292 -Top=81 -Bottom=89 - -[Field 5] -Type=DirRequest -State=C:\Eclipse -Left=12 -Right=286 -Top=33 -Bottom=46 - -[Field 6] -Type=Label -Text=Select the Eclipse installation you want to use: -Left=12 -Right=180 -Top=22 -Bottom=30 - -[Field 7] -Type=Label -Text=If you don't specify a MinGW location, you will not get a shortcut in you startmenu to start Eclipse with MinGW in your path. -Left=12 -Right=287 -Top=107 -Bottom=124 - diff --git a/util/scripts/win-binary/nsis/envpage.ini b/util/scripts/win-binary/nsis/envpage.ini deleted file mode 100644 index c383592..0000000 --- a/util/scripts/win-binary/nsis/envpage.ini +++ /dev/null @@ -1,36 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=4 - -[Field 1] -Type=Groupbox -Text=Environment variables -Left=0 -Right=299 -Top=6 -Bottom=132 - -[Field 2] -Type=Checkbox -Text=Set environment variables -Left=16 -Right=143 -Top=49 -Bottom=59 - -[Field 3] -Type=Label -Text=Qt requires that a set of environment variables is defined. By checking this option the installer adds these variables globally. -Left=9 -Right=290 -Top=20 -Bottom=40 - -[Field 4] -Type=Label -Text=Warning:\r\nEnabling this option makes the installer change settings in your registry. If you don't want to set these variables automatically, the installer provides a qtvars.bat file which sets the required variables. There is also a shortcut, located in your Qt start menu folder, that opens a Qt environment. The installer will try to remove any existing Qt environment variables if found. -Left=8 -Right=292 -Top=70 -Bottom=121 - diff --git a/util/scripts/win-binary/nsis/gwdownload.ini b/util/scripts/win-binary/nsis/gwdownload.ini deleted file mode 100644 index 9b4ea16..0000000 --- a/util/scripts/win-binary/nsis/gwdownload.ini +++ /dev/null @@ -1,78 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=9 - -[Field 1] -Type=Groupbox -Text=Find MinGW -Left=0 -Right=299 -Top=49 -Bottom=91 - -[Field 2] -Type=Label -Text=Please specify a directory where to find MinGW (for instance: C:\\MinGW). If you do not have MinGW installed, you can let the installer download and install it for you. -Left=2 -Right=298 -Top=1 -Bottom=27 - -[Field 3] -Type=DirRequest -Left=8 -Right=290 -Top=68 -Bottom=81 - -[Field 4] -Type=Groupbox -Text=Download and install MinGW -Left=0 -Right=299 -Top=94 -Bottom=137 - -[Field 5] -Type=Label -Text=Previously installed MinGW: -Left=8 -Right=286 -Top=60 -Bottom=68 - -[Field 6] -Type=DirRequest -Left=8 -Right=290 -Top=116 -Bottom=129 -Flags=DISABLED - -[Field 7] -Type=Label -Text=Installation directory: -Left=8 -Right=124 -Top=107 -Bottom=115 -Flags=DISABLED - -[Field 8] -Type=Checkbox -Text=Download and install minimal MinGW installation. -Left=8 -Right=172 -Top=28 -Bottom=40 -Flags=NOTIFY - -[Field 9] -Type=Link -Text=(http://www.mingw.org) -Left=174 -Right=260 -Top=30 -Bottom=38 -State=http://www.mingw.org - diff --git a/util/scripts/win-binary/nsis/gwmirror.ini b/util/scripts/win-binary/nsis/gwmirror.ini deleted file mode 100644 index 77a0319..0000000 --- a/util/scripts/win-binary/nsis/gwmirror.ini +++ /dev/null @@ -1,27 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=3 - -[Field 1] -Type=Label -Text=Select a mirror where to download MinGW: -Left=0 -Right=211 -Top=0 -Bottom=8 - -[Field 2] -Type=Checkbox -Text=Download MinGW source code. (You don't need this to compile Qt) -Left=4 -Right=296 -Top=124 -Bottom=134 - -[Field 3] -Type=Listbox -Left=0 -Right=299 -Top=9 -Bottom=118 - diff --git a/util/scripts/win-binary/nsis/images/install.ico b/util/scripts/win-binary/nsis/images/install.ico Binary files differdeleted file mode 100644 index 2cbd979..0000000 --- a/util/scripts/win-binary/nsis/images/install.ico +++ /dev/null diff --git a/util/scripts/win-binary/nsis/images/qt-header.bmp b/util/scripts/win-binary/nsis/images/qt-header.bmp Binary files differdeleted file mode 100644 index a5125c9..0000000 --- a/util/scripts/win-binary/nsis/images/qt-header.bmp +++ /dev/null diff --git a/util/scripts/win-binary/nsis/images/qt-wizard-clean.bmp b/util/scripts/win-binary/nsis/images/qt-wizard-clean.bmp Binary files differdeleted file mode 100644 index a4dbe2c..0000000 --- a/util/scripts/win-binary/nsis/images/qt-wizard-clean.bmp +++ /dev/null diff --git a/util/scripts/win-binary/nsis/images/qt-wizard.bmp b/util/scripts/win-binary/nsis/images/qt-wizard.bmp Binary files differdeleted file mode 100644 index 2f697af..0000000 --- a/util/scripts/win-binary/nsis/images/qt-wizard.bmp +++ /dev/null diff --git a/util/scripts/win-binary/nsis/includes/global.nsh b/util/scripts/win-binary/nsis/includes/global.nsh deleted file mode 100644 index 9bc8f0a..0000000 --- a/util/scripts/win-binary/nsis/includes/global.nsh +++ /dev/null @@ -1,204 +0,0 @@ -!include "StrFunc.nsh" -!include "includes\list.nsh" - -${StrCase} -${StrTrimNewLines} -${StrStr} -${StrRep} -${UnStrRep} - -var STARTMENU_STRING -var PRODUCT_UNIQUE_KEY -var RUNNING_AS_ADMIN - -!define QT_VERSION_KEY_NAME "SOFTWARE\Trolltech\Versions" - -!ifndef MODULE_MINGW - !ifdef MODULE_MSVC_VC60 - !define INSTALL_COMPILER "vc60" - !else - !ifdef MODULE_MSVC_VS2002 - !define INSTALL_COMPILER "vs2002" - !else - !ifdef MODULE_MSVC_VS2005 - !define INSTALL_COMPILER "vs2005" - !else - !ifdef MODULE_MSVC_VS2005CE - !define INSTALL_COMPILER "vs2005ce" - !else - !ifdef MODULE_MSVC_VS2008 - !define INSTALL_COMPILER "vs2008" - !else - !ifdef MODULE_MSVC_VS2008CE - !define INSTALL_COMPILER "vs2008ce" - !else - !define INSTALL_COMPILER "vs2003" - !endif - !endif - !endif - !endif - !endif - !endif -!else - !define INSTALL_COMPILER "mingw" -!endif - -var VS_VERSION -var VS_VERSION_SHORT -var ADDIN_INSTDIR -var VSIP_INSTDIR -var HELP_INSTDIR -var ECLIPSE_INSTDIR -var QTJAMBI_INSTDIR -var QTJAMBIECLIPSE_INSTDIR - -; LICENSECHECK -var LICENSE_KEY -var LICENSEE -var LICENSE_PRODUCT -var LICENSE_PLATFORM -var LICENSE_FILE - -; MSVC -!ifdef MODULE_MSVC - !define MSVC_ValidateDirectory - var MSVC_INSTDIR -!endif - -; MINGW -!ifdef MODULE_MINGW - !define MINGW_ValidateDirectory - var MINGW_INSTDIR -!endif - -; QSA -var QSA_INSTDIR - -; QTDIR PAGE -var QTDIR_SELECTED -var COMPILER_SELECTED - -; used by addin7x and vsip -!ifndef MODULE_VSIP_ROOT - !define MODULE_VSIP_ROOT "${INSTALL_ROOT}\vsip" -!endif - -; add to confirm path -var UninstallerConfirmProduct - -Function un.ConfirmOnDelete - exch $0 - push $1 - - push "$0" - push "$UninstallerConfirmProduct" - call un.ItemInList - pop $1 - IntCmp $1 1 ConfirmOnDeleteDone - - strcmp "$UninstallerConfirmProduct" "" 0 +3 - strcpy $UninstallerConfirmProduct "$0" - goto +2 - strcpy $UninstallerConfirmProduct "$UninstallerConfirmProduct$\r$\n$0" - - ConfirmOnDeleteDone: - pop $1 - pop $0 -FunctionEnd - -!macro ConfirmOnRemove REG_KEY PRODUCT_NAME - push $0 - ClearErrors - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "${REG_KEY}" - intcmp $0 1 0 +3 - push "${PRODUCT_NAME}" - call un.ConfirmOnDelete - ClearErrors - pop $0 -!macroend - -!define GLOBAL_SEC_SHORTCUTCREATION_TEXT "Create shortcuts" -!define GLOBAL_SEC_SHORTCUTCREATION_MAX_ID "100" - -Function GetSecShortcutCreationId - push $0 - push $1 - - StrCpy $0 "0" - loopStart: - IntCmp $0 "${GLOBAL_SEC_SHORTCUTCREATION_MAX_ID}" notfound - IntOp $0 $0 + 1 - SectionGetText $0 $1 - StrCmp $1 "${GLOBAL_SEC_SHORTCUTCREATION_TEXT}" done - goto loopStart - - notfound: - StrCpy $0 "-1" - done: - Pop $1 - Exch $0 -FunctionEnd - -Function GetCreateSchortcuts -!ifdef USE_OPTIONAL_SHORTCUTCREATION - Push $0 - Push $1 - Call GetSecShortcutCreationId - Pop $1 - IntCmp $1 -1 setfalse - SectionGetFlags "$1" $0 - IntOp $0 $0 & ${SF_SELECTED} - IntCmp $0 ${SF_SELECTED} settrue setfalse - settrue: - StrCpy $0 true - Goto done - setfalse: - StrCpy $0 false - done: - Pop $1 - Exch $0 -!else ;USE_OPTIONAL_SHORTCUTCREATION - Push true -!endif ;USE_OPTIONAL_SHORTCUTCREATION -FunctionEnd - -!macro CreateConditionalShortCutDirectory DIRECTORY - Push $0 - Call GetCreateSchortcuts - Pop $0 - StrCmp $0 true 0 +2 - CreateDirectory "${DIRECTORY}" - Pop $0 -!macroend - -Function GLOBAL_CreateConditionalShortCutWithParameters - Exch $0 ; PARAMETERS - Exch - Exch $1 ; TARGET - Exch - Exch 2 - Exch $2 ; LINK - Exch 2 - Push $3 - - Call GetCreateSchortcuts - Pop $3 - StrCmp $3 true 0 +2 - CreateShortCut "$2" "$1" "$0" - - Pop $3 - Pop $0 - Pop $1 - Pop $2 -FunctionEnd - -!macro CreateConditionalShortCutWithParameters LINK TARGET PARAMETERS - Push "${LINK}" - Push "${TARGET}" - Push "${PARAMETERS}" - Call GLOBAL_CreateConditionalShortCutWithParameters -!macroend - -!macro CreateConditionalShortCut LINK TARGET - !insertmacro CreateConditionalShortCutWithParameters "${LINK}" "${TARGET}" "" -!macroend diff --git a/util/scripts/win-binary/nsis/includes/help.nsh b/util/scripts/win-binary/nsis/includes/help.nsh deleted file mode 100644 index 797337e..0000000 --- a/util/scripts/win-binary/nsis/includes/help.nsh +++ /dev/null @@ -1,133 +0,0 @@ -!ifndef HELP_INCLUDE -!define HELP_INCLUDE - -; make it as a macro since it's only used twice (about the same overhead) -!macro InstallHelp HELP_PATH HELP_ROOT VS_VERSION - SetOutPath "${HELP_PATH}" - SetOverwrite ifnewer - - File "${MODULE_HELP_ROOT}\h2reg.exe" - File "${MODULE_HELP_ROOT}\h2reg.ini" - File "${MODULE_HELP_ROOT}\${HELP_ROOT}_*.HxS" - File "${MODULE_HELP_ROOT}\${HELP_ROOT}_*C.HxA" - File "${MODULE_HELP_ROOT}\${HELP_ROOT}_*C.HxC" - File "${MODULE_HELP_ROOT}\${HELP_ROOT}_*C.HxT" - File "${MODULE_HELP_ROOT}\${HELP_ROOT}_*KC.HxK" - File "${MODULE_HELP_ROOT}\${HELP_ROOT}_*FC.HxK" - File "${MODULE_HELP_ROOT}\${HELP_ROOT}_h2reg.ini" - - Push $0 - ${If} $VS_VERSION == "2003" - StrCpy $0 "7.1" - ${ElseIf} $VS_VERSION == "2005" - StrCpy $0 "8.0" - ${ElseIf} $VS_VERSION == "2008" - StrCpy $0 "9.0" - ${Else} - StrCpy $0 "" - ${EndIf} - - ${If} $0 != "" - SetOutPath "$COMMONFILES\microsoft shared\VS Help Data\$0\Filters\1033" - File "${MODULE_HELP_ROOT}\qt450.xml" - WriteRegDWORD HKLM "Software\Microsoft\VisualStudio\$0\Help\VisibleFilters" "qt450" 0x00000001 - ${EndIf} - Pop $0 - - !insertmacro InstallHelpInVS ${HELP_ROOT} ${VS_VERSION} -!macroend - -!macro InstallHelpInVS HELP_ROOT VS_VERSION - Push $0 - - Push ${VS_VERSION} - Call GetVSInstallationDir - Pop $0 - StrCmp $0 "" +4 - SetOutPath "$0\HTML\XMLLinks\1033" - SetOverwrite ifnewer - File "${MODULE_HELP_ROOT}\${HELP_ROOT}_*.xml" - ClearErrors - - Pop $0 -!macroend - -!macro RegisterHelp HELP_PATH HELP_ROOT - SetOutPath "${HELP_PATH}" - ClearErrors ; clear the error flag - Push $0 - nsExec::ExecToLog '"${HELP_PATH}\h2reg.exe" -q -r cmdfile="${HELP_PATH}\${HELP_ROOT}_h2reg.ini"' - Pop $0 - StrCmp $0 "error" 0 +2 - MessageBox MB_OK "Cannot register ${HELP_ROOT} help!" - Pop $0 -!macroend - -!macro un.RegisterHelp HELP_PATH HELP_ROOT - ClearErrors ; clear the error flag - IfFileExists "${HELP_PATH}\h2reg.exe" 0 +5 - Push $0 - nsExec::ExecToLog '"${HELP_PATH}\h2reg.exe" -q -u cmdfile="${HELP_PATH}\${HELP_ROOT}_h2reg.ini"' - Pop $0 - StrCmp $0 "error" 0 +3 - MessageBox MB_OK "Cannot unregister ${HELP_ROOT} help!" - SetErrors - Pop $0 -!macroend - -!macro un.InstallHelp HELP_PATH HELP_ROOT VS_VERSION - Delete "${HELP_PATH}\${HELP_ROOT}_h2reg.ini" - Delete "${HELP_PATH}\${HELP_ROOT}_*.HxS" - Delete "${HELP_PATH}\${HELP_ROOT}_*C.HxA" - Delete "${HELP_PATH}\${HELP_ROOT}_*C.HxC" - Delete "${HELP_PATH}\${HELP_ROOT}_*C.HxT" - Delete "${HELP_PATH}\${HELP_ROOT}_*KC.HxK" - Delete "${HELP_PATH}\${HELP_ROOT}_*FC.HxK" - - Push $0 - ${If} $VS_VERSION == "2003" - StrCpy $0 "7.1" - ${ElseIf} $VS_VERSION == "2005" - StrCpy $0 "8.0" - ${ElseIf} $VS_VERSION == "2008" - StrCpy $0 "9.0" - ${Else} - StrCpy $0 "" - ${EndIf} - - ${If} $0 != "" - Delete "$COMMONFILES\microsoft shared\VS Help Data\$0\Filters\qt450.xml" - DeleteRegValue HKLM "Software\Microsoft\VisualStudio\$0\Help\VisibleFilters" "qt450" - ${EndIf} - Pop $0 - - !insertmacro un.InstallHelpInVS ${HELP_ROOT} ${VS_VERSION} -!macroend - -!macro un.InstallHelpInVS HELP_ROOT VS_VERSION - Push $0 - - Push ${VS_VERSION} - Call un.GetVSInstallationDir - - Pop $0 - StrCmp $0 "" +2 0 - Delete "$0\HTML\XMLLinks\1033\${MODULE_HELP_QT_FILE_ROOT}_*.xml" - - ClearErrors - - Pop $0 -!macroend - -Function un.DeleteH2RegFiles - Exch $0 - IfFileExists "$0\*.HxS" DeleteH2RegFiles_Done - Delete "$0\h2reg.exe" - Delete "$0\h2reg.ini" - Delete "$0\h2reg_log.txt" - RMDir "$0" - DeleteH2RegFiles_Done: - Pop $0 -FunctionEnd - -!endif ;HELP_INCLUDE diff --git a/util/scripts/win-binary/nsis/includes/instdir.nsh b/util/scripts/win-binary/nsis/includes/instdir.nsh deleted file mode 100644 index 6e4dab2..0000000 --- a/util/scripts/win-binary/nsis/includes/instdir.nsh +++ /dev/null @@ -1,214 +0,0 @@ -!ifndef INSTDIR_1 - !macro INSTDIR_INITIALIZE - !define MUI_DIRECTORYPAGE_VARIABLE $${INSTDIR_0}_INSTDIR - !ifdef ${INSTDIR_0}_ValidateDirectory - !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "${INSTDIR_0}_ValidateDirectoryFunc" - !endif - !insertmacro MUI_PAGE_DIRECTORY - !macroend - !macro INSTDIR_FUNCTIONS - !macroend - !macro INSTDIR_STARTUP - !macroend -!else -!macro INSTDIR_INITIALIZE - !define INSTDIR_INI_FILE "instdir.ini" - !define INSTDIR_0_DIRFIELD "Field 10" - !define INSTDIR_0_TEXTFIELD "Field 13" - !define INSTDIR_1_DIRFIELD "Field 7" - !define INSTDIR_1_TEXTFIELD "Field 11" - !define INSTDIR_2_DIRFIELD "Field 5" - !define INSTDIR_2_TEXTFIELD "Field 8" - !define INSTDIR_3_DIRFIELD "Field 3" - !define INSTDIR_3_TEXTFIELD "Field 6" - !define INSTDIR_4_DIRFIELD "Field 2" - !define INSTDIR_4_TEXTFIELD "Field 4" - !define INSTDIR_5_DIRFIELD "Field 9" - !define INSTDIR_5_TEXTFIELD "Field 12" - !define INSTDIR_DIRHEIGHT 18 - - Page custom InitInstDirs UpdateInstDirs - - LangString InstDirLicenseTitle ${LANG_ENGLISH} "Installation Directories" - LangString InstDirLicenseTitleDescription ${LANG_ENGLISH} "Select the directories where you want the software installed." -!macroend - -!macro INSTDIR_FUNCTIONS - Function InitInstDirs - push $0 - push $1 - push $2 - push $3 - - !insertmacro MUI_HEADER_TEXT "$(InstDirLicenseTitle)" "$(InstDirLicenseTitleDescription)" - strcpy $0 "129" - -!ifdef INSTDIR_0 - SectionGetFlags ${${INSTDIR_0}_SEC01} $1 -!ifdef ${INSTDIR_0}_SEC02 - SectionGetFlags ${${INSTDIR_0}_SEC02} $3 - IntOp $1 $1 | $3 -!endif - IntOp $2 $1 & 1 ;just care about the first flag - StrCpy $1 "READONLY" - StrCmp "$2" "1" +2 - StrCpy $1 "DISABLED" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Text" "${INSTDIR_0_TEXT}" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "State" $${INSTDIR_0}_INSTDIR -!else - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "Type" "Unknown" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Type" "Unknown" - intop $0 $0 - ${INSTDIR_DIRHEIGHT} -!endif -!ifdef INSTDIR_1 - SectionGetFlags ${${INSTDIR_1}_SEC01} $1 -!ifdef ${INSTDIR_1}_SEC02 - SectionGetFlags ${${INSTDIR_1}_SEC02} $3 - IntOp $1 $1 | $3 -!endif - IntOp $2 $1 & 1 ;just care about the first flag - StrCpy $1 "READONLY" - StrCmp "$2" "1" +2 - StrCpy $1 "DISABLED" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Text" "${INSTDIR_1_TEXT}" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "State" $${INSTDIR_1}_INSTDIR -!else - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "Type" "Unknown" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Type" "Unknown" - intop $0 $0 - ${INSTDIR_DIRHEIGHT} -!endif -!ifdef INSTDIR_2 - SectionGetFlags ${${INSTDIR_2}_SEC01} $1 -!ifdef ${INSTDIR_2}_SEC02 - SectionGetFlags ${${INSTDIR_2}_SEC02} $3 - IntOp $1 $1 | $3 -!endif - IntOp $2 $1 & 1 ;just care about the first flag - StrCpy $1 "READONLY" - StrCmp "$2" "1" +2 - StrCpy $1 "DISABLED" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Text" "${INSTDIR_2_TEXT}" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "State" $${INSTDIR_2}_INSTDIR -!else - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "Type" "Unknown" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Type" "Unknown" - intop $0 $0 - ${INSTDIR_DIRHEIGHT} -!endif -!ifdef INSTDIR_3 - SectionGetFlags ${${INSTDIR_3}_SEC01} $1 -!ifdef ${INSTDIR_3}_SEC02 - SectionGetFlags ${${INSTDIR_3}_SEC02} $3 - IntOp $1 $1 | $3 -!endif - IntOp $2 $1 & 1 ;just care about the first flag - StrCpy $1 "READONLY" - StrCmp "$2" "1" +2 - StrCpy $1 "DISABLED" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Text" "${INSTDIR_3_TEXT}" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "State" $${INSTDIR_3}_INSTDIR -!else - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "Type" "Unknown" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Type" "Unknown" - intop $0 $0 - ${INSTDIR_DIRHEIGHT} -!endif -!ifdef INSTDIR_4 - SectionGetFlags ${${INSTDIR_4}_SEC01} $1 -!ifdef ${INSTDIR_4}_SEC02 - SectionGetFlags ${${INSTDIR_4}_SEC02} $3 - IntOp $1 $1 | $3 -!endif - IntOp $2 $1 & 1 ;just care about the first flag - StrCpy $1 "READONLY" - StrCmp "$2" "1" +2 - StrCpy $1 "DISABLED" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Text" "${INSTDIR_4_TEXT}" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "State" $${INSTDIR_4}_INSTDIR -!else - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "Type" "Unknown" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Type" "Unknown" - intop $0 $0 - ${INSTDIR_DIRHEIGHT} -!endif -!ifdef INSTDIR_5 - SectionGetFlags ${${INSTDIR_5}_SEC01} $1 -!ifdef ${INSTDIR_5}_SEC02 - SectionGetFlags ${${INSTDIR_5}_SEC02} $3 - IntOp $1 $1 | $3 -!endif - IntOp $2 $1 & 1 ;just care about the first flag - StrCpy $1 "READONLY" - StrCmp "$2" "1" +2 - StrCpy $1 "DISABLED" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "Flags" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Text" "${INSTDIR_5_TEXT}" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "State" $${INSTDIR_5}_INSTDIR -!else - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "Type" "Unknown" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Type" "Unknown" - intop $0 $0 - ${INSTDIR_DIRHEIGHT} -!endif - - !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "Field 1" "Bottom" "$0" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${INSTDIR_INI_FILE}" - - pop $3 - pop $2 - pop $1 - pop $0 - FunctionEnd - - Function UpdateInstDirs -!ifdef INSTDIR_0 - !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_0}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "State" - !ifdef ${INSTDIR_0}_ValidateDirectory - call ${INSTDIR_0}_ValidateDirectoryFunc - !endif -!endif -!ifdef INSTDIR_1 - !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_1}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "State" - !ifdef ${INSTDIR_1}_ValidateDirectory - call ${INSTDIR_1}_ValidateDirectoryFunc - !endif -!endif -!ifdef INSTDIR_2 - !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_2}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "State" - !ifdef ${INSTDIR_2}_ValidateDirectory - call ${INSTDIR_2}_ValidateDirectoryFunc - !endif -!endif -!ifdef INSTDIR_3 - !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_3}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "State" - !ifdef ${INSTDIR_3}_ValidateDirectory - call ${INSTDIR_3}_ValidateDirectoryFunc - !endif -!endif -!ifdef INSTDIR_4 - !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_4}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "State" - !ifdef ${INSTDIR_4}_ValidateDirectory - call ${INSTDIR_4}_ValidateDirectoryFunc - !endif -!endif -!ifdef INSTDIR_5 - !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_5}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "State" - !ifdef ${INSTDIR_5}_ValidateDirectory - call ${INSTDIR_5}_ValidateDirectoryFunc - !endif -!endif - FunctionEnd -!macroend - -!macro INSTDIR_STARTUP - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${INSTDIR_INI_FILE}" -!macroend - -!endif ;ifndef INSTDIR_1
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/includes/list.nsh b/util/scripts/win-binary/nsis/includes/list.nsh deleted file mode 100644 index 47d1702..0000000 --- a/util/scripts/win-binary/nsis/includes/list.nsh +++ /dev/null @@ -1,96 +0,0 @@ -!ifndef LIST_INCLUDE -!define LIST_INCLUDE - -; usage: -; push item -; push list -; call ItemInList -; returns 1 or 0 -!macro ItemInList UN -Function ${UN}ItemInList - exch $0 ;list - exch - exch $1 ;item - push $2 ;counter - push $3 ;substr - push $4 ;char - - strcpy $3 "" - strcpy $2 "0" - - loop: - strcpy $4 $0 1 $2 - strcmp "$4" "" atend - intop $2 $2 + 1 - - strcmp "$4" "|" 0 +4 - strcmp "$3" "$1" found - strcpy $3 "" ;reset substr - goto +2 - strcpy $3 "$3$4" ;append char to substr - goto loop - - found: - strcpy $0 "1" - goto done - - atend: - strcmp "$3" "$1" found - strcpy $0 "0" - - done: - pop $4 - pop $3 - pop $2 - pop $1 - exch $0 -FunctionEnd -!macroend - -!insertmacro ItemInList "" -!insertmacro ItemInList "un." - -Function GetItemInList - exch $0 ;list - exch - exch $1 ;index - push $2 ;counter - push $3 ;substr - push $4 ;char - push $5 ;current index - - strcpy $3 "" - strcpy $2 "0" - strcpy $5 "1" - - loop: - strcpy $4 $0 1 $2 - strcmp "$4" "" atend - intop $2 $2 + 1 - - strcmp "$4" "|" 0 +5 - strcmp "$5" "$1" found - strcpy $3 "" ;reset substr - intop $5 $5 + 1 - goto +2 - strcpy $3 "$3$4" ;append char to substr - goto loop - - found: - strcpy $0 "$3" - goto done - - atend: - strcmp "$5" "$1" found - strcpy $0 "" - - done: - pop $5 - pop $4 - pop $3 - pop $2 - pop $1 - exch $0 -FunctionEnd - -!endif ;LIST_INCLUDE
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/includes/qtcommon.nsh b/util/scripts/win-binary/nsis/includes/qtcommon.nsh deleted file mode 100644 index 8ef8207..0000000 --- a/util/scripts/win-binary/nsis/includes/qtcommon.nsh +++ /dev/null @@ -1,547 +0,0 @@ -!ifndef QTCOMMON_INCLUDE -!define QTCOMMON_INCLUDE - -!macro MakeQtDirectory UN -Function ${UN}MakeQtDirectory - exch $0 - - push $0 - push " " #replace - push "-" #with - call ${UN}ReplaceString - pop $0 - - push $0 - push "(" #replace - push "" #with - call ${UN}ReplaceString - pop $0 - - push $0 - push ")" #replace - push "" #with - call ${UN}ReplaceString - pop $0 - - exch $0 -FunctionEnd -!macroend -!insertmacro MakeQtDirectory "" -!insertmacro MakeQtDirectory "un." - -Function DeleteFloatingLicenseProgram - exch $1 - push $0 - - StrCmp $LICENSE_KEY "" end - - ClearErrors - qtnsisext::IsFloatingLicense $LICENSE_KEY - IfErrors end - pop $0 - - StrCmp $0 "1" end - IfFileExists "$1\bin\qtusagereporter.exe" 0 end - Delete "$1\bin\qtusagereporter.exe" - - end: - pop $0 - pop $1 -FunctionEnd - -Function AddStartmenuApplication - exch $0 - IfFileExists "$0\assistant.exe" 0 +2 - CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Assistant.lnk" "$0\assistant.exe" - IfFileExists "$0\designer.exe" 0 +2 - CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Designer.lnk" "$0\designer.exe" - IfFileExists "$0\linguist.exe" 0 +2 - CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Linguist.lnk" "$0\linguist.exe" - IfFileExists "$0\qtdemo.exe" 0 +2 - CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Examples and Demos.lnk" "$0\qtdemo.exe" - IfFileExists "$0\..\README" 0 ReadMeShortCutFinished - IfFileExists "$WINDIR\notepad.exe" +3 - CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk" "$SYSDIR\notepad.exe" "$0\..\README" - goto ReadMeShortCutFinished - CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk" "$WINDIR\notepad.exe" "$0\..\README" - ReadMeShortCutFinished: - pop $0 -FunctionEnd - -Function un.RemoveStartmenuApplication - Delete "$SMPROGRAMS\$STARTMENU_STRING\Assistant.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\Designer.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\Linguist.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\Examples and Demos.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\Qt Readme.lnk" -FunctionEnd - -#patch the licence information -Function PatchLicenseInformation - exch $0 - push $1 - push $2 - - DetailPrint "Patching license information..." - - IfFileExists "$0\src\corelib\global\qconfig.h" 0 +3 - strcpy $2 "$0\src\corelib\global\qconfig.h" - goto PatchLicensee - - IfFileExists "$0\include\Qt\qconfig.h" 0 PatchConfigPriFile - strcpy $2 "$0\include\Qt\qconfig.h" - - PatchLicensee: - push $2 - push '#define QT_PRODUCT_LICENSEE "' - push '#define QT_PRODUCT_LICENSEE "$LICENSEE"$\r$\n' - call PatchLine - - push $2 - push '#define QT_PRODUCT_LICENSE "' - push '#define QT_PRODUCT_LICENSE "$LICENSE_PRODUCT"$\r$\n' - call PatchLine - - push $2 - ${StrCase} $1 "$LICENSE_PRODUCT" "U" - push '# define QT_EDITION QT_EDITION_' - push '# define QT_EDITION QT_EDITION_$1$\r$\n' - call PatchLine - - PatchConfigPriFile: - IfFileExists "$0\mkspecs\qconfig.pri" 0 PatchLicenseProductDone - push "$0\mkspecs\qconfig.pri" - push "QT_EDITION = " - push "QT_EDITION = $LICENSE_PRODUCT$\r$\n" - call PatchLine - - PatchLicenseProductDone: - pop $2 - pop $1 - pop $0 -FunctionEnd - -Function PatchCommonBinaryFiles - Exch $0 ; Qt installation directory - Exch - Exch $1 ; Dll dir name: "bin", "lib"... - Push $2 ; FindFirst/FindNext handle - Push $3 ; Found QtCore*.dll file - - ${If} ${FileExists} "$0\bin\qmake.exe" - DetailPrint "Patching $0\bin\qmake.exe..." - Push $0 - Push "$0\bin\qmake.exe" - Call PatchBinaryPaths - ${EndIf} - - FindFirst $2 $3 "$0\$1\QtCore*.dll" - ${DoWhile} $3 != "" - Push $0 - Push "$0\$1\$3" - DetailPrint "Patching $0\$1\$3..." - Call PatchBinaryPaths - FindNext $2 $3 - ${Loop} - - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -Function PatchBinaryPaths - exch $0 - exch - exch $2 - push $1 - - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_prfxpath=" "qt_prfxpath=$2" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_docspath=" "qt_docspath=$2\doc" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_hdrspath=" "qt_hdrspath=$2\include" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_libspath=" "qt_libspath=$2\lib" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_binspath=" "qt_binspath=$2\bin" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_plugpath=" "qt_plugpath=$2\plugins" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_datapath=" "qt_datapath=$2" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_trnspath=" "qt_trnspath=$2\translations" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_xmplpath=" "qt_xmplpath=$2\examples" -!ifdef MODULE_LICENSECHECK - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_lcnsuser=" "qt_lcnsuser=$LICENSEE" - qtnsisext::PatchBinary /NOUNLOAD $0 "qt_lcnsprod=" "qt_lcnsprod=$LICENSE_PRODUCT" -!endif - qtnsisext::PatchBinary $0 "qt_demopath=" "qt_demopath=$2\demos" - - pop $1 - pop $2 - pop $0 -FunctionEnd - -# Patching the prl files -Function PatchPrlFiles - Exch $0 ; Absolute path to where Qt is (being) installed - Exch - Exch $1 ; Absolute path to where Qt was built - Push $2 ; FindFirst/FindNext handle - Push $3 ; Found *.prl file name - - FindFirst $2 $3 "$0\lib\*.prl" - ${DoWhile} $3 != "" - Push "$0\lib\$3" - Push $1 - Push $0 - Call PatchPath - FindNext $2 $3 - ${Loop} - - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -# -# patch line in text files -# push "qtcore4.prl" #Filename -# push "#define ..." #START WITH -# push "c:\qt" #REPLACE WITH -# call PatchLine -# -Function PatchLine - exch $2 ;replacement line - exch 2 - exch $1 ;Filename - exch - exch $0 ;start with - push $3 ; tmp filename - push $4 ; handle (tmp) - push $5 ; handle (org) - push $6 ; string - - ClearErrors - GetTempFileName $3 - IfErrors done - FileOpen $4 $3 w - IfErrors done - FileOpen $5 $1 r - IfErrors done - -nextline: - FileRead $5 $6 - IfErrors renameFile - push $6 - push $0 - push $2 - call ReplaceLine - pop $6 - FileWrite $4 $6 - goto nextline - -renameFile: - FileClose $4 - FileClose $5 - SetDetailsPrint none - Delete $1 - Rename $3 $1 - SetDetailsPrint both - - done: - pop $6 - pop $5 - pop $4 - pop $3 - pop $0 - pop $1 - pop $2 -FunctionEnd - -# -# replaces a string that starts with something, with another string -# push string -# push "#define ..." #START WITH -# push "c:\qt" #REPLACE WITH -# call ReplaceLine -# pop $0 #new string -# -Function ReplaceLine - exch $2 ;new line - exch 2 - exch $1 ;string - exch - exch $0 ;start with - - push $3 ; tmp string - push $4 ; counter - push $5 ; strlen - - StrCpy $4 "-1" - StrLen $5 $1 - - loop: - IntOp $4 $4 + 1 ;increase counter - StrCpy $3 $1 $4 ;get substring - IntCmp $4 $5 copystring ; check for end - StrCmp $3 $0 done ;start with found - goto loop - - copystring: - StrCpy $2 $1 - goto done - - done: - pop $5 - pop $4 - pop $3 - pop $0 - pop $1 - exch $2 -FunctionEnd - -# -# patch paths in text files -# push "qtcore4.prl" #Filename -# push "c:\compile" #OLD_QTDIR -# push "c:\qt" #QTDIR -# call PatchPath -# -Function PatchPath - exch $2 ;NEW - exch 2 - exch $1 ;Filename - exch - exch $0 ;OLD - push $3 ;readline - push $4 ;file 1 - push $5 ;file 2 - push $6 ;tmpfilename - - push $7 ;forward slash NEW - push $8 ;forward slash OLD - - push $2 - push "\" - push "/" - call ReplaceString - pop $7 - - push $0 - push "\" - push "/" - call ReplaceString - pop $8 - - ClearErrors - GetTempFileName $6 - IfErrors done - FileOpen $5 $6 w - IfErrors done - FileOpen $4 $1 r - IfErrors done - DetailPrint "Patching $1 ($2)..." - -nextline: - FileRead $4 $3 - IfErrors renameFile - push $3 - push $0 - push $2 - call ReplaceString ;replace backward slash path - push $8 - push $7 - call ReplaceString ;replace forward slash path - pop $3 - FileWrite $5 $3 - goto nextline - -renameFile: - FileClose $5 - FileClose $4 - SetDetailsPrint none - Delete $1 - Rename $6 $1 - SetDetailsPrint both - -done: - pop $8 - pop $7 - pop $6 - pop $5 - pop $4 - pop $3 - pop $0 - pop $1 - pop $2 -FunctionEnd - -# -# replaces a string with another string -# push string -# push "c:\qt" #replace -# push "c:\compile" #with -# call ReplaceString -# pop $0 #new string -# -!macro ReplaceString UN -Function ${UN}ReplaceString - exch $2 ;NEW - exch 2 - exch $1 ;string - exch - exch $0 ;OLD - - push $3 ; tmp string - push $4 ; counter - push $5 ; result - - push $6 ; old strlen - - StrCpy $4 "-1" - StrCpy $5 "" - - StrLen $6 $0 - - loop: - IntOp $4 $4 + 1 ;increase counter - StrCpy $3 $1 $6 $4 ;get substring - StrCmp $3 "" done ; check for end - StrCmp $3 $0 replace ;replace if old - StrCpy $3 $1 "1" $4 - StrCpy $5 $5$3 ;append character to result - goto loop - - replace: - StrCpy $5 $5$2 ;insert new qtdir - IntOp $4 $4 + $6 ;increase offset - IntOp $4 $4 - 1 ;decrease offset one more - goto loop - - done: - StrCpy $2 $5 - pop $6 - pop $5 - pop $4 - pop $3 - pop $0 - pop $1 - exch $2 -FunctionEnd -!macroend -!insertmacro ReplaceString "" -!insertmacro ReplaceString "un." - -Function CommonCheckDirectory - exch $4 - exch - exch $5 - push $0 - push $1 - push $2 - push $3 - - ; check if qt is already installed - IfFileExists "$4\bin\qmake.exe" 0 +2 - IfFileExists "$4\uninst.exe" qtExistsError - - ; check if directory is empty - FindFirst $0 $1 "$4\*" - CommonCheckDirectory_FileSearchLoop: - StrCmp $1 "" CommonCheckDirectory_DirDoesNotExist - StrCmp $1 "." CommonCheckDirectory_ContinueSearchLoop - StrCmp $1 ".." CommonCheckDirectory_ContinueSearchLoop - goto CommonCheckDirectory_FoundFile - CommonCheckDirectory_ContinueSearchLoop: - FindNext $0 $1 - goto CommonCheckDirectory_FileSearchLoop - -CommonCheckDirectory_FoundFile: - FindClose $0 - MessageBox MB_YESNO|MB_ICONEXCLAMATION "This directory already has contents. Are you sure you want to use this directory?" IDYES CommonCheckDirectory_DirDoesNotExist - Goto errorInDirectory -CommonCheckDirectory_DirDoesNotExist: - FindClose $0 - - GetInstDirError $0 - IntCmp 0 $0 0 instDirError - - StrLen $0 $4 - -!ifdef USE_NODIRLENGTHCHECK - StrCpy $1 "400" -!else - StrLen $1 $5 -!endif - - IntCmp $1 $0 0 directoryToLong - - ;check for spaces - StrCpy $2 "-1" - StrCpy $3 "" - - loop: - IntOp $2 $2 + 1 ;increase counter - StrCpy $3 $4 "1" $2 ;get char - StrCmp $3 "" directoryOk ; check for end - StrCmp $3 " " spaceInDirectory ;check for space - goto loop - -qtExistsError: - MessageBox MB_OK|MB_ICONEXCLAMATION "Qt is already installed in this directory. Please uninstall the previous version and try again." - Goto errorInDirectory - -instDirError: - MessageBox MB_OK|MB_ICONEXCLAMATION "This is not a valid installation directory." - Goto errorInDirectory - -spaceInDirectory: - MessageBox MB_OK|MB_ICONEXCLAMATION "The installation path can't contain spaces." - Goto errorInDirectory - -directoryToLong: - MessageBox MB_OK|MB_ICONEXCLAMATION "The installation directory is to long." - Goto errorInDirectory - -errorInDirectory: - pop $3 - pop $2 - pop $1 - pop $0 - pop $5 - pop $4 - Abort - goto done - -directoryOk: - pop $3 - pop $2 - pop $1 - pop $0 - pop $5 - pop $4 -done: -FunctionEnd - -# Sets $0 to 0, $1 to 1. Good for checking register breakages in function calls via dumpstate::debug -# Do not leave this in a release installer!!! -Function MarkAllRegisters - StrCpy $0 "0" - StrCpy $1 "1" - StrCpy $2 "2" - StrCpy $3 "3" - StrCpy $4 "4" - StrCpy $5 "5" - StrCpy $6 "6" - StrCpy $7 "7" - StrCpy $8 "8" - StrCpy $9 "9" - StrCpy $R0 "R0" - StrCpy $R1 "R1" - StrCpy $R2 "R2" - StrCpy $R3 "R3" - StrCpy $R4 "R4" - StrCpy $R5 "R5" - StrCpy $R6 "R6" - StrCpy $R7 "R7" - StrCpy $R8 "R8" - StrCpy $R9 "R9" -FunctionEnd - -!endif ;QTCOMMON_INCLUDE
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/includes/qtdir.nsh b/util/scripts/win-binary/nsis/includes/qtdir.nsh deleted file mode 100644 index ac4de3b..0000000 --- a/util/scripts/win-binary/nsis/includes/qtdir.nsh +++ /dev/null @@ -1,120 +0,0 @@ -!macro QTDIR_INITIALIZE - !include "includes\qtenv.nsh" - !include "includes\list.nsh" - !define QTDIR_PAGE "qtdir.ini" - - Page custom QtDirPageEnter QtDirPageExit - - LangString QtDirPageTitle ${LANG_ENGLISH} "Select Qt Version" - LangString QtDirPageDescription ${LANG_ENGLISH} "Select the detected Qt Version, or choose a QTDIR manually." -!macroend - -!macro QTDIR_FUNCTIONS - Function QtDirPageEnter - push $0 - push $1 - push $2 - !insertmacro MUI_HEADER_TEXT "$(QtDirPageTitle)" "$(QtDirPageDescription)" - - StrCpy $2 "" - StrCpy $0 0 - loopHKLM: - EnumRegKey $1 HKLM "SOFTWARE\trolltech\Versions" $0 - StrCmp $1 "" doneHKLM - IntOp $0 $0 + 1 - ReadRegStr $1 HKLM "SOFTWARE\trolltech\Versions\$1\" "InstallDir" - StrCmp $1 "" +2 - StrCpy $2 "$2$1|" - goto loopHKLM - doneHKLM: - - StrCpy $0 0 - loopHKCU: - EnumRegKey $1 HKCU "SOFTWARE\trolltech\Versions" $0 - StrCmp $1 "" doneHKCU - IntOp $0 $0 + 1 - ReadRegStr $1 HKCU "SOFTWARE\trolltech\Versions\$1\" "InstallDir" - StrCmp $1 "" +2 - StrCpy $2 "$2$1|" - goto loopHKCU - doneHKCU: - - StrLen $0 $2 - IntOp $0 $0 - 1 - StrCpy $1 $2 $0 - !insertmacro MUI_INSTALLOPTIONS_WRITE ${QTDIR_PAGE} "Field 3" "ListItems" "$1" - - ExpandEnvStrings $0 "%QTDIR%" - strcmp "$QTDIR_SELECTED" "" 0 noQtDirEnv - strcmp "$0" "%QTDIR%" noQtDirEnv - strcmp "$0" "" noQtDirEnv - strcpy $QTDIR_SELECTED $0 - noQtDirEnv: - - strcmp "$QTDIR_SELECTED" "" 0 noFirstItemInList - push "1" - push "$1" - call GetItemInList - pop $0 - strcpy $QTDIR_SELECTED $0 - !insertmacro MUI_INSTALLOPTIONS_WRITE ${QTDIR_PAGE} "Field 3" "State" "$0" - !insertmacro MUI_INSTALLOPTIONS_WRITE ${QTDIR_PAGE} "Field 5" "State" "$0" - noFirstItemInList: - - !insertmacro MUI_INSTALLOPTIONS_WRITE ${QTDIR_PAGE} "Field 3" "State" "$QTDIR_SELECTED" - !insertmacro MUI_INSTALLOPTIONS_WRITE ${QTDIR_PAGE} "Field 5" "State" "$QTDIR_SELECTED" - - call AutoDetectCompilers - pop $1 - !insertmacro MUI_INSTALLOPTIONS_WRITE ${QTDIR_PAGE} "Field 8" "ListItems" "$1" - - strcmp "$COMPILER_SELECTED" "" 0 noFirstCompilerInList - push "1" - push "$1" - call GetItemInList - pop $0 - strcpy $COMPILER_SELECTED $0 - noFirstCompilerInList: - - !insertmacro MUI_INSTALLOPTIONS_WRITE ${QTDIR_PAGE} "Field 8" "State" "$COMPILER_SELECTED" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${QTDIR_PAGE}" - - pop $2 - pop $1 - pop $0 - FunctionEnd - - Function QtDirPageExit - push $0 - push $1 - push $2 - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${QTDIR_PAGE}" "Settings" "State" - strcmp "$0" "3" 0 NoNotify - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${QTDIR_PAGE}" "Field 3" "State" - FindWindow $2 "#32770" "" $HWNDPARENT - GetDlgItem $1 $2 1204 ;line edit (DirRequest) - SendMessage $1 ${WM_SETTEXT} 0 "STR:$0" - abort - NoNotify: - - !insertmacro MUI_INSTALLOPTIONS_READ $QTDIR_SELECTED "${QTDIR_PAGE}" "Field 5" "State" - IfFileExists "$QTDIR_SELECTED\bin\qmake.exe" +3 - MessageBox MB_OK|MB_ICONEXCLAMATION "This is not a valid QTDIR, please try another one." - abort - - !insertmacro MUI_INSTALLOPTIONS_READ $COMPILER_SELECTED "${QTDIR_PAGE}" "Field 8" "State" - strcmp "$COMPILER_SELECTED" "" 0 +3 - MessageBox MB_OK|MB_ICONEXCLAMATION "Please select a compiler." - abort - - pop $2 - pop $1 - pop $0 - FunctionEnd -!macroend - -!macro QTDIR_STARTUP - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${QTDIR_PAGE}" - strcpy $QTDIR_SELECTED "" - strcpy $COMPILER_SELECTED "" -!macroend
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/includes/qtenv.nsh b/util/scripts/win-binary/nsis/includes/qtenv.nsh deleted file mode 100644 index d1c3bfd..0000000 --- a/util/scripts/win-binary/nsis/includes/qtenv.nsh +++ /dev/null @@ -1,350 +0,0 @@ -!ifndef QTENV_INCLUDE -!define QTENV_INCLUDE - -!include "LogicLib.nsh" - -!macro MAKE_QTVARS_FILE Compiler QtBuildTree WinCESDK - push "${Compiler}" - push "${QtBuildTree}" - push "${WinCESDK}" - call Function_MakeQtVarsFile -!macroend ;MAKE_QTVARS_FILE - -# -# creates a qtvars.bat file in QtBuildTree\bin -# Push "vs2003" ; Compiler -# Push "c:\qt\shadowbuild" ; QtBuildTree -# Push "wincewm60professional-msvc2005" ; WinCESDK. Leave empty if it is not a CE build -# Call MakeQtVarsFile -# -Function Function_MakeQtVarsFile - Exch $0 ; WinCESDK - Exch - Exch $1 ; QtBuildTree - Exch - Exch 2 - Exch $2 ; Compiler - Exch 2 - Push $3 ; qtvars.bat file handle - Push $4 ; GetMkSpec result - Push $5 ; IsExpressVersion result - Push $6 ; GetVSVarsFile result - - Push $2 - Call GetMkSpec - Pop $4 - - CreateDirectory "$1" - CreateDirectory "$1\bin" - ClearErrors - FileOpen $3 "$1\bin\qtvars.bat" w - IfErrors done - FileWrite $3 "@echo off$\r$\n" - FileWrite $3 "rem$\r$\n" - FileWrite $3 "rem This file is generated by the Qt installer$\r$\n" - FileWrite $3 "rem$\r$\n" - FileWrite $3 "$\r$\n" - FileWrite $3 "echo Setting up a Qt environment...$\r$\n" - FileWrite $3 "$\r$\n" - FileWrite $3 "set QTDIR=$1$\r$\n" - FileWrite $3 "echo -- QTDIR set to $1$\r$\n" - FileWrite $3 "set PATH=$1\bin;%PATH%$\r$\n" - FileWrite $3 "echo -- Added $1\bin to PATH$\r$\n" - FileWrite $3 "set QMAKESPEC=$4$\r$\n" - FileWrite $3 "echo -- QMAKESPEC set to $\"$4$\"$\r$\n" - - Push $2 - Call IsExpressVersion - Pop $5 - ${If} $5 != "" - FileWrite $3 "$\r$\n" - FileWrite $3 'regedit /e S$$D$$K$$ "HKEY_LOCAL_MACHINE\Software\Microsoft\MicrosoftSDK"$\r$\n' - FileWrite $3 'if not exist S$$D$$K$$ goto ENDSDK\r$\n' - FileWrite $3 'find "Install Dir" < S$$D$$K$$ > D$$I$$R$$$\r$\n' - FileWrite $3 'del S$$D$$K$$$\r$\n' - FileWrite $3 'for /f "tokens=2 delims==" %%i in (D$$I$$R$$) do call %%i\setenv$\r$\n' - FileWrite $3 'del D$$I$$R$$$\r$\n' - FileWrite $3 ':ENDSDK\r$\n' - ${EndIf} - - Push $2 - Call GetVSVarsFile - Pop $6 - ${If} $6 != "" - FileWrite $3 "$\r$\n" - FileWrite $3 'if not "%1"=="vsvars" goto ENDVSVARS$\r$\n' - FileWrite $3 'call "$6"$\r$\n' - ${If} $0 != "" - FileWrite $3 "call $\"$1\bin\setcepaths.bat$\" $0$\r$\n" - ${EndIf} - FileWrite $3 ":ENDVSVARS$\r$\n" - - FileWrite $3 "$\r$\n" - FileWrite $3 'if not "%1"=="vsstart" goto ENDVSSTART$\r$\n' - FileWrite $3 'call "$6"$\r$\n' - ${If} $0 != "" - FileWrite $3 "call $\"$1\bin\setcepaths.bat$\" $0$\r$\n" - ${EndIf} - ${If} $2 != "vc60" - FileWrite $3 "devenv /useenv$\r$\n" - ${Else} - FileWrite $3 "msdev /useenv$\r$\n" - ${EndIf} - FileWrite $3 ":ENDVSSTART$\r$\n" - ${EndIf} - - FileWrite $3 "$\r$\n" - FileClose $3 - - done: - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $0 - Pop $1 - Pop $2 -FunctionEnd - -Function GetMkSpec - exch $0 - StrCmp $0 "mingw" MINGW - StrCmp $0 "vs2008" VS2008 - StrCmp $0 "vs2008ce" VS2008CE - StrCmp $0 "vs2005" VS2005 - StrCmp $0 "vs2005ce" VS2005CE - StrCmp $0 "vs2003" VS2003 - StrCmp $0 "vs2002" VS2002 - StrCmp $0 "vc60" VS60 - StrCmp $0 "icc" ICC - - MINGW: - pop $0 - push "win32-g++" - goto done - - VS2008: - pop $0 - push "win32-msvc2008" - goto done - - VS2008CE: - pop $0 - push "" - goto done - - VS2005: - pop $0 - push "win32-msvc2005" - goto done - - VS2005CE: - pop $0 - push "" - goto done - - VS2003: - pop $0 - push "win32-msvc2003" - goto done - - VS2002: - pop $0 - push "win32-msvc2002" - goto done - - VS60: - pop $0 - push "win32-msvc" - goto done - - ICC: - pop $0 - push "win32-icc" - goto done - - done: -FunctionEnd - -!define AD_COMPILER_NAME_VS2008 "Visual Studio .NET 2008" -!define AD_COMPILER_NAME_VS2008_EXPRESS "Visual C++ 2008 Express Edition" -!define AD_COMPILER_NAME_VS2005 "Visual Studio .NET 2005" -!define AD_COMPILER_NAME_VS2005_EXPRESS "Visual C++ 2005 Express Edition" -!define AD_COMPILER_NAME_VS2003 "Visual Studio .NET 2003" -!define AD_COMPILER_NAME_VS2002 "Visual Studio .NET 2002" -!define AD_COMPILER_NAME_VC60 "Visual Studio 6.0" -!define AD_COMPILER_NAME_ICC "Intel C++ Compiler" -!define AD_COMPILER_NAME_MINGW "MinGW (Must be in PATH!)" - -Function GetShortCompilerName - exch $0 - - strcmp "$0" "${AD_COMPILER_NAME_VS2008}" 0 +3 - strcpy $0 "vs2008" - goto done - - strcmp "$0" "${AD_COMPILER_NAME_VS2008_EXPRESS}" 0 +3 - strcpy $0 "vs2008" - goto done - - strcmp "$0" "${AD_COMPILER_NAME_VS2005}" 0 +3 - strcpy $0 "vs2005" - goto done - - strcmp "$0" "${AD_COMPILER_NAME_VS2005_EXPRESS}" 0 +3 - strcpy $0 "vs2005" - goto done - - strcmp "$0" "${AD_COMPILER_NAME_VS2003}" 0 +3 - strcpy $0 "vs2003" - goto done - - strcmp "$0" "${AD_COMPILER_NAME_VS2002}" 0 +3 - strcpy $0 "vs2002" - goto done - - strcmp "$0" "${AD_COMPILER_NAME_VC60}" 0 +3 - strcpy $0 "vc60" - goto done - - strcmp "$0" "${AD_COMPILER_NAME_ICC}" 0 +3 - strcpy $0 "icc" - goto done - - strcmp "$0" "${AD_COMPILER_NAME_MINGW}" 0 +3 - strcpy $0 "mingw" - goto done - - strcpy $0 "" ;this is bad! - - done: - exch $0 -FunctionEnd - -# -# returns if a compiler is installed as express version -# push "vs2005" #compiler -# call IsExpressVersion -# -Function IsExpressVersion - exch $1 - push $0 - - StrCpy $0 "" - - StrCmp $1 "vs2005" 0 +2 - ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0" "InstallDir" - - StrCmp $1 "vs2008" 0 +2 - ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\9.0" "InstallDir" - - ClearErrors - exch $0 - exch - pop $1 -FunctionEnd - -Function AutoDetectCompilers - push $0 - push $1 - - strcpy $1 "" - - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\9.0" "InstallDir" - strcmp $0 "" +2 - strcpy $1 "$1${AD_COMPILER_NAME_VS2008}|" - - ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\9.0" "InstallDir" - strcmp $0 "" +2 - strcpy $1 "$1${AD_COMPILER_NAME_VS2009_EXPRESS}|" - - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\8.0" "InstallDir" - strcmp $0 "" +2 - strcpy $1 "$1${AD_COMPILER_NAME_VS2005}|" - - ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0" "InstallDir" - strcmp $0 "" +2 - strcpy $1 "$1${AD_COMPILER_NAME_VS2005_EXPRESS}|" - - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.1" "InstallDir" - strcmp $0 "" +2 - strcpy $1 "$1${AD_COMPILER_NAME_VS2003}|" - - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.0" "InstallDir" - strcmp $0 "" +2 - strcpy $1 "$1${AD_COMPILER_NAME_VS2002}|" - - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\6.0\Setup" "VsCommonDir" - strcmp $0 "" +2 - strcpy $1 "$1${AD_COMPILER_NAME_VC60}|" - - ReadRegStr $0 HKLM "Software\Intel\Compilers\C++\80" "Major Version" - strcmp $0 "" +2 - strcpy $1 "$1${AD_COMPILER_NAME_ICC}|" - - strcpy $1 "$1${AD_COMPILER_NAME_MINGW}" - - exch - pop $0 - exch $1 -FunctionEnd - -Function GetVSVarsFile - exch $1 - push $0 - - StrCmp $1 "vs2008" VS2008 - StrCmp $1 "vs2008ce" VS2008 - StrCmp $1 "vs2005" VS2005 - StrCmp $1 "vs2005ce" VS2005 - StrCmp $1 "vs2003" VS2003 - StrCmp $1 "vs2002" VS2002 - StrCmp $1 "vc60" VS60 - - push "" ;empty string if not found - goto done - - VS2008: - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\9.0\Setup\VS" "ProductDir" - StrCmp $0 "" +1 foundVSDir ; found msvc.net 2008 - - ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\9.0\Setup\VS" "ProductDir" - StrCmp $0 "" +1 foundVSDir ; found msvc.net 2008 express - - VS2005: - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\8.0\Setup\VS" "ProductDir" - StrCmp $0 "" +1 foundVSDir ; found msvc.net 2005 - - ReadRegStr $0 HKLM "Software\Microsoft\VCExpress\8.0\Setup\VS" "ProductDir" - StrCmp $0 "" +1 foundVSDir ; found msvc.net 2005 express - - VS2003: - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.1\Setup\VS" "ProductDir" - StrCmp $0 "" +1 foundVSDir ; found msvc.net 2003 - - VS2002: - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\7.0\Setup\VS" "ProductDir" - StrCmp $0 "" +1 foundVSDir ; found msvc.net 2002 - - VS60: - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++" "ProductDir" - StrCmp $0 "" +1 foundVCDir ; found msvc 6.0 - - push "" ;empty string if not found - goto done - - foundVSDir: - push "$0Common7\Tools\vsvars32.bat" - goto done - - foundVCDir: - push "$0\bin\vcvars32.bat" - - done: - exch - pop $0 - exch - pop $1 -FunctionEnd - -!endif ;QTENV_INCLUDE diff --git a/util/scripts/win-binary/nsis/includes/regsvr.nsh b/util/scripts/win-binary/nsis/includes/regsvr.nsh deleted file mode 100644 index a2369ed..0000000 --- a/util/scripts/win-binary/nsis/includes/regsvr.nsh +++ /dev/null @@ -1,59 +0,0 @@ -!ifndef REGSVR_INCLUDE -!define REGSVR_INCLUDE - -; usage: -; push dll to register -; call RegSvr -Function RegSvr - exch $0 ;filename - push $1 - - ClearErrors - - ; get regsvr location - IfFileExists "$SYSDIR\regsvr32.exe" 0 RegSvrNotFoundError - - DetailPrint "Registering $0..." - nsExec::ExecToLog '"$SYSDIR\regsvr32.exe" /s "$0"' - pop $1 - strcmp "$1" "0" 0 RegSvrFailed - DetailPrint "Registering of $0 succeeded!" - goto RegSvrDone - - RegSvrNotFoundError: - DetailPrint "Could not find regsvr32.exe!" - SetErrors - goto RegSvrDone - - RegSvrFailed: - DetailPrint "Registering of $0 failed!$\r$\n(errorcode: $1)" - SetErrors - goto RegSvrDone - - RegSvrDone: - - pop $1 - pop $0 -FunctionEnd - -; usage: -; push dll to unregister -; call un.RegSvr -Function un.RegSvr - exch $0 ;filename - push $1 - - ; get regsvr location - IfFileExists "$SYSDIR\regsvr32.exe" 0 UnRegSvrDone - - DetailPrint "Unregistering $0..." - nsExec::ExecToLog '"$SYSDIR\regsvr32.exe" /s /u "$0"' - pop $1 - strcmp "$1" "0" 0 UnRegSvrDone - DetailPrint "Unregistering of $0 succeeded!" - UnRegSvrDone: - pop $1 - pop $0 -FunctionEnd - -!endif ;REGSVR_INCLUDE
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/includes/system.nsh b/util/scripts/win-binary/nsis/includes/system.nsh deleted file mode 100644 index 678c32c..0000000 --- a/util/scripts/win-binary/nsis/includes/system.nsh +++ /dev/null @@ -1,364 +0,0 @@ -!ifndef SYSTEM_INCLUDE -!define SYSTEM_INCLUDE - -!define QT4VSADDIN_GUID "{6A7385B4-1D62-46e0-A4E3-AED4475371F0}" - -!define QTVSIP2003_OLD2_GUID "{789202F4-94F5-4f0a-AA00-73295FEBFD68}" -!define QTVSIP2005_OLD2_GUID "{789202F4-94F5-4f0a-AA00-73295FEBFD69}" -!define QTVSIP2008_OLD2_GUID "{7E61B999-F2CC-4DC8-8120-EF2E90FDF713}" - -!define QTVSIP2003_OLD_GUID "{789212F4-94F5-4f0a-AA00-73295FEBFD68}" -!define QTVSIP2005_OLD_GUID "{789212F4-94F5-4f0a-AA00-73295FEBFD69}" -!define QTVSIP2008_OLD_GUID "{789212F4-94F5-4f0a-AA00-73295FEBFD70}" -!define QTVSIP_GUID "{789212F4-94F5-4f0a-AFFE-73295BE14F10}" - -!define QMSNET2002_GUID "{C174ACCD-D856-4B60-9887-0FF9E841E0EC}" -!define QMSNET2003_GUID "{C174ACCE-D857-4B61-9888-0FF9E841E0ED}" -!define QMSNET2005_GUID "{14E98DB4-A232-49a4-8EC1-8CE4F6985C73}" -!define QMSNET2008_GUID "{A40CF53F-35D5-460F-9871-A3F0599309A4}" - -!macro GetVSInstallationDir UN -; Usage: -; -; push "7.0" -; call GetVSInstallationDir -; pop $0 -; -; If the requested VS version can be found, its -; installation directory is returned. -Function ${UN}GetVSInstallationDir - Exch $0 - Push $1 - ReadRegStr $1 HKLM "Software\Microsoft\VisualStudio\$0\Packages\{1B027A40-8F43-11D0-8D11-00A0C91BC942}" "About" - StrCmp $1 "" +2 - ReadRegStr $1 HKLM "Software\Microsoft\VisualStudio\$0" "InstallDir" - StrCpy $0 $1 - StrCmp $0 "" 0 +2 - SetErrors - Pop $1 - Exch $0 -FunctionEnd -!macroend - -!insertmacro GetVSInstallationDir "" -!insertmacro GetVSInstallationDir "un." - - -!macro IsDotNETInstalled UN -; Usage: -; -; push "8.0" -; call IsDotNETInstalled -; pop $0 -; -; $0 contains the path where the .NET framework is installed. -; If not installation can be found $0 is empty. -Function ${UN}IsDotNETInstalled - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - - StrCpy $5 $0 - - ReadRegStr $4 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework" "InstallRoot" - Push $4 - Exch $EXEDIR - Exch $EXEDIR - Pop $4 - - IfFileExists $4 0 noDotNET - StrCpy $0 0 - - EnumStart: - EnumRegKey $2 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework\Policy" $0 - IntOp $0 $0 + 1 - StrCmp $2 "" noDotNET - StrCpy $1 0 - - EnumPolicy: - EnumRegValue $3 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework\Policy\$2" $1 - IntOp $1 $1 + 1 - StrCmp $3 "" EnumStart - - StrCmp $5 "8.0" greaterThan80 - StrCmp $5 "9.0" greaterThan80 testDotNet - greaterThan80: - StrCmp $2 "v2.0" 0 EnumPolicy - - testDotNet: - IfFileExists "$4\$2.$3" foundDotNET EnumPolicy - - noDotNET: - StrCpy $0 0 - Goto done - - foundDotNET: - StrCpy $0 "$4\$2.$3" - - done: - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Exch $0 -FunctionEnd -!macroend - -!insertmacro IsDotNETInstalled "" -!insertmacro IsDotNETInstalled "un." - -!macro IsQt4VSAddinInstalled UN -; Usage: -; -; push "8.0" -; call IsQt4VSAddinInstalled -; pop $0 -Function ${UN}IsQt4VSAddinInstalled - Exch $0 - Push $1 - Push $2 - Push $3 - - StrCmp $0 "8.0" 0 +2 - StrCpy $2 "${QT4VSADDIN_GUID}" - StrCmp $0 "9.0" 0 +2 - StrCpy $2 "${QT4VSADDIN_GUID}" - - StrCpy $3 0 - - ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\NewProjectTemplates\TemplateDirs\$2\/2" "TemplatesDir" - StrCmp $1 "" +3 - StrCpy $3 1 - goto done - - ReadRegStr $1 HKCU "SOFTWARE\Microsoft\VisualStudio\$0\NewProjectTemplates\TemplateDirs\$2\/2" "TemplatesDir" - StrCmp $1 "" +2 - StrCpy $3 1 - -done: - StrCpy $0 $3 - - Pop $3 - Pop $2 - Pop $1 - Exch $0 -FunctionEnd -!macroend - -!insertmacro IsQt4VSAddinInstalled "" -!insertmacro IsQt4VSAddinInstalled "un." - - -!macro IsQMsNetInstalled UN -; Usage: -; -; push "8.0" -; call IsQMsNetInstalled -; pop $0 -Function ${UN}IsQMsNetInstalled - Exch $0 - Push $1 - Push $2 - Push $3 - - StrCmp $0 "7.0" 0 +2 - StrCpy $2 "${QMSNET2002_GUID}" - StrCmp $0 "7.1" 0 +2 - StrCpy $2 "${QMSNET2003_GUID}" - StrCmp $0 "8.0" 0 +2 - StrCpy $2 "${QMSNET2005_GUID}" - StrCmp $0 "9.0" 0 +2 - StrCpy $2 "${QMSNET2008_GUID}" - - StrCpy $3 0 - - ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\NewProjectTemplates\TemplateDirs\$2\/2" "TemplatesDir" - StrCmp $1 "" +3 - StrCpy $3 1 - goto done - - ReadRegStr $1 HKCU "SOFTWARE\Microsoft\VisualStudio\$0\NewProjectTemplates\TemplateDirs\$2\/2" "TemplatesDir" - StrCmp $1 "" +2 - StrCpy $3 1 - -done: - StrCpy $0 $3 - - Pop $3 - Pop $2 - Pop $1 - Exch $0 -FunctionEnd -!macroend - -!insertmacro IsQMsNetInstalled "" -!insertmacro IsQMsNetInstalled "un." - -!macro IsQMsDevInstalled UN -; Usage: -; -; call IsQMsDevInstalled -; pop $0 -Function ${UN}IsQMsDevInstalled - Push $0 - Push $1 - Push $2 - - StrCpy $0 0 - - ReadRegStr $1 HKLM "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "Filename" - StrCmp $1 "" +3 - StrCpy $0 1 - goto done - - ReadRegStr $1 HKCU "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "Filename" - StrCmp $1 "" +2 - StrCpy $0 1 - -done: - Pop $2 - Pop $1 - Exch $0 -FunctionEnd -!macroend - -!insertmacro IsQMsDevInstalled "" -!insertmacro IsQMsDevInstalled "un." - -!macro IsIntegrationInstalled UN -; Usage: -; -; push "8.0" -; call IsIntegrationInstalled -; pop $0 -Function ${UN}IsIntegrationInstalled - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - - StrCpy $2 "${QTVSIP_GUID}" - StrCmp $0 "7.1" 0 +3 - StrCpy $3 "${QTVSIP2003_OLD_GUID}" - StrCpy $4 "${QTVSIP2003_OLD2_GUID}" - StrCmp $0 "8.0" 0 +3 - StrCpy $3 "${QTVSIP2005_OLD_GUID}" - StrCpy $4 "${QTVSIP2005_OLD2_GUID}" - StrCmp $0 "9.0" 0 +3 - StrCpy $3 "${QTVSIP2008_OLD_GUID}" - StrCpy $4 "${QTVSIP2008_OLD2_GUID}" - - StrCpy $0 0 - - ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\Packages\$2" "ProductName" - StrCmp $1 "" +3 - StrCpy $0 1 - goto done - - ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\Packages\$3" "ProductName" - StrCmp $1 "" +3 - StrCpy $0 1 - goto done - - ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\Packages\$4" "ProductName" - StrCmp $1 "" done - StrCpy $0 1 - -done: - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Exch $0 -FunctionEnd -!macroend - -!insertmacro IsIntegrationInstalled "" -!insertmacro IsIntegrationInstalled "un." - -!macro AdministratorRights UN -Function ${UN}HasAdminRights - push $0 - ClearErrors - UserInfo::GetAccountType - IfErrors Yes ;It's probably Win95 - pop $0 - StrCmp $0 "Admin" Yes - StrCmp $0 "Power" Yes - - StrCpy $0 false - goto Done - - Yes: - StrCpy $0 true - - Done: - exch $0 -FunctionEnd -!macroend -!insertmacro AdministratorRights "" -!insertmacro AdministratorRights "un." - -; Pushes 1 on the stack if VS 2005 SP1 is installed, otherwise 0. -; Usage: -; call IsVS2005SP1Installed -; pop $0 -Function IsVS2005SP1Installed - Push $0 - ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\DevDiv\VS\Servicing\8.0" "SP" - ${If} $0 >= 1 - Pop $0 - Push 1 - Return - ${EndIf} -; try again for Visual Studio 2005 Express - ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\DevDiv\VC\Servicing\8.0" "SP" - ${If} $0 >= 1 - Pop $0 - Push 1 - Return - ${EndIf} - Pop $0 - Push 0 -FunctionEnd - -; Pushes 1 on the stack if .NET 2 SP1 is installed, otherwise 0. -; Usage: -; call IsDotNet2SP1Installed -; pop $0 -Function IsDotNet2SP1Installed - Push $0 - ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" "SP" - ${If} $0 >= 1 - Pop $0 - Push 1 - Return - ${EndIf} - Pop $0 - Push 0 -FunctionEnd - - -; Pushes 1 on the stack if VS 2008 redistributable is installed, otherwise 0. -; Usage: -; call IsVS2008RedistInstalled -; pop $0 -Function IsVS2008RedistInstalled - Push $0 - ClearErrors - ReadRegDword $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}" "Version" - ${If} $0 == 151015966 ; 151015966 = 0x900521e - Pop $0 - Push 1 - Return - ${EndIf} - Pop $0 - Push 0 -FunctionEnd - -!endif ;SYSTEM_INCLUDE diff --git a/util/scripts/win-binary/nsis/includes/templates.nsh b/util/scripts/win-binary/nsis/includes/templates.nsh deleted file mode 100644 index 62c5677..0000000 --- a/util/scripts/win-binary/nsis/includes/templates.nsh +++ /dev/null @@ -1,262 +0,0 @@ -!ifndef TEMPLATE_INCLUDE -!define TEMPLATE_INCLUDE - -Var ProjectInstDir -Var WizardInstDir -Var ItemInstDir - -!macro InstallProjectTemplate SD TT - SetOutPath "$ProjectInstDir" - SetOverwrite ifnewer - - ; Create the vsz file - push ${TT} ;WIZ_NAME - push "$ProjectInstDir" ;PRO_INST_DIR - push "$WizardInstDir" ;WIZ_INST_DIR - call CreateVszFile - - File "${SD}\${TT}.ico" - File "${SD}\${TT}.vsdir" - - CreateDirectory "$WizardInstDir\${TT}" - - CreateDirectory "$WizardInstDir\${TT}\1033" - SetOutPath "$WizardInstDir\${TT}\1033" - SetOverwrite ifnewer - File "${SD}\1033\styles.css" - - CreateDirectory "$WizardInstDir\${TT}\scripts\" - CreateDirectory "$WizardInstDir\${TT}\scripts\1033" - SetOutPath "$WizardInstDir\${TT}\scripts\1033" - SetOverwrite ifnewer - File "${SD}\scripts\1033\default.js" - - CreateDirectory "$WizardInstDir\${TT}\templates" - CreateDirectory "$WizardInstDir\${TT}\templates\1033" - SetOutPath "$WizardInstDir\${TT}\templates\1033" - SetOverwrite ifnewer - File "${SD}\templates\1033\*" - - CreateDirectory "$WizardInstDir\${TT}\images" - SetOutPath "$WizardInstDir\${TT}\images" - SetOverwrite ifnewer - File "${SD}\images\*" - - CreateDirectory "$WizardInstDir\${TT}\html" - CreateDirectory "$WizardInstDir\${TT}\html\1033" - SetOutPath "$WizardInstDir\${TT}\html\1033" - SetOverwrite ifnewer - File "${SD}\html\1033\*" - - CreateDirectory "$WizardInstDir\${TT}\html\1031" - SetOutPath "$WizardInstDir\${TT}\html\1031" - SetOverwrite ifnewer - File /nonfatal "${SD}\html\1031\*" -!macroend - -!macro UnInstallProjectTemplate TT - Delete "$ProjectInstDir\${TT}.vsz" - Delete "$ProjectInstDir\${TT}.ico" - Delete "$ProjectInstDir\${TT}.vsdir" - - Delete "$WizardInstDir\${TT}\1033\styles.css" - RmDir "$WizardInstDir\${TT}\1033" - - Delete "$WizardInstDir\${TT}\scripts\1033\default.js" - RmDir "$WizardInstDir\${TT}\scripts\1033" - RmDir "$WizardInstDir\${TT}\scripts" - - Delete "$WizardInstDir\${TT}\templates\1033\*" - RmDir "$WizardInstDir\${TT}\templates\1033" - RmDir "$WizardInstDir\${TT}\templates" - - Delete "$WizardInstDir\${TT}\images\*" - RmDir "$WizardInstDir\${TT}\images" - - Delete "$WizardInstDir\${TT}\html\1033\*" - RmDir "$WizardInstDir\${TT}\html\1033" - - Delete "$WizardInstDir\${TT}\html\1031\*" - RmDir "$WizardInstDir\${TT}\html\1031" - - RmDir "$WizardInstDir\${TT}\html" - - RmDir "$ProjectInstDir\${TT}" - RmDir "$WizardInstDir\${TT}" -!macroend - -Function InstallProjectTemplates - exch $0 - strcpy $ProjectInstDir "$0\projects\$VS_VERSION_SHORT" - strcpy $WizardInstDir "$0\wizards" - CreateDirectory "$ProjectInstDir" - CreateDirectory "$WizardInstDir" - - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Projects\Qt4GuiProject" "Qt4GuiProject" - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Projects\Qt4ConsoleProject" "Qt4ConsoleProject" - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Projects\Qt4LibProject" "Qt4LibProject" - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Projects\Qt4ActiveQtServerProject" "Qt4ActiveQtServerProject" - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Projects\Qt4DesignerPluginProject" "Qt4DesignerPluginProject" - - # Check whether we have a Qt/WinCE license. - !ifdef MODULE_LICENSECHECK - qtnsisext::IsValidWinCELicense $LICENSE_KEY - IfErrors skipCETemplates - pop $1 - strcmp $1 "0" skipCETemplates - !endif - # Check whether we have VS 2008 or VS 2005. - strcmp "8.0" $VS_VERSION_SHORT installCETemplates 0 - strcmp "9.0" $VS_VERSION_SHORT installCETemplates 0 - goto skipCETemplates - installCETemplates: - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Projects\Qt4WinCEProject" "Qt4WinCEProject" - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Projects\Qt4WinCELibProject" "Qt4WinCELibProject" - skipCETemplates: - - !ifndef MODULE_OLD_ADDIN7X - # install the class wizard - strcpy $ProjectInstDir "$0\wizards\$VS_VERSION_SHORT" ### why do the .vsz file go here? - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Items\Qt4GuiClass" "Qt4GuiClass" - !insertmacro InstallProjectTemplate "${MODULE_VSIP_ROOT}\Items\Qt4Class" "Qt4Class" - !endif - - pop $0 -FunctionEnd - -Function InstallItemTemplates - exch $0 - - !ifdef MODULE_OLD_ADDIN7X - strcpy $ItemInstDir "$0\qt4items" - !else - strcpy $ItemInstDir "$0\uiItems" - !endif - CreateDirectory "$ItemInstDir" - SetOutPath "$ItemInstDir" - SetOverwrite ifnewer - !ifndef MODULE_OLD_ADDIN7X - File "${MODULE_VSIP_ROOT}\Items\uiItems\uiFiles.vsdir" - !endif - File "${MODULE_VSIP_ROOT}\Items\uiItems\newUiDialogButtonsRight.ui" - File "${MODULE_VSIP_ROOT}\Items\uiItems\newUiDialogButtonsBottom.ui" - File "${MODULE_VSIP_ROOT}\Items\uiItems\newUiWidget.ui" - File "${MODULE_VSIP_ROOT}\Items\uiItems\newUiMainWindow.ui" - File "${MODULE_VSIP_ROOT}\Items\uiItems\newUiDialogButtonsRight.ico" - File "${MODULE_VSIP_ROOT}\Items\uiItems\newUiDialogButtonsBottom.ico" - File "${MODULE_VSIP_ROOT}\Items\uiItems\newUiWidget.ico" - File "${MODULE_VSIP_ROOT}\Items\uiItems\newUiMainWindow.ico" - - !ifndef MODULE_OLD_ADDIN7X - strcpy $ItemInstDir "$0\qrcItems" - !endif - CreateDirectory "$ItemInstDir" - SetOutPath "$ItemInstDir" - SetOverwrite ifnewer - !ifndef MODULE_OLD_ADDIN7X - File "${MODULE_VSIP_ROOT}\Items\qrcItems\qrcFiles.vsdir" - !endif - File "${MODULE_VSIP_ROOT}\Items\qrcItems\newQrcFile.qrc" - File "${MODULE_VSIP_ROOT}\Items\qrcItems\newQrcFile.ico" - - pop $0 -FunctionEnd - -Function un.InstallProjectTemplates - exch $0 - strcpy $ProjectInstDir "$0\projects\$VS_VERSION_SHORT" - strcpy $WizardInstDir "$0\wizards" - - !insertmacro UnInstallProjectTemplate "Qt4GuiProject" - !insertmacro UnInstallProjectTemplate "Qt4ConsoleProject" - !insertmacro UnInstallProjectTemplate "Qt4LibProject" - !insertmacro UnInstallProjectTemplate "Qt4ActiveQtServerProject" - !insertmacro UnInstallProjectTemplate "Qt4DesignerPluginProject" - !insertmacro UnInstallProjectTemplate "Qt4WinCEProject" - !insertmacro UnInstallProjectTemplate "Qt4WinCELibProject" - - RmDir "$ProjectInstDir" - RmDir "$0\projects" - - !ifndef MODULE_OLD_ADDIN7X - # install the class wizard - strcpy $ProjectInstDir "$0\wizards\$VS_VERSION_SHORT" - !insertmacro UnInstallProjectTemplate "Qt4GuiClass" - !insertmacro UnInstallProjectTemplate "Qt4Class" - RmDir "$ProjectInstDir" - !endif - - RmDir "$WizardInstDir" - pop $0 -FunctionEnd - -Function un.InstallItemTemplates - exch $0 - - !ifdef MODULE_OLD_ADDIN7X - strcpy $ItemInstDir "$0\qt4items" - !else - strcpy $ItemInstDir "$0\uiItems" - Delete "$ItemInstDir\uiFiles.vsdir" - !endif - Delete "$ItemInstDir\newUiDialogButtonsRight.ui" - Delete "$ItemInstDir\newUiDialogButtonsBottom.ui" - Delete "$ItemInstDir\newUiWidget.ui" - Delete "$ItemInstDir\newUiMainWindow.ui" - Delete "$ItemInstDir\newUiDialogButtonsRight.ico" - Delete "$ItemInstDir\newUiDialogButtonsBottom.ico" - Delete "$ItemInstDir\newUiWidget.ico" - Delete "$ItemInstDir\newUiMainWindow.ico" - RmDir "$ItemInstDir" - - !ifndef MODULE_OLD_ADDIN7X - strcpy $ItemInstDir "$0\qrcItems" - Delete "$ItemInstDir\qrcFiles.vsdir" - !endif - Delete "$ItemInstDir\newQrcFile.qrc" - Delete "$ItemInstDir\newQrcFile.ico" - RmDir "$ItemInstDir" - - pop $0 -FunctionEnd - -# -# usage: -# push WIZ_NAME -# push PRO_INST_DIR -# push WIZ_INST_DIR -# call CreateVszFile -# -Function CreateVszFile - exch $1 ;WIZ_INST_DIR - exch 2 - exch $2 ;WIZ_NAME - exch - exch $3 ;PRO_INST_DIR - push $0 - - ClearErrors - FileOpen $0 "$3\$2.vsz" w - IfErrors done - FileWrite $0 "VSWIZARD 7.0$\r$\n" - -; vs2002 don't use version number at all... -strcmp "$VS_VERSION_SHORT" "7.0" +3 - FileWrite $0 "Wizard=VsWizard.VsWizardEngine.$VS_VERSION_SHORT$\r$\n" -goto +2 - FileWrite $0 "Wizard=VsWizard.VsWizardEngine$\r$\n" - - FileWrite $0 "$\r$\n" - FileWrite $0 'Param="WIZARD_NAME = $2"$\r$\n' - FileWrite $0 'Param="ABSOLUTE_PATH = $1\$2"$\r$\n' - FileWrite $0 'Param="FALLBACK_LCID = 1033"$\r$\n' - FileClose $0 - - done: - pop $0 - pop $3 - pop $2 - pop $1 -FunctionEnd - -!endif ;TEMPLATE_INCLUDE diff --git a/util/scripts/win-binary/nsis/includes/writeEnvStr.nsh b/util/scripts/win-binary/nsis/includes/writeEnvStr.nsh deleted file mode 100644 index 98926d0..0000000 --- a/util/scripts/win-binary/nsis/includes/writeEnvStr.nsh +++ /dev/null @@ -1,138 +0,0 @@ -!ifndef WRITEENVSTR_INCLUDED -!define WRITEENVSTR_INCLUDED - -!include WinMessages.nsh - -!ifdef ALL_USERS - !define WriteEnvStr_RegKey \ - 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' -!else - !define WriteEnvStr_RegKey 'HKCU "Environment"' -!endif - -# -# WriteEnvStr - Writes an environment variable -# Note: Win9x systems requires reboot -# -# Example: -# Push "HOMEDIR" # name -# Push "C:\New Home Dir\" # value -# Call WriteEnvStr -# -Function WriteEnvStr - Exch $1 ; $1 has environment variable value - Exch - Exch $0 ; $0 has environment variable name - Push $2 - - Call IsNT - Pop $2 - StrCmp $2 1 WriteEnvStr_NT - ; Not on NT - StrCpy $2 $WINDIR 2 ; Copy drive of windows (c:) - FileOpen $2 "$2\autoexec.bat" a - FileSeek $2 0 END - FileWrite $2 "$\r$\nSET $0=$1$\r$\n" - FileClose $2 - SetRebootFlag true - Goto WriteEnvStr_done - - WriteEnvStr_NT: - WriteRegExpandStr ${WriteEnvStr_RegKey} $0 $1 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - WriteEnvStr_done: - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -# -# un.DeleteEnvStr - Removes an environment variable -# Note: Win9x systems requires reboot -# -# Example: -# Push "HOMEDIR" # name -# Call un.DeleteEnvStr -# -Function un.DeleteEnvStr - Exch $0 ; $0 now has the name of the variable - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - - Call un.IsNT - Pop $1 - StrCmp $1 1 DeleteEnvStr_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - StrCpy $0 "SET $0=" - SetRebootFlag true - - DeleteEnvStr_dosLoop: - FileRead $1 $3 - StrLen $5 $0 - StrCpy $5 $3 $5 - StrCmp $5 $0 DeleteEnvStr_dosLoop - StrCmp $5 "" DeleteEnvStr_dosLoopEnd - FileWrite $2 $3 - Goto DeleteEnvStr_dosLoop - - DeleteEnvStr_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto DeleteEnvStr_done - - DeleteEnvStr_NT: - DeleteRegValue ${WriteEnvStr_RegKey} $0 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - DeleteEnvStr_done: - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -# -# [un.]IsNT - Pushes 1 if running on NT, 0 if not -# -# Example: -# Call IsNT -# Pop $0 -# StrCmp $0 1 +3 -# MessageBox MB_OK "Not running on NT!" -# Goto +2 -# MessageBox MB_OK "Running on NT!" -# -!macro IsNT UN -Function ${UN}IsNT - Push $0 - ReadRegStr $0 HKLM \ - "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - - IsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd -!macroend -!insertmacro IsNT "" -!insertmacro IsNT "un." - -!endif ;WRITEENVSTR_INCLUDED
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/includes/writePathStr.nsh b/util/scripts/win-binary/nsis/includes/writePathStr.nsh deleted file mode 100644 index 57e6792..0000000 --- a/util/scripts/win-binary/nsis/includes/writePathStr.nsh +++ /dev/null @@ -1,241 +0,0 @@ -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 - -; AddToPath - Adds the given dir to the search path. -; Input - head of the stack -; Note - Win9x systems requires reboot - -Function AddToPath - Exch $0 - Push $1 - Push $2 - Push $3 - - # don't add if the path doesn't exist - IfFileExists $0 "" AddToPath_done - - ReadEnvStr $1 PATH - Push "$1;" - Push "$0;" - Call StringString - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$0\;" - Call StringString - Pop $2 - StrCmp $2 "" "" AddToPath_done - GetFullPathName /SHORT $3 $0 - Push "$1;" - Push "$3;" - Call StringString - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$3\;" - Call StringString - Pop $2 - StrCmp $2 "" "" AddToPath_done - - Call IsNT2 - Pop $1 - StrCmp $1 1 AddToPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" a - FileSeek $1 -1 END - FileReadByte $1 $2 - IntCmp $2 26 0 +2 +2 # DOS EOF - FileSeek $1 -1 END # write over EOF - FileWrite $1 "$\r$\nSET PATH=$3;%PATH%$\r$\n" - FileClose $1 - SetRebootFlag true - Goto AddToPath_done - - AddToPath_NT: - ReadRegStr $1 HKCU "Environment" "PATH" - StrCpy $2 $1 1 -1 # copy last char - StrCmp $2 ";" 0 +2 # if last char == ; - StrCpy $1 $1 -1 # remove last char - StrCmp $1 "" AddToPath_NTdoIt - StrCpy $0 "$0;$1" - AddToPath_NTdoIt: - WriteRegExpandStr HKCU "Environment" "PATH" $0 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - AddToPath_done: - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -; RemoveFromPath - Remove a given dir from the path -; Input: head of the stack - -!macro RemoveFromPath un -Function ${un}RemoveFromPath - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - Push $6 - - IntFmt $6 "%c" 26 # DOS EOF - - Call ${un}IsNT2 - Pop $1 - StrCmp $1 1 unRemoveFromPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - GetFullPathName /SHORT $0 $0 - StrCpy $0 "SET PATH=$0;%PATH%" - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoop: - FileRead $1 $3 - StrCpy $5 $3 1 -1 # read last char - StrCmp $5 $6 0 +2 # if DOS EOF - StrCpy $3 $3 -1 # remove DOS EOF so we can compare - StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "" unRemoveFromPath_dosLoopEnd - FileWrite $2 $3 - Goto unRemoveFromPath_dosLoop - unRemoveFromPath_dosLoopRemoveLine: - SetRebootFlag true - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto unRemoveFromPath_done - - unRemoveFromPath_NT: - ReadRegStr $1 HKCU "Environment" "PATH" - StrCpy $5 $1 1 -1 # copy last char - StrCmp $5 ";" +2 # if last char != ; - StrCpy $1 "$1;" # append ; - Push $1 - Push "$0;" - Call ${un}StringString ; Find `$0;` in $1 - Pop $2 ; pos of our dir - StrCmp $2 "" unRemoveFromPath_done - ; else, it is in path - # $0 - path to add - # $1 - path var - StrLen $3 "$0;" - StrLen $4 $2 - StrCpy $5 $1 -$4 # $5 is now the part before the path to remove - StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove - StrCpy $3 $5$6 - - StrCpy $5 $3 1 -1 # copy last char - StrCmp $5 ";" 0 +2 # if last char == ; - StrCpy $3 $3 -1 # remove last char - - WriteRegExpandStr HKCU "Environment" "PATH" $3 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - unRemoveFromPath_done: - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd -!macroend -!insertmacro RemoveFromPath "" -!insertmacro RemoveFromPath "un." - - -########################################### -# Utility Functions # -########################################### - -; IsNT2 -; no input -; output, top of the stack = 1 if NT or 0 if not -; -; Usage: -; Call IsNT2 -; Pop $R0 -; ($R0 at this point is 1 or 0) - -!macro IsNT2 un -Function ${un}IsNT2 - Push $0 - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT2_yes - ; we are not NT. - Pop $0 - Push 0 - Return - - IsNT2_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd -!macroend -!insertmacro IsNT2 "" -!insertmacro IsNT2 "un." - -; StringString -; input, top of stack = string to search for -; top of stack-1 = string to search in -; output, top of stack (replaces with the portion of the string remaining) -; modifies no other variables. -; -; Usage: -; Push "this is a long ass string" -; Push "ass" -; Call StringString -; Pop $R0 -; ($R0 at this point is "ass string") - -!macro StringString un -Function ${un}StringString -Exch $R1 ; st=haystack,old$R1, $R1=needle - Exch ; st=old$R1,haystack - Exch $R2 ; st=old$R1,old$R2, $R2=haystack - Push $R3 - Push $R4 - Push $R5 - StrLen $R3 $R1 - StrCpy $R4 0 - ; $R1=needle - ; $R2=haystack - ; $R3=len(needle) - ; $R4=cnt - ; $R5=tmp - loop: - StrCpy $R5 $R2 $R3 $R4 - StrCmp $R5 $R1 done - StrCmp $R5 "" done - IntOp $R4 $R4 + 1 - Goto loop -done: - StrCpy $R1 $R2 "" $R4 - Pop $R5 - Pop $R4 - Pop $R3 - Pop $R2 - Exch $R1 -FunctionEnd -!macroend -!insertmacro StringString "" -!insertmacro StringString "un." diff --git a/util/scripts/win-binary/nsis/installer.nsi b/util/scripts/win-binary/nsis/installer.nsi deleted file mode 100644 index e61f00e..0000000 --- a/util/scripts/win-binary/nsis/installer.nsi +++ /dev/null @@ -1,524 +0,0 @@ -; Script generated by the HM NIS Edit Script Wizard. - -SetCompressor /FINAL /SOLID lzma -!include "config.nsh" -!include "includes\global.nsh" - -!define PRODUCT_PUBLISHER "Nokia Corporation and/or its subsidiary(-ies)" -!define PRODUCT_WEB_SITE "http://qtsoftware.com" - -!define INSTALL_ICON "images\install.ico" - -!ifndef WELCOME_ICON - !define WELCOME_ICON "images\qt-wizard.bmp" -!endif -!define PAGE_HEADER_ICON "images\qt-header.bmp" - -!include "MUI.nsh" -!include "FileFunc.nsh" -!insertmacro GetParameters -!insertmacro GetOptions - -; modules -!include "modules\mingw.nsh" -!include "modules\msvc.nsh" -!include "modules\addin7x.nsh" -!include "modules\qsa.nsh" -!include "modules\addin60.nsh" -!include "modules\qtjambi.nsh" -!include "modules\debugext.nsh" -!include "modules\license.nsh" -!include "modules\vsip.nsh" -!include "modules\help.nsh" -!include "modules\registeruiext.nsh" -!include "modules\environment.nsh" -!include "modules\evaluation.nsh" -!include "modules\opensource.nsh" -!include "modules\eclipse.nsh" -!include "modules\qtjambieclipse.nsh" -!include "modules\qtdemo.nsh" -!include "includes\instdir.nsh" - -; MUI Settings -!define MUI_ABORTWARNING -!define MUI_ICON "${INSTALL_ICON}" -!define MUI_UNICON "${INSTALL_ICON}" - -!define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_BITMAP "${PAGE_HEADER_ICON}" -!define MUI_HEADERIMAGE_UNBITMAP "${PAGE_HEADER_ICON}" - -!define MUI_WELCOMEFINISHPAGE_BITMAP "${WELCOME_ICON}" -!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${WELCOME_ICON}" - -!ifdef WELCOME_NOTE - !define MUI_WELCOMEPAGE_TEXT "${WELCOME_NOTE}" -!endif -!ifdef WELCOME_TITLE - !define MUI_WELCOMEPAGE_TITLE "${WELCOME_TITLE}" -!endif -!insertmacro MUI_PAGE_WELCOME -!insertmacro OPENSOURCE_INITIALIZE -!insertmacro EVALUATION_INITIALIZE -!insertmacro LICENSECHECK_INITIALIZE -!insertmacro MSVC_INITIALIZE -!insertmacro ADDIN7X_INITIALIZE -!insertmacro ADDIN60_INITIALIZE -!insertmacro QTJAMBI_INITIALIZE -!insertmacro DEBUGEXT_INITIALIZE -!insertmacro HELP_INITIALIZE -!insertmacro VSIP_INITIALIZE - -!ifdef USE_COMPONENT_PAGE - !insertmacro MUI_PAGE_COMPONENTS -!endif - -!ifdef USE_DIRECTORY_PAGE - !insertmacro INSTDIR_INITIALIZE -!endif - -!ifdef USE_STARTMENU_PAGE - !define MUI_STARTMENUPAGE_NODISABLE - !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${DEFAULT_STARTMENU_STRING}" - !insertmacro MUI_PAGE_STARTMENU 1 $STARTMENU_STRING -!endif - -!insertmacro MINGW_INITIALIZE -!insertmacro QSA_INITIALIZE -!insertmacro ENVIRONMENT_INITIALIZE -!insertmacro REGISTERUIEXT_INITIALIZE -!insertmacro ECLIPSE_INITIALIZE -!insertmacro QTJAMBIECLIPSE_INITIALIZE - -!define MUI_FINISHPAGE_NOAUTOCLOSE - -!insertmacro MUI_PAGE_INSTFILES -!ifdef README_FILE - !define MUI_FINISHPAGE_SHOWREADME ${README_FILE} -!else - !ifdef README_FUNCTION - !define MUI_FINISHPAGE_SHOWREADME - !define MUI_FINISHPAGE_SHOWREADME_TEXT "${README_FUNCTION}" - !define MUI_FINISHPAGE_SHOWREADME_FUNCTION "CommonReadmeFunction" - !endif -!endif -!ifdef RUN_FUNCTION - !define MUI_FINISHPAGE_RUN - !define MUI_FINISHPAGE_RUN_TEXT "${RUN_FUNCTION}" - !define MUI_FINISHPAGE_RUN_FUNCTION "CommonRunFunction" -!endif -!ifdef FINISH_TITLE - !define MUI_FINISHPAGE_TITLE "${FINISH_TITLE}" -!endif -!insertmacro MUI_PAGE_FINISH - -!ifdef WELCOME_TITLE - !define MUI_WELCOMEPAGE_TITLE "${WELCOME_TITLE}" -!endif -!insertmacro MUI_UNPAGE_WELCOME -!define UNINSTALLER_CONFIRM_PAGE "confirmpage.ini" -UninstPage custom un.UninstallerConfirmPage -!insertmacro MUI_UNPAGE_INSTFILES - -!ifdef FINISH_TITLE - !define MUI_FINISHPAGE_TITLE "${FINISH_TITLE}" -!endif -!insertmacro MUI_UNPAGE_FINISH - -!insertmacro MUI_LANGUAGE "English" - -Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile ${OUTPUT_FILE} - -Section -PreCommonSection -!ifdef INSTDIR_0 ;the default one, must exist - strcpy $INSTDIR $${INSTDIR_0}_INSTDIR - ${StrRep} $PRODUCT_UNIQUE_KEY "${PRODUCT_NAME} ${PRODUCT_VERSION} - $INSTDIR" "\" "_" - strcpy $PRODUCT_UNIQUE_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_UNIQUE_KEY" - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_0}_INSTDIR" "$${INSTDIR_0}_INSTDIR" -!endif -!ifdef INSTDIR_1 - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_1}_INSTDIR" "$${INSTDIR_1}_INSTDIR" -!endif -!ifdef INSTDIR_2 - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_2}_INSTDIR" "$${INSTDIR_2}_INSTDIR" -!endif -!ifdef INSTDIR_3 - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_3}_INSTDIR" "$${INSTDIR_3}_INSTDIR" -!endif -!ifdef INSTDIR_4 - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_4}_INSTDIR" "$${INSTDIR_4}_INSTDIR" -!endif -!ifdef INSTDIR_5 - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_5}_INSTDIR" "$${INSTDIR_5}_INSTDIR" -!endif - - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "StartMenu" "$STARTMENU_STRING" - !insertmacro CreateConditionalShortCutDirectory "$SMPROGRAMS\$STARTMENU_STRING" -SectionEnd - -!insertmacro MSVC_SECTIONS -!insertmacro OPENSOURCE_SECTIONS -!insertmacro ADDIN7X_SECTIONS -!insertmacro ADDIN60_SECTIONS -!insertmacro QTJAMBI_SECTIONS -!insertmacro VSIP_SECTIONS -!insertmacro HELP_SECTIONS -!insertmacro DEBUGEXT_SECTIONS -!insertmacro LICENSECHECK_SECTIONS -!insertmacro QSA_SECTIONS -!insertmacro MINGW_SECTIONS -!insertmacro EVALUATION_SECTIONS -!insertmacro ENVIRONMENT_SECTIONS -!insertmacro REGISTERUIEXT_SECTIONS -!insertmacro ECLIPSE_SECTIONS -!insertmacro QTJAMBIECLIPSE_SECTIONS -!insertmacro QTDEMO_SECTIONS - -!ifdef USE_OPTIONAL_SHORTCUTCREATION -Section "Create shortcuts" SEC_SHORTCUTCREATION -SectionEnd -!endif ;USE_OPTIONAL_SHORTCUTCREATION - -!insertmacro INSTDIR_FUNCTIONS - -Section -CommonSection - WriteUninstaller "$INSTDIR\uninst.exe" - - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayName" "$(^Name)" - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "UninstallString" "$INSTDIR\uninst.exe" - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayVersion" "${PRODUCT_VERSION}" - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "URLInfoAbout" "${PRODUCT_WEB_SITE}" - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "Publisher" "${PRODUCT_PUBLISHER}" - - WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" - !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\QtSoftware.com.lnk" "$INSTDIR\${PRODUCT_NAME}.url" - !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\Uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\uninst.exe" - SetOutPath "$INSTDIR" -SectionEnd - -Function CheckLocalLicenseProduct -!ifdef MODULE_LICENSECHECK - !insertmacro QSA_CHECKLICENSEPRODUCT -!endif -FunctionEnd - -Function .onInit - StrCpy $STARTMENU_STRING "${DEFAULT_STARTMENU_STRING}" -!ifdef USE_OPTIONAL_SHORTCUTCREATION - SectionSetText ${SEC_SHORTCUTCREATION} "${GLOBAL_SEC_SHORTCUTCREATION_TEXT}" -!endif ;USE_OPTIONAL_SHORTCUTCREATION - -!ifdef USE_UNINSTALL_PREVIOUS - push "${PRODUCT_NAME}" - call GetExistsPreviousInstallationOfProduct - exch $0 - StrCmp $0 true 0 +3 - MessageBox MB_OK|MB_ICONSTOP "A previous installation of ${PRODUCT_NAME} was detected.$\nPlease uninstall it before running this installer." - Abort - pop $0 -!endif - -!ifdef USE_WARN_NO_QT_FOUND - Push $0 - EnumRegKey $0 HKLM "${QT_VERSION_KEY_NAME}" 0 - StrCmp $0 "" 0 qt_found - EnumRegKey $0 HKCU "${QT_VERSION_KEY_NAME}" 0 - StrCmp $0 "" 0 qt_found - MessageBox MB_OK|MB_ICONEXCLAMATION "No installed Qt package has been detected.$\nPlease make sure that Qt is installed before using the ${PRODUCT_NAME}" - qt_found: - Pop $0 -!endif - - call SetAdminVar - StrCmp "$RUNNING_AS_ADMIN" false 0 common_running_as_admin -!ifdef USE_ADMIN_CHECK - MessageBox MB_OK|MB_ICONSTOP "You need to have administrator rights to install this software!" - Abort -!endif - SetShellVarContext current - goto common_admin_check_done - common_running_as_admin: - SetShellVarContext all - common_admin_check_done: - - Push $0 - Push $1 - ${GetParameters} $0 - ${GetOptions} $0 /LICENSEKEY= $1 - ClearErrors - StrCmp $1 "" +2 - strcpy $LICENSE_KEY "$1" - - ${GetOptions} $0 /LICENSEE= $1 - ClearErrors - StrCmp $1 "" +2 - strcpy $LICENSEE "$1" - - Pop $1 - Pop $0 - - !insertmacro INSTDIR_STARTUP - - !insertmacro LICENSECHECK_STARTUP - !insertmacro ENVIRONMENT_STARTUP - !insertmacro REGISTERUIEXT_STARTUP - !insertmacro MSVC_STARTUP - !insertmacro OPENSOURCE_STARTUP - !insertmacro EVALUATION_STARTUP - !insertmacro ADDIN7X_STARTUP - !insertmacro ADDIN60_STARTUP - !insertmacro QTJAMBI_STARTUP - !insertmacro DEBUGEXT_STARTUP - !insertmacro VSIP_STARTUP - !insertmacro HELP_STARTUP - !insertmacro QSA_STARTUP - !insertmacro MINGW_STARTUP - !insertmacro ECLIPSE_STARTUP - !insertmacro QTJAMBIECLIPSE_STARTUP - !insertmacro QTDEMO_STARTUP -FunctionEnd - -Function .onInstSuccess - !insertmacro LICENSECHECK_FINISH - !insertmacro ENVIRONMENT_FINISH - !insertmacro REGISTERUIEXT_FINISH - !insertmacro MSVC_FINISH - !insertmacro OPENSOURCE_FINISH - !insertmacro EVALUATION_FINISH - !insertmacro ADDIN7X_FINISH - !insertmacro ADDIN60_FINISH - !insertmacro QTJAMBI_FINISH - !insertmacro DEBUGEXT_FINISH - !insertmacro VSIP_FINISH - !insertmacro HELP_FINISH - !insertmacro QSA_FINISH - !insertmacro MINGW_FINISH - !insertmacro ECLIPSE_FINISH - !insertmacro QTJAMBIECLIPSE_FINISH -FunctionEnd - -Function un.onUninstSuccess - !insertmacro LICENSECHECK_UNFINISH - !insertmacro ENVIRONMENT_UNFINISH - !insertmacro REGISTERUIEXT_UNFINISH - !insertmacro MSVC_UNFINISH - !insertmacro OPENSOURCE_UNFINISH - !insertmacro EVALUATION_UNFINISH - !insertmacro ADDIN7X_UNFINISH - !insertmacro ADDIN60_UNFINISH - !insertmacro QTJAMBI_UNFINISH - !insertmacro DEBUGEXT_UNFINISH - !insertmacro VSIP_UNFINISH - !insertmacro HELP_UNFINISH - !insertmacro QSA_UNFINISH - !insertmacro MINGW_UNFINISH - !insertmacro ECLIPSE_UNFINISH - !insertmacro QTJAMBIECLIPSE_UNFINISH -FunctionEnd - -Function un.onInit - call un.SetAdminVar - StrCmp "$RUNNING_AS_ADMIN" false 0 common_running_as_admin -!ifdef USE_ADMIN_CHECK - MessageBox MB_OK|MB_ICONSTOP "You do not have the required access rights to uninstall this package." - Abort -!endif - SetShellVarContext current - goto common_admin_check_done - common_running_as_admin: - SetShellVarContext all - common_admin_check_done: - - ${UnStrRep} $PRODUCT_UNIQUE_KEY "${PRODUCT_NAME} ${PRODUCT_VERSION} - $INSTDIR" "\" "_" - strcpy $PRODUCT_UNIQUE_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_UNIQUE_KEY" - - push $0 - ClearErrors - ReadRegStr $0 SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayName" - IfErrors 0 +3 - MessageBox MB_OK|MB_ICONSTOP "The uninstaller was unable to find the product to uninstall." - Abort - pop $0 - - ReadRegStr $STARTMENU_STRING SHCTX "$PRODUCT_UNIQUE_KEY" "StartMenu" - StrCmp "$STARTMENU_STRING" "" 0 +2 - StrCpy $STARTMENU_STRING "${DEFAULT_STARTMENU_STRING}" - -!ifdef INSTDIR_0 ;the default one, must exist - ReadRegStr $${INSTDIR_0}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_0}_INSTDIR" -!endif -!ifdef INSTDIR_1 - ReadRegStr $${INSTDIR_1}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_1}_INSTDIR" -!endif -!ifdef INSTDIR_2 - ReadRegStr $${INSTDIR_2}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_2}_INSTDIR" -!endif -!ifdef INSTDIR_3 - ReadRegStr $${INSTDIR_3}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_3}_INSTDIR" -!endif -!ifdef INSTDIR_4 - ReadRegStr $${INSTDIR_4}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_4}_INSTDIR" -!endif -!ifdef INSTDIR_5 - ReadRegStr $${INSTDIR_5}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_5}_INSTDIR" -!endif - - !insertmacro LICENSECHECK_UNSTARTUP - !insertmacro ENVIRONMENT_UNSTARTUP - !insertmacro REGISTERUIEXT_UNSTARTUP - !insertmacro MSVC_UNSTARTUP - !insertmacro OPENSOURCE_UNSTARTUP - !insertmacro EVALUATION_UNSTARTUP - !insertmacro ADDIN7X_UNSTARTUP - !insertmacro ADDIN60_UNSTARTUP - !insertmacro QTJAMBI_UNSTARTUP - !insertmacro DEBUGEXT_UNSTARTUP - !insertmacro VSIP_UNSTARTUP - !insertmacro HELP_UNSTARTUP - !insertmacro QSA_UNSTARTUP - !insertmacro MINGW_UNSTARTUP - !insertmacro ECLIPSE_UNSTARTUP - !insertmacro QTJAMBIECLIPSE_UNSTARTUP - - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${UNINSTALLER_CONFIRM_PAGE}" -FunctionEnd - -!insertmacro HELP_UNINSTALL -!insertmacro DEBUGEXT_UNINSTALL -!insertmacro MSVC_UNINSTALL -!insertmacro OPENSOURCE_UNINSTALL -!insertmacro EVALUATION_UNINSTALL -!insertmacro ENVIRONMENT_UNINSTALL -!insertmacro REGISTERUIEXT_UNINSTALL -!insertmacro QSA_UNINSTALL -!insertmacro MINGW_UNINSTALL -!insertmacro ECLIPSE_UNINSTALL -!insertmacro QTJAMBIECLIPSE_UNINSTALL - -Section Uninstall - !insertmacro LICENSECHECK_UNINSTALL - !insertmacro ADDIN7X_UNINSTALL - !insertmacro ADDIN60_UNINSTALL - !insertmacro QTJAMBI_UNINSTALL - !insertmacro VSIP_UNINSTALL - - ; COMMON - Delete "$INSTDIR\${PRODUCT_NAME}.url" - Delete "$INSTDIR\uninst.exe" - Delete "$SMPROGRAMS\$STARTMENU_STRING\Uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\QtSoftware.com.lnk" - - RMDir "$SMPROGRAMS\$STARTMENU_STRING" - RMDir "$INSTDIR" - - DeleteRegKey SHCTX "$PRODUCT_UNIQUE_KEY" -SectionEnd - -Function CommonRunFunction - !insertmacro MSVC_RUN_FUNCTION - !insertmacro QSA_RUN_FUNCTION - !insertmacro MINGW_RUN_FUNCTION - DoneRunFunction: -FunctionEnd - -Function CommonReadmeFunction - !insertmacro MSVC_README_FUNCTION - !insertmacro MINGW_README_FUNCTION - DoneReadmeFunction: -FunctionEnd - -Function un.UninstallerConfirmPage - !insertmacro MUI_HEADER_TEXT "Confirm" "Confirm Uninstallation Directories" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${UNINSTALLER_CONFIRM_PAGE}" "Field 2" "Text" "$UninstallerConfirmProduct" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${UNINSTALLER_CONFIRM_PAGE}" -FunctionEnd - -;pops product name from stack and as result pushes TRUE or FALSE on stack -Function GetExistsPreviousInstallationOfProduct - exch $0 - push $1 - push $2 - push $3 - - StrCpy $1 0 - loop: - EnumRegKey $2 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall $1 - StrCmp $2 "" no_reg_key_found - ${StrStr} $3 $2 $0 - StrCmp $3 $2 reg_key_found - IntOp $1 $1 + 1 - goto loop - - reg_key_found: - push true - goto done - - no_reg_key_found: - push false - - done: - exch - pop $3 - exch - pop $2 - exch - pop $1 - exch - pop $0 -FunctionEnd - -;pops product name from stack -Function WarnIfInstalledProductDetected - exch $0 - push $0 - call GetExistsPreviousInstallationOfProduct - exch $1 - StrCmp $1 true +1 +3 - MessageBox MB_YESNO|MB_ICONQUESTION "An existing installation of $0 was detected.$\nIt is recommended to deinstall $0 before continuing.$\nDo you want to continue this installation nevertheless?" IDYES +2 IDNO +1 - Abort - pop $1 - pop $0 -FunctionEnd - -;sets $RUNNING_AS_ADMIN to true if Admin or Power user -!macro SetAdminVar UN -Function ${UN}SetAdminVar - push $0 - ClearErrors - UserInfo::GetAccountType - IfErrors Admin ;It's probably Win95 - pop $0 - StrCmp $0 "Admin" Admin - StrCmp $0 "Power" Admin - - StrCpy $RUNNING_AS_ADMIN false - goto Done - - Admin: - StrCpy $RUNNING_AS_ADMIN true - - Done: - pop $0 -FunctionEnd -!macroend -!insertmacro SetAdminVar "" -!insertmacro SetAdminVar "un." - -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MSVC_DESCRIPTION - !insertmacro OPENSOURCE_DESCRIPTION - !insertmacro ENVIRONMENT_DESCRIPTION - !insertmacro REGISTERUIEXT_DESCRIPTION - !insertmacro EVALUATION_DESCRIPTION - !insertmacro ADDIN7X_DESCRIPTION - !insertmacro ADDIN60_DESCRIPTION - !insertmacro QTJAMBI_DESCRIPTION - !insertmacro DEBUGEXT_DESCRIPTION - !insertmacro HELP_DESCRIPTION - !insertmacro VSIP_DESCRIPTION - !insertmacro QSA_DESCRIPTION - !insertmacro MINGW_DESCRIPTION - !insertmacro ECLIPSE_DESCRIPTION - !insertmacro QTJAMBIECLIPSE_DESCRIPTION -!insertmacro MUI_FUNCTION_DESCRIPTION_END diff --git a/util/scripts/win-binary/nsis/instdir.ini b/util/scripts/win-binary/nsis/instdir.ini deleted file mode 100644 index 06b75aa..0000000 --- a/util/scripts/win-binary/nsis/instdir.ini +++ /dev/null @@ -1,102 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=13 - -[Field 1] -Type=Groupbox -Text=Installation Directories -Left=0 -Right=299 -Top=6 -Bottom=129 - -[Field 2] -Type=DirRequest -Left=132 -Right=290 -Top=91 -Bottom=104 -Flags=READONLY - -[Field 3] -Type=DirRequest -Left=132 -Right=290 -Top=73 -Bottom=86 -Flags=READONLY - -[Field 4] -Type=Label -Left=9 -Right=130 -Top=92 -Bottom=100 - -[Field 5] -Type=DirRequest -Left=132 -Right=290 -Top=56 -Bottom=68 -Flags=READONLY - -[Field 6] -Type=Label -Left=9 -Right=131 -Top=75 -Bottom=83 - -[Field 7] -Type=DirRequest -Left=132 -Right=290 -Top=38 -Bottom=51 -Flags=READONLY - -[Field 8] -Type=Label -Left=9 -Right=130 -Top=57 -Bottom=65 - -[Field 9] -Type=DirRequest -Left=132 -Right=290 -Top=108 -Bottom=120 -Flags=READONLY - -[Field 10] -Type=DirRequest -Left=132 -Right=290 -Top=20 -Bottom=33 -Flags=READONLY - -[Field 11] -Type=Label -Left=9 -Right=131 -Top=40 -Bottom=48 - -[Field 12] -Type=Label -Left=9 -Right=130 -Top=108 -Bottom=116 - -[Field 13] -Type=Label -Left=9 -Right=130 -Top=22 -Bottom=30 - diff --git a/util/scripts/win-binary/nsis/license.ini b/util/scripts/win-binary/nsis/license.ini deleted file mode 100644 index 7a94ad8..0000000 --- a/util/scripts/win-binary/nsis/license.ini +++ /dev/null @@ -1,70 +0,0 @@ -[Settings] -NumFields=8 - -[Field 1] -Type=Groupbox -Text=Qt License Information -Left=0 -Right=299 -Top=73 -Bottom=123 - -[Field 2] -Type=Text -MaxLen=200 -Left=92 -Right=288 -Top=86 -Bottom=100 - -[Field 3] -Type=text -Left=92 -Right=288 -Top=102 -Bottom=116 -MaxLen=200 -Flags=GROUP - -[Field 4] -Type=Label -Text=If you do not have a license, please contact: -Left=2 -Right=156 -Top=128 -Bottom=136 - -[Field 5] -Type=label -Text=Qt License key: -Left=13 -Right=90 -Top=105 -Bottom=115 -Flags=NOTABSTOP - -[Field 6] -Type=Label -Text=To install this package you need the licensee name and a valid license key for the Qt/Win platform. The key is case-sensitive.\r\n\r\nThe licensee name and license key can be found in your license file. -Left=1 -Right=300 -Top=1 -Bottom=46 - -[Field 7] -Type=Link -Text=sales@trolltech.com -State=mailto:sales@trolltech.com -Left=160 -Right=237 -Top=128 -Bottom=137 - -[Field 8] -Type=Label -Text=Licensee name: -Left=13 -Right=88 -Top=88 -Bottom=99 - diff --git a/util/scripts/win-binary/nsis/licensepage.ini b/util/scripts/win-binary/nsis/licensepage.ini deleted file mode 100644 index e90a32e..0000000 --- a/util/scripts/win-binary/nsis/licensepage.ini +++ /dev/null @@ -1,48 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=5 - -[Field 1] -Type=Text -Flags=MULTILINE|VSCROLL|READONLY -Left=4 -Right=296 -Top=14 -Bottom=89 -State=No license agreement file found. Please contact support. - -[Field 2] -Type=Label -Text=Press Page Down to see the rest of the agreement. -Left=4 -Right=294 -Top=0 -Bottom=8 - -[Field 3] -Type=Label -Text=If you accept the terms of the agreement, select the first option below. You must accept the agreement to install this software. Click Next to continue. -Left=4 -Right=297 -Top=92 -Bottom=111 - -[Field 4] -Type=RadioButton -Text=I &accept the terms in the License Agreement -Flags=GROUP|NOTIFY -Left=4 -Right=299 -Top=120 -Bottom=129 - -[Field 5] -Type=RadioButton -Text=I &do not accept the terms in the License Agreement -State=1 -Left=4 -Right=300 -Top=129 -Bottom=140 -Flags=NOTIFY - diff --git a/util/scripts/win-binary/nsis/modules/addin60.nsh b/util/scripts/win-binary/nsis/modules/addin60.nsh deleted file mode 100644 index 3a82667..0000000 --- a/util/scripts/win-binary/nsis/modules/addin60.nsh +++ /dev/null @@ -1,139 +0,0 @@ -!ifdef MODULE_ADDIN60 -;------------------------------------------------------------------------------------------------ -!macro ADDIN60_INITIALIZE -!ifndef MODULE_ADDIN60_NAME - !define MODULE_ADDIN60_NAME "QMsDev Add-In" -!endif -!ifndef MODULE_ADDIN60_VERSION - !define MODULE_ADDIN60_VERSION ${PRODUCT_VERSION} -!endif -!ifndef MODULE_ADDIN60_ROOT - !define MODULE_ADDIN60_ROOT "${INSTALL_ROOT}\addin60" -!endif - -!define QMSDEV_GUID "{73036FFA-7B76-47d4-999F-0F9424F7DC12}" -!include "includes\regsvr.nsh" - -!macroend ;ADDIN60_INITIALIZE - -;------------------------------------------------------------------------------------------------ -!macro ADDIN60_SECTIONS -SectionGroup "${MODULE_ADDIN60_NAME}" -Section "Visual C++ 6.0" ADDIN60_SEC01 - SetOutPath "$ADDIN_INSTDIR\6.0" - File "${MODULE_ADDIN60_ROOT}\q4msdev.dll" - - call RegisterDevAddin - - SetOutPath "$ADDIN_INSTDIR\6.0" - File "${MODULE_ADDIN60_ROOT}\doc\usage.rtf" - !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\QMsDev Usage.lnk" "$ADDIN_INSTDIR\6.0\usage.rtf" - - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QMsDevInstalled" 1 -SectionEnd -SectionGroupEnd - -Function RegisterDevAddin - push $0 - - ClearErrors - push "$ADDIN_INSTDIR\6.0\q4msdev.dll" - call RegSvr - IfErrors 0 +3 - MessageBox MB_OK|MB_ICONEXCLAMATION "Could not register q4msdev.dll" - goto done - - WriteRegStr HKCU "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "" "0" - WriteRegStr HKCU "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "Filename" "$ADDIN_INSTDIR\6.0\q4msdev.dll" - - ReadRegStr $0 HKCR "CLSID\${QMSDEV_GUID}" "" - WriteRegStr HKCU "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "DisplayName" $0 - - ReadRegStr $0 HKCR "CLSID\${QMSDEV_GUID}\Description" "" - WriteRegStr HKCU "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "Description" $0 - - done: - pop $0 -FunctionEnd - -Function un.RegisterDevAddin - push "$ADDIN_INSTDIR\6.0\q4msdev.dll" - call un.RegSvr - DeleteRegKey HKCU "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" -FunctionEnd -!macroend ;ADDIN60_SECTIONS - -;------------------------------------------------------------------------------------------------ -!macro ADDIN60_DESCRIPTION - !insertmacro MUI_DESCRIPTION_TEXT ${ADDIN60_SEC01} "This installs the QMsDev Add-in ${MODULE_ADDIN60_VERSION} for Visual Studio 6.0" -!macroend - -;------------------------------------------------------------------------------------------------ -!macro ADDIN60_STARTUP - push $0 - SectionSetFlags ${ADDIN60_SEC01} 1 - - Call IsQMsDevInstalled - pop $0 - IntCmp $0 0 +3 - SectionSetFlags ${ADDIN60_SEC01} 16 - MessageBox MB_OK|MB_ICONEXCLAMATION "The installer has detected that a Qt Add-In for Visual Studio 6.0 is already installed.$\r$\nUninstall the previous version before you reinstall it." - - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\6.0\Setup" "VsCommonDir" - strcmp $0 "" 0 +2 - SectionSetFlags ${ADDIN60_SEC01} 16 - - strcpy $ADDIN_INSTDIR "$PROGRAMFILES\Trolltech\QMsAddin" - - pop $0 -!macroend ;ADDIN60_STATUP - -;------------------------------------------------------------------------------------------------ -!macro ADDIN60_FINISH -!macroend - -;------------------------------------------------------------------------------------------------ -!macro ADDIN60_UNSTARTUP - !insertmacro ConfirmOnRemove "QMsDevInstalled" "QMsDev Add-In" -!macroend - -;------------------------------------------------------------------------------------------------ -!macro ADDIN60_UNINSTALL - push $0 - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "QMsDevInstalled" - - intcmp $0 1 0 DoneUnInstall60 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QMsDevInstalled" 0 - call un.RegisterDevAddin - Delete "$ADDIN_INSTDIR\6.0\q4msdev.dll" - Delete "$ADDIN_INSTDIR\6.0\usage.rtf" - Delete "$SMPROGRAMS\$STARTMENU_STRING\QMsDev Usage.lnk" - RmDir "$ADDIN_INSTDIR\6.0" - RmDir "$ADDIN_INSTDIR" - DoneUnInstall60: - pop $0 -!macroend ;ADDIN60_UNINSTALL - -;------------------------------------------------------------------------------------------------ -!macro ADDIN60_UNFINISH -!macroend - -!else ;MODULE_ADDIN60 -!macro ADDIN60_INITIALIZE -!macroend -!macro ADDIN60_SECTIONS -!macroend -!macro ADDIN60_DESCRIPTION -!macroend -!macro ADDIN60_STARTUP -!macroend -!macro ADDIN60_FINISH -!macroend -!macro ADDIN60_UNSTARTUP -!macroend -!macro ADDIN60_UNINSTALL -!macroend -!macro ADDIN60_UNFINISH -!macroend -!endif ;MODULE_ADDIN60 - diff --git a/util/scripts/win-binary/nsis/modules/addin7x.nsh b/util/scripts/win-binary/nsis/modules/addin7x.nsh deleted file mode 100644 index 06016f4..0000000 --- a/util/scripts/win-binary/nsis/modules/addin7x.nsh +++ /dev/null @@ -1,417 +0,0 @@ -!ifdef MODULE_ADDIN7X - -;------------------------------------------------------------------------------------------------ -!macro ADDIN7X_INITIALIZE -!ifndef MODULE_ADDIN7X_NAME - !define MODULE_ADDIN7X_NAME "Qt4 Visual Studio Add-In" -!endif -!ifndef MODULE_ADDIN7X_VERSION - !define MODULE_ADDIN7X_VERSION ${PRODUCT_VERSION} -!endif -!ifndef MODULE_ADDIN7X_ROOT - !define MODULE_ADDIN7X_ROOT "${INSTALL_ROOT}\addin7x" -!endif -!ifndef MODULE_VSIP_ROOT - !error "MODULE_VSIP_ROOT must be in the .conf file..." -!endif - -!include "includes\system.nsh" -!include "includes\templates.nsh" -!include "includes\regsvr.nsh" -!macroend ;ADDIN7X_INITIALIZE - -;------------------------------------------------------------------------------------------------ -!macro ADDIN7X_SECTIONS - -SectionGroup "${MODULE_ADDIN7X_NAME}" - -!ifndef MODULE_ADDIN7X_NO2008 -Section "Visual Studio 2008" ADDIN7X_SEC01 - strcpy $VS_VERSION "2008" - strcpy $VS_VERSION_SHORT "9.0" - - SetOutPath "$ADDIN_INSTDIR\$VS_VERSION_SHORT" - File "${MODULE_ADDIN7X_ROOT}\src\bin2008\Qt4VSAddin.AddIn" - File "${MODULE_ADDIN7X_ROOT}\src\bin2008\Qt4VSAddin.dll" - File "${MODULE_ADDIN7X_ROOT}\src\bin2008\QtProjectLib.dll" - File "${MODULE_ADDIN7X_ROOT}\src\bin2008\QtProjectEngineLib.dll" - File "${MODULE_ADDIN7X_ROOT}\src\bin2008\qmakewrapper1Lib.dll" - WriteRegStr SHCTX "Software\Microsoft\VisualStudio\9.0\AutomationOptions\LookInFolders" "$ADDIN_INSTDIR\$VS_VERSION_SHORT" "" - - !insertmacro InstallHelp "$ADDIN_INSTDIR\help" "qt4vs" "$VS_VERSION_SHORT" - - call InstallCommonFiles - call RegisterAddin - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VSAddin2008" 1 -SectionEnd -!endif - -!ifndef MODULE_ADDIN7X_NO2005 -Section "Visual Studio 2005" ADDIN7X_SEC02 - strcpy $VS_VERSION "2005" - strcpy $VS_VERSION_SHORT "8.0" - - SetOutPath "$ADDIN_INSTDIR\$VS_VERSION_SHORT" - File "${MODULE_ADDIN7X_ROOT}\src\bin2005\Qt4VSAddin.AddIn" - File "${MODULE_ADDIN7X_ROOT}\src\bin2005\Qt4VSAddin.dll" - File "${MODULE_ADDIN7X_ROOT}\src\bin2005\QtProjectLib.dll" - File "${MODULE_ADDIN7X_ROOT}\src\bin2005\QtProjectEngineLib.dll" - File "${MODULE_ADDIN7X_ROOT}\src\bin2005\qmakewrapper1Lib.dll" - - SetOutPath "$ADDIN_INSTDIR\$VS_VERSION_SHORT\en" - File "${MODULE_ADDIN7X_ROOT}\src\bin2005\en\Qt4VSAddin.resources.dll" - - WriteRegStr SHCTX "Software\Microsoft\VisualStudio\8.0\AutomationOptions\LookInFolders" "$ADDIN_INSTDIR\$VS_VERSION_SHORT" "" - - !insertmacro InstallHelp "$ADDIN_INSTDIR\help" "qt4vs" "$VS_VERSION_SHORT" - - call InstallCommonFiles - call RegisterAddin - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VSAddin2005" 1 -SectionEnd -!endif - -SectionGroupEnd - -Function InstallCommonFiles - ; make sure one of the addins is installed - IfFileExists "$ADDIN_INSTDIR\8.0\Qt4VSAddin.dll" installCommon - IfFileExists "$ADDIN_INSTDIR\9.0\Qt4VSAddin.dll" installCommon done - - installCommon: - SetOverwrite ifnewer - - push $ADDIN_INSTDIR - call InstallProjectTemplates - push $ADDIN_INSTDIR - call InstallItemTemplates - - ; Install additional tools and stuff - SetOutPath "$ADDIN_INSTDIR" - File "${MODULE_ADDIN7X_ROOT}\src\common\qmakewrapper1.dll" - File "${MODULE_ADDIN7X_ROOT}\src\common\qrceditor.exe" - File "${MODULE_ADDIN7X_ROOT}\src\common\QtCore4.dll" - File "${MODULE_ADDIN7X_ROOT}\src\common\QtGui4.dll" - File "${MODULE_ADDIN7X_ROOT}\src\common\QtXml4.dll" - - ; register help - IfFileExists "$ADDIN_INSTDIR\help\h2reg.exe" 0 AddinCommonFilesHelp_Done - !insertmacro RegisterHelp "$ADDIN_INSTDIR\help" "qt4vs" - AddinCommonFilesHelp_Done: - - ; Install VC redistributable - Push $0 - Call IsVS2008RedistInstalled - Pop $0 - ${If} $0 == 0 - SetOutPath "$ADDIN_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_VSIP_ROOT}\redist\vcredist_x86.exe" - ExecWait '"$ADDIN_INSTDIR\vcredist_x86.exe" /q' $0 - Delete "$ADDIN_INSTDIR\vcredist_x86.exe" - ${EndIf} - Pop $0 - - SetOverwrite off ;ifnewer - done: -FunctionEnd - -Function RegisterAddin - push $2 - push $3 - - push "$VS_VERSION_SHORT" - call IsDotNETInstalled - Pop $3 - strcpy $2 "$3\regasm.exe" - - ClearErrors - push "$ADDIN_INSTDIR\qmakewrapper1.dll" - call RegSvr - IfErrors 0 Module_Addin_RegisterWizards - MessageBox MB_OK "Can not register qmakewrapper1.dll!" - - Module_Addin_RegisterWizards: - ClearErrors - DetailPrint "Registering the Qt Wizard Engine." - nsExec::ExecToLog '"$2" /codebase "$ADDIN_INSTDIR\$VS_VERSION_SHORT\QtProjectEngineLib.dll"' - pop $3 - strcmp "$3" "error" 0 RegEngineDone - MessageBox MB_OK "Can not register QtProjectEngineLib.dll!" - MessageBox MB_OK '"$2" /codebase "$ADDIN_INSTDIR\$VS_VERSION_SHORT\QtProjectEngineLib.dll"' - RegEngineDone: - - WriteRegStr SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\NewProjectTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "" "Qt4 Projects" - WriteRegDWORD SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\NewProjectTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "SortPriority" 16 - WriteRegStr SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\NewProjectTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "TemplatesDir" "$ADDIN_INSTDIR\projects\$VS_VERSION_SHORT" - WriteRegDWORD SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\NewProjectTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/2" "SortPriority" 16 - - WriteRegStr SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "" "Qt Forms" - WriteRegStr SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "TemplatesDir" "$ADDIN_INSTDIR\uiItems" - WriteRegDWORD SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "SortPriority" 16 - WriteRegStr SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/2" "" "Qt Resources" - WriteRegStr SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/2" "TemplatesDir" "$ADDIN_INSTDIR\qrcItems" - WriteRegDWORD SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/2" "SortPriority" 16 - - WriteRegStr SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEBA-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "" "Qt4 Classes" - WriteRegStr SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEBA-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "TemplatesDir" "$ADDIN_INSTDIR\wizards\$VS_VERSION_SHORT" - WriteRegDWORD SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEBA-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/1" "SortPriority" 16 - WriteRegDWORD SHCTX "SOFTWARE\Microsoft\VisualStudio\$VS_VERSION_SHORT\Projects\{8BC9CEBA-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}\/2" "SortPriority" 16 - - Done: - - pop $3 - pop $2 -FunctionEnd - -Function un.RegisterAddin - push $2 - push $3 - - push "$VS_VERSION_SHORT" - call un.IsDotNETInstalled - Pop $3 - strcpy $2 "$3\regasm.exe" - - ClearErrors - IfFileExists "$ADDIN_INSTDIR\$VS_VERSION_SHORT\QtProjectEngineLib.dll" 0 UnRegEngineDone - nsExec::ExecToLog '"$2" /unregister "$ADDIN_INSTDIR\$VS_VERSION_SHORT\QtProjectEngineLib.dll"' - pop $3 - strcmp "$3" "error" 0 UnRegEngineDone - MessageBox MB_OK "Can not unregister QtProjectEngineLib.dll!" - UnRegEngineDone: - - pop $3 - pop $2 -FunctionEnd - -Function GetVSVersion - push $0 - - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\9.0\Setup\VS" "ProductDir" - StrCmp $0 "" 0 foundVS2008 ; found msvc.net 2008 - - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\8.0\Setup\VS" "ProductDir" - StrCmp $0 "" 0 foundVS2005 ; found msvc.net 2005 - - push "" ;empty string if not found - goto done - - foundVS2008: - push "2008" - goto done - - foundVS2005: - push "2005" - goto done - - done: - exch - pop $0 -FunctionEnd -!macroend ;ADDIN7X_SECTIONS - -;------------------------------------------------------------------------------------------------ -!macro ADDIN7X_DESCRIPTION -!ifdef ADDIN7X_SEC01 - !insertmacro MUI_DESCRIPTION_TEXT ${ADDIN7X_SEC01} "This installs the Qt4 Add-in ${MODULE_ADDIN7X_VERSION} for Visual Studio 2008" -!endif -!ifdef ADDIN7X_SEC02 - !insertmacro MUI_DESCRIPTION_TEXT ${ADDIN7X_SEC02} "This installs the Qt4 Add-in ${MODULE_ADDIN7X_VERSION} for Visual Studio 2005" -!endif -!macroend - -;------------------------------------------------------------------------------------------------ -!macro ADDIN7X_STARTUP - push $0 - push $1 - -!ifdef ADDIN7X_SEC01 - SectionSetFlags ${ADDIN7X_SEC01} 0 -!endif -!ifdef ADDIN7X_SEC02 - SectionSetFlags ${ADDIN7X_SEC02} 0 -!endif - -!ifdef ADDIN7X_SEC02 - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\8.0" "InstallDir" - strcmp $0 "" +3 - SectionSetFlags ${ADDIN7X_SEC02} 1 - goto +2 - SectionSetFlags ${ADDIN7X_SEC02} 16 -!endif - -!ifdef ADDIN7X_SEC01 - ReadRegStr $0 HKLM "Software\Microsoft\VisualStudio\9.0" "InstallDir" - strcmp $0 "" +3 - SectionSetFlags ${ADDIN7X_SEC01} 1 - goto +2 - SectionSetFlags ${ADDIN7X_SEC01} 16 -!endif - - strcpy $ADDIN_INSTDIR "$PROGRAMFILES\Nokia\Qt4VSAddin" - - Push "8.0" - Call IsIntegrationInstalled - Pop $0 - IntCmp $0 1 Addin7x_Warn - - Push "9.0" - Call IsIntegrationInstalled - Pop $0 - IntCmp $0 1 Addin7x_Warn - - Goto Addin7x_Done - Addin7x_Warn: - MessageBox MB_OK|MB_ICONEXCLAMATION "The installer has detected that a version of the Qt Visual Studio Integration is installed.$\r$\nThe Add-In's conflict with the integration." - Addin7x_Done: - - StrCpy $1 "" - Push "8.0" - Call IsQMsNetInstalled - Pop $0 - IntCmp $0 0 +2 - StrCpy $1 "$1$\r$\n - Visual Studio 2005" - - Push "9.0" - Call IsQMsNetInstalled - Pop $0 - IntCmp $0 0 +2 - StrCpy $1 "$1$\r$\n - Visual Studio 2008" - - StrCpy $1 "" - Push "8.0" - Call IsQt4VSAddinInstalled - Pop $0 - IntCmp $0 0 +2 - StrCpy $1 "$1$\r$\n - Visual Studio 2005" - - Push "9.0" - Call IsQt4VSAddinInstalled - Pop $0 - IntCmp $0 0 +2 - StrCpy $1 "$1$\r$\n - Visual Studio 2008" - - StrCmp $1 "" +2 - MessageBox MB_OK|MB_ICONEXCLAMATION "The installer has detected that the following versions of the Add-In are already installed:$1$\r$\nUninstall the previous versions before you reinstall them." - - pop $1 - pop $0 -!macroend ;ADDIN7X_STATUP - -;------------------------------------------------------------------------------------------------ -!macro ADDIN7X_FINISH -!macroend - -!macro ADDIN7X_UNSTARTUP - !insertmacro ConfirmOnRemove "Qt4VSAddin2008" "$ADDIN_INSTDIR" - !insertmacro ConfirmOnRemove "Qt4VSAddin2005" "$ADDIN_INSTDIR" -!macroend - -;------------------------------------------------------------------------------------------------ -!macro ADDIN7X_UNINSTALL - push $0 - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VSAddin2008" - intcmp $0 1 0 DoneUnInstall2008 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VSAddin2008" 0 - strcpy $VS_VERSION "2008" - strcpy $VS_VERSION_SHORT "9.0" - call un.RegisterAddin - Delete "$ADDIN_INSTDIR\9.0\Qt4VSAddin.AddIn" - Delete "$ADDIN_INSTDIR\9.0\Qt4VSAddin.dll" - Delete "$ADDIN_INSTDIR\9.0\QtProjectLib.dll" - Delete "$ADDIN_INSTDIR\9.0\QtProjectEngineLib.dll" - Delete "$ADDIN_INSTDIR\9.0\qmakewrapper1Lib.dll" - RmDir "$ADDIN_INSTDIR\9.0" - DeleteRegKey SHCTX "SOFTWARE\Microsoft\VisualStudio\9.0\NewProjectTemplates\TemplateDirs\${QT4VSADDIN_GUID}" - DeleteRegKey SHCTX "SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}" - DeleteRegKey SHCTX "SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{8BC9CEBA-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}" - DeleteRegValue SHCTX "Software\Microsoft\VisualStudio\9.0\AutomationOptions\LookInFolders" "$ADDIN_INSTDIR\9.0" - !insertmacro un.InstallHelpInVS "qt4vs" "$VS_VERSION_SHORT" - - push "$ADDIN_INSTDIR" - call un.InstallProjectTemplates - strcpy $WizardInstDir "$ADDIN_INSTDIR\wizards" - RmDir "$ProjectInstDir" - DoneUnInstall2008: - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VSAddin2005" - intcmp $0 1 0 DoneUnInstall2005 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VSAddin2005" 0 - strcpy $VS_VERSION "2005" - strcpy $VS_VERSION_SHORT "8.0" - call un.RegisterAddin - Delete "$ADDIN_INSTDIR\8.0\en\Qt4VSAddin.resources.dll" - RmDir "$ADDIN_INSTDIR\8.0\en" - Delete "$ADDIN_INSTDIR\8.0\Qt4VSAddin.AddIn" - Delete "$ADDIN_INSTDIR\8.0\Qt4VSAddin.dll" - Delete "$ADDIN_INSTDIR\8.0\QtProjectLib.dll" - Delete "$ADDIN_INSTDIR\8.0\QtProjectEngineLib.dll" - Delete "$ADDIN_INSTDIR\8.0\qmakewrapper1Lib.dll" - RmDir "$ADDIN_INSTDIR\8.0" - DeleteRegKey SHCTX "SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\TemplateDirs\${QT4VSADDIN_GUID}" - DeleteRegKey SHCTX "SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}" - DeleteRegKey SHCTX "SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{8BC9CEBA-8B4A-11D0-8D11-00A0C91BC942}\AddItemTemplates\TemplateDirs\${QT4VSADDIN_GUID}" - DeleteRegValue SHCTX "Software\Microsoft\VisualStudio\8.0\AutomationOptions\LookInFolders" "$ADDIN_INSTDIR\8.0" - !insertmacro un.InstallHelpInVS "qt4vs" "$VS_VERSION_SHORT" - - push "$ADDIN_INSTDIR" - call un.InstallProjectTemplates - strcpy $WizardInstDir "$ADDIN_INSTDIR\wizards" - RmDir "$ProjectInstDir" - DoneUnInstall2005: - - strcmp $VS_VERSION "2005" DoUninstallAddinCommon - strcmp $VS_VERSION "2008" DoUninstallAddinCommon DoneUninstallAddinCommon - - DoUninstallAddinCommon: - - IfFileExists "$ADDIN_INSTDIR\help\h2reg.exe" 0 DoneUninstallAddinHelp - !insertmacro un.RegisterHelp "$ADDIN_INSTDIR\help" "qt4vs" - !insertmacro un.InstallHelp "$ADDIN_INSTDIR\help" "qt4vs" "0.0" - Push "$ADDIN_INSTDIR\help" - Call un.DeleteH2RegFiles - DoneUninstallAddinHelp: - - Delete "$ADDIN_INSTDIR\qmakewrapper1.dll" - Delete "$ADDIN_INSTDIR\qrceditor.exe" - Delete "$ADDIN_INSTDIR\QtCore4.dll" - Delete "$ADDIN_INSTDIR\QtGui4.dll" - Delete "$ADDIN_INSTDIR\QtXml4.dll" - - RmDir "$ADDIN_INSTDIR\projects" - RmDir "$ADDIN_INSTDIR\wizards" - - Delete "$ADDIN_INSTDIR\uiItems\Qt4Files.vsdir" - push $ADDIN_INSTDIR - call un.InstallItemTemplates - - RmDir "$ADDIN_INSTDIR" - - DoneUninstallAddinCommon: - pop $0 -!macroend ;ADDIN7X_UNINSTALL - -!macro ADDIN7X_UNFINISH -!macroend - -!else ;MODULE_ADDIN7X -!macro ADDIN7X_INITIALIZE -!macroend -!macro ADDIN7X_SECTIONS -!macroend -!macro ADDIN7X_DESCRIPTION -!macroend -!macro ADDIN7X_STARTUP -!macroend -!macro ADDIN7X_FINISH -!macroend -!macro ADDIN7X_UNSTARTUP -!macroend -!macro ADDIN7X_UNINSTALL -!macroend -!macro ADDIN7X_UNFINISH -!macroend -!endif ;MODULE_ADDIN7X - diff --git a/util/scripts/win-binary/nsis/modules/debugext.nsh b/util/scripts/win-binary/nsis/modules/debugext.nsh deleted file mode 100644 index e1ad199..0000000 --- a/util/scripts/win-binary/nsis/modules/debugext.nsh +++ /dev/null @@ -1,669 +0,0 @@ -!ifdef MODULE_DEBUGEXT - -var DEBUGEXT_INITIALIZED - -;------------------------------------------------------------------------------------------------ -!macro DEBUGEXT_INITIALIZE -!ifndef MODULE_DEBUGEXT_INSTALLER - !define MODULE_DEBUGEXT_INSTALLER "${PRODUCT_NAME} v${PRODUCT_VERSION}" -!endif -!ifndef MODULE_DEBUGEXT_ROOT - !define MODULE_DEBUGEXT_ROOT "${INSTALL_ROOT}\debugext" -!endif -!macroend ;DEBUGEXT_INITIALIZE - - -;------------------------------------------------------------------------------------------------ -!macro CleanAutoExp UN -Function ${UN}CleanAutoExp - exch $1 ;filename autoexp - exch - exch $0 ;version - push $3 ;readline - push $4 ;handle autoexp - push $5 ;tmpfile handle - push $6 ;tmp copy of autoexp.dat - push $7 - - ClearErrors - IfErrors done - - StrCpy $6 "$1_tmp" - CopyFiles /FILESONLY "$1" "$6" - - FileOpen $5 $1 w - IfErrors done - - FileOpen $4 $6 r - IfErrors done - -nextline: - FileRead $4 $3 - IfErrors renameFile - - strcmp $0 "" 0 +4 - strcpy $7 $3 15 - strcmp $7 ";QT_DEBUG_START" nowrite - goto +3 - strcmp $3 ";QT_DEBUG_START ($0)$\n" nowrite - strcmp $3 ";QT_DEBUG_START ($0)$\r$\n" nowrite - - strcpy $7 $3 14 ;qt3 (always remove qt3 stuff) - strcmp $7 "; Trolltech Qt" nowrite write - nowrite: - FileRead $4 $3 - IfErrors renameFile - strcpy $7 $3 13 - strcmp $7 ";QT_DEBUG_END" nextline - strcpy $7 $3 14 ;qt3 - strcmp $7 "QObject =class" nextline nowrite - write: - FileWrite $5 $3 - goto nextline - -renameFile: - FileClose $5 - FileClose $4 - SetDetailsPrint none - Delete $6 - SetDetailsPrint both - -done: - pop $7 - pop $6 - pop $5 - pop $4 - pop $3 - pop $0 - pop $1 -FunctionEnd -!macroend ;CleanAutoExp - -;------------------------------------------------------------------------------------------------ -!macro DEBUGEXT_SECTIONS - -Section -PreDebugExtSection - StrCpy $DEBUGEXT_INITIALIZED "0" - - SetOutPath $TEMP - File "${MODULE_DEBUGEXT_ROOT}\autoexp.dat_entries.txt" - File "${MODULE_DEBUGEXT_ROOT}\autoexp.dat-autoexpand2003" - File "${MODULE_DEBUGEXT_ROOT}\autoexp.dat-autoexpand2005" - File "${MODULE_DEBUGEXT_ROOT}\autoexp.dat-autoexpand2008" - File "${MODULE_DEBUGEXT_ROOT}\autoexp.dat-visualizer2005" - File "${MODULE_DEBUGEXT_ROOT}\autoexp.dat-visualizer2008" -SectionEnd - -SectionGroup "Debugger Extension" - -!ifndef MODULE_DEBUGEXT_NOVS2008 -Section "Visual Studio 2008" DEBUGEXT_SEC01 - push $0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\9.0" "InstallDir" - strcmp $0 "" done90 - push "$0..\Packages\Debugger\" - push "2008" - call DoUpdateDatFile - push "$0usertype.dat" - call UpdateUserType - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VS2008DebugExtInstalled" 1 - StrCpy $DEBUGEXT_INITIALIZED "1" - done90: - - pop $0 -SectionEnd -!endif - -!ifndef MODULE_DEBUGEXT_NOVS2005 -Section "Visual Studio 2005" DEBUGEXT_SEC02 - push $0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\8.0" "InstallDir" - strcmp $0 "" done80 - push "$0..\Packages\Debugger\" - push "2005" - call DoUpdateDatFile - push "$0usertype.dat" - call UpdateUserType - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VS2005DebugExtInstalled" 1 - StrCpy $DEBUGEXT_INITIALIZED "1" - done80: - - pop $0 -SectionEnd -!endif - -!ifndef MODULE_DEBUGEXT_NOVS2003 -Section "Visual Studio 2003" DEBUGEXT_SEC03 - push $0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\7.1" "InstallDir" - strcmp $0 "" done71 - push "$0..\Packages\Debugger\" - push "2003" - call DoUpdateDatFile - push "$0usertype.dat" - call UpdateUserType - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VS2003DebugExtInstalled" 1 - StrCpy $DEBUGEXT_INITIALIZED "1" - done71: - - pop $0 -SectionEnd -!endif - -!ifndef MODULE_DEBUGEXT_NOVS2002 -Section "Visual Studio 2002" DEBUGEXT_SEC04 - push $0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\7.0" "InstallDir" - strcmp $0 "" done70 - push "$0..\Packages\Debugger\" - push "2002" - call DoUpdateDatFile - push "$0usertype.dat" - call UpdateUserType - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VS2002DebugExtInstalled" 1 - StrCpy $DEBUGEXT_INITIALIZED "1" - done70: - - pop $0 -SectionEnd -!endif - -!ifndef MODULE_DEBUGEXT_NOVC60 -Section "Visual C++ 6.0" DEBUGEXT_SEC05 - push $0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\6.0\Setup" "VsCommonDir" - strcmp $0 "" done60 - push "$0\MsDev98\bin\" - push "6.0" - call DoUpdateDatFile - push "$0\MsDev98\bin\usertype.dat" - call UpdateUserType - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VC60DebugExtInstalled" 1 - StrCpy $DEBUGEXT_INITIALIZED "1" - done60: - - pop $0 -SectionEnd -!endif - -SectionGroupEnd - -Section -PostDebugExtSection - Delete "$TEMP\autoexp.dat_entries.txt" - Delete "$TEMP\autoexp.dat-autoexpand2003" - Delete "$TEMP\autoexp.dat-autoexpand2005" - Delete "$TEMP\autoexp.dat-autoexpand2008" - Delete "$TEMP\autoexp.dat-visualizer2005" - Delete "$TEMP\autoexp.dat-visualizer2008" - -# IntCmp $DEBUGEXT_INITIALIZED 0 nodebugext - -# SetOutPath "$INSTDIR\debugext" -# File "${MODULE_DEBUGEXT_ROOT}\doc\usage.rtf" -# !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\Debugger Extension Readme.lnk" "$INSTDIR\debugext\usage.rtf" - - nodebugext: -SectionEnd - -Function DoUpdateDatFile - exch $0 ; vs version - exch - exch $1 ;dir - push $2 - - strcpy $2 "$1\autoexp.dat" - - push $2 - call BackupFile - - - push "" ;remove all qt related stuff - push $2 - call CleanAutoExp - - push "[AutoExpand]" - push $2 - ${If} $0 == "6.0" - ${OrIf} $0 == "2002" - push "$TEMP\autoexp.dat_entries.txt" - ${Else} - push "$TEMP\autoexp.dat-autoexpand$0" - ${EndIf} - call InsertAutoExp - - ${If} $0 == "2005" - ${OrIf} $0 == "2008" - push "[Visualizer]" - push $2 - push "$TEMP\autoexp.dat-visualizer$0" - call InsertAutoExp - ${EndIf} - - pop $2 - pop $1 - pop $0 -FunctionEnd - -Function UpdateUserType - exch $0 ;usertype filename - push $1 - - push $0 - call BackupFile - - ClearErrors - FileOpen $1 $0 a - IfErrors done - - push "Q_OBJECT" - push $1 - call AddUserType - push "Q_ENUMS" - push $1 - call AddUserType - push "Q_FLAGS" - push $1 - call AddUserType - push "Q_INTERFACES" - push $1 - call AddUserType - push "Q_PROPERTY" - push $1 - call AddUserType - push "Q_SETS" - push $1 - call AddUserType - push "Q_CLASSINFO" - push $1 - call AddUserType - push "emit" - push $1 - call AddUserType - push "SIGNAL" - push $1 - call AddUserType - push "SLOT" - push $1 - call AddUserType - push "signals:" - push $1 - call AddUserType - push "slots:" - push $1 - call AddUserType - push "qobject_cast" - push $1 - call AddUserType - push "qvariant_cast" - push $1 - call AddUserType - -done: - FileClose $1 - - pop $1 - pop $0 -FunctionEnd - -Function AddUserType - exch $0 ;file handle - exch - exch $1 ;value - push $2 - - FileSeek $0 0 ;beginning - -scann: - FileRead $0 $2 - IfErrors insert - strcmp "$2" "$1" done - strcmp "$2" "$1$\r" done - strcmp "$2" "$1$\n" done - strcmp "$2" "$1$\r$\n" done - goto scann - -insert: - FileSeek $0 -2 CUR ;previous char - ClearErrors - FileRead $0 $2 2 - IfErrors +3 - strcmp $2 "$\r$\n" +2 - FileWrite $0 "$\r$\n" - FileWrite $0 "$1$\r$\n" - -done: - pop $2 - pop $1 - pop $0 -FunctionEnd - -Function BackupFile - exch $0 - push $1 - push $2 - - IfFileExists $0 0 done - - ; remove extension - strlen $1 $0 - intop $1 $1 - 3 - strcpy $2 $0 $1 - - IfFileExists "$2qto" writeqte writeqto - - writeqto: - copyfiles /FILESONLY "$0" "$2qto" - goto done - - writeqte: - SetDetailsPrint none - IfFileExists "$2qte" 0 +2 - Delete "$2qte" - SetDetailsPrint both - copyfiles /FILESONLY "$0" "$2qte" - - done: - pop $2 - pop $1 - pop $0 -FunctionEnd - -Function InsertAutoExp - exch $0 ;filename qtrules - exch - exch $1 ;filename autoexp - exch - exch 2 - exch $8 ; section name in autoexp file "[AutoExpand]" - exch 2 - push $2 ;handle qtrules - push $3 ;readline - push $4 ;handle autoexp - push $5 ;tmpfile handle - push $6 ;tmp copy of autoexp.dat - push $7 - - ClearErrors - IfErrors done - - StrCpy $6 "$1_tmp" - CopyFiles /FILESONLY "$1" "$6" - - FileOpen $5 $1 a - IfErrors done - - FileOpen $4 $6 r - IfErrors done - - FileOpen $2 $0 r - IfErrors done - -nextline: - FileRead $4 $3 - IfErrors insertloop - - strcpy $7 $3 12 - strcmp $7 $8 insert copyline - copyline: - FileWrite $5 $3 - goto nextline - - insert: - FileWrite $5 $3 - insertloop: - FileRead $2 $3 - IfErrors copyrest - strcpy $7 $3 15 - strcmp $7 ";QT_DEBUG_START" 0 +2 - strcpy $3 "$7 (${MODULE_DEBUGEXT_INSTALLER})$\r$\n" - FileWrite $5 $3 - goto insertloop - - copyrest: - FileRead $4 $3 - IfErrors renameFile - FileWrite $5 $3 - goto copyrest - -renameFile: - FileClose $5 - FileClose $4 - FileClose $2 - SetDetailsPrint none - Delete $6 - SetDetailsPrint both - -done: - pop $7 - pop $6 - pop $5 - pop $4 - pop $3 - pop $2 - pop $0 - pop $1 - pop $8 -FunctionEnd - -!insertmacro CleanAutoExp "" -!insertmacro CleanAutoExp "un." -!macroend ;DEBUGEXT_SECTIONS - -;------------------------------------------------------------------------------------------------ -!macro DEBUGEXT_DESCRIPTION -!ifndef MODULE_DEBUGEXT_NOVS2008 - !insertmacro MUI_DESCRIPTION_TEXT ${DEBUGEXT_SEC01} "This installs Qt 4 debug extensions. This makes it easier to debug Qt objects in Visual Studio (Overwrites Qt 3 debug extensions)." -!endif -!ifndef MODULE_DEBUGEXT_NOVS2005 - !insertmacro MUI_DESCRIPTION_TEXT ${DEBUGEXT_SEC02} "This installs Qt 4 debug extensions. This makes it easier to debug Qt objects in Visual Studio (Overwrites Qt 3 debug extensions)." -!endif -!ifndef MODULE_DEBUGEXT_NOVS2003 - !insertmacro MUI_DESCRIPTION_TEXT ${DEBUGEXT_SEC03} "This installs Qt 4 debug extensions. This makes it easier to debug Qt objects in Visual Studio (Overwrites Qt 3 debug extensions)." -!endif -!ifndef MODULE_DEBUGEXT_NOVS2002 - !insertmacro MUI_DESCRIPTION_TEXT ${DEBUGEXT_SEC04} "This installs Qt 4 debug extensions. This makes it easier to debug Qt objects in Visual Studio (Overwrites Qt 3 debug extensions)." -!endif -!ifndef MODULE_DEBUGEXT_NOVC60 - !insertmacro MUI_DESCRIPTION_TEXT ${DEBUGEXT_SEC05} "This installs Qt 4 debug extensions. This makes it easier to debug Qt objects in Visual Studio (Overwrites Qt 3 debug extensions)." -!endif -!macroend - -;------------------------------------------------------------------------------------------------ -!macro DEBUGEXT_STARTUP - push $0 - push $1 - push $3 - -!ifndef MODULE_DEBUGEXT_NOVS2008 - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\9.0" "InstallDir" - strcmp $0 "" debugext_startup_not90 - strcpy $1 "$0..\Packages\Debugger\autoexp.dat" - ClearErrors - FileOpen $3 $1 a - IfErrors debugext_startup_not90 - FileClose $3 - - Goto debugext_startup_done90 - debugext_startup_not90: - SectionSetFlags ${DEBUGEXT_SEC01} "16" - debugext_startup_done90: -!endif - -!ifndef MODULE_DEBUGEXT_NOVS2005 - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\8.0" "InstallDir" - strcmp $0 "" debugext_startup_not80 - strcpy $1 "$0..\Packages\Debugger\autoexp.dat" - ClearErrors - FileOpen $3 $1 a - IfErrors debugext_startup_not80 - FileClose $3 - - Goto debugext_startup_done80 - debugext_startup_not80: - SectionSetFlags ${DEBUGEXT_SEC02} "16" - debugext_startup_done80: -!endif - -!ifndef MODULE_DEBUGEXT_NOVS2003 - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\7.1" "InstallDir" - strcmp $0 "" debugext_startup_not71 - strcpy $1 "$0..\Packages\Debugger\autoexp.dat" - ClearErrors - FileOpen $3 $1 a - IfErrors debugext_startup_not71 - FileClose $3 - - Goto debugext_startup_done71 - debugext_startup_not71: - SectionSetFlags ${DEBUGEXT_SEC03} "16" - debugext_startup_done71: -!endif - -!ifndef MODULE_DEBUGEXT_NOVS2002 - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\7.0" "InstallDir" - strcmp $0 "" debugext_startup_not70 - strcpy $1 "$0..\Packages\Debugger\autoexp.dat" - ClearErrors - FileOpen $3 $1 a - IfErrors debugext_startup_not70 - FileClose $3 - - Goto debugext_startup_done70 - debugext_startup_not70: - SectionSetFlags ${DEBUGEXT_SEC04} "16" - debugext_startup_done70: -!endif - -!ifndef MODULE_DEBUGEXT_NOVC60 - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\6.0\Setup" "VsCommonDir" - strcmp $0 "" debugext_startup_not60 - strcpy $1 "$0\MsDev98\bin\autoexp.dat" - ClearErrors - FileOpen $3 $1 a - IfErrors debugext_startup_not60 - FileClose $3 - - Goto debugext_startup_done60 - debugext_startup_not60: - SectionSetFlags ${DEBUGEXT_SEC05} "16" - debugext_startup_done60: -!endif - - pop $3 - pop $1 - pop $0 -!macroend ;DEBUGEXT_STATUP - -;------------------------------------------------------------------------------------------------ -!macro DEBUGEXT_FINISH -!macroend - -;------------------------------------------------------------------------------------------------ -!macro DEBUGEXT_UNSTARTUP - !insertmacro ConfirmOnRemove "VS2008DebugExtInstalled" "Qt Debugger Extension (VS2008)" - !insertmacro ConfirmOnRemove "VS2005DebugExtInstalled" "Qt Debugger Extension (VS2005)" - !insertmacro ConfirmOnRemove "VS2003DebugExtInstalled" "Qt Debugger Extension (VS2003)" - !insertmacro ConfirmOnRemove "VS2002DebugExtInstalled" "Qt Debugger Extension (VS2002)" - !insertmacro ConfirmOnRemove "VC60DebugExtInstalled" "Qt Debugger Extension (VC60)" -!macroend - -;------------------------------------------------------------------------------------------------ -!macro DEBUGEXT_UNINSTALL -Section un."Debugger Extension" - push $0 - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "VS2008DebugExtInstalled" - intcmp $0 1 0 done90 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VS2008DebugExtInstalled" 0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\9.0" "InstallDir" - strcmp $0 "" done90 - push "$0..\Packages\Debugger\" - call un.DoCleanDatFile - done90: - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "VS2005DebugExtInstalled" - intcmp $0 1 0 done80 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VS2005DebugExtInstalled" 0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\8.0" "InstallDir" - strcmp $0 "" done80 - push "$0..\Packages\Debugger\" - call un.DoCleanDatFile - done80: - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "VS2003DebugExtInstalled" - intcmp $0 1 0 done71 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VS2003DebugExtInstalled" 0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\7.1" "InstallDir" - strcmp $0 "" done71 - push "$0..\Packages\Debugger\" - call un.DoCleanDatFile - done71: - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "VS2002DebugExtInstalled" - intcmp $0 1 0 done70 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VS2002DebugExtInstalled" 0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\7.0" "InstallDir" - strcmp $0 "" done70 - push "$0..\Packages\Debugger\" - call un.DoCleanDatFile - done70: - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "VC60DebugExtInstalled" - intcmp $0 1 0 done60 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "VC60DebugExtInstalled" 0 - - ReadRegStr $0 SHCTX "Software\Microsoft\VisualStudio\6.0\Setup" "VsCommonDir" - strcmp $0 "" done60 - push "$0\MsDev98\bin\" - call un.DoCleanDatFile - done60: - -# Delete "$INSTDIR\debugext\usage.rtf" -# RmDir "$INSTDIR\debugext" -# Delete "$SMPROGRAMS\$STARTMENU_STRING\Debugger Extension Readme.lnk" - - pop $0 -SectionEnd - -Function un.DoCleanDatFile - exch $0 ;dir - push "${MODULE_DEBUGEXT_INSTALLER}" - push "$0autoexp.dat" - call un.CleanAutoExp - pop $0 -FunctionEnd - -!macroend ;DEBUGEXT_UNINSTALL - -;------------------------------------------------------------------------------------------------ -!macro DEBUGEXT_UNFINISH -!macroend - -!else ;MODULE_DEBUGEXT -!macro DEBUGEXT_INITIALIZE -!macroend -!macro DEBUGEXT_SECTIONS -!macroend -!macro DEBUGEXT_DESCRIPTION -!macroend -!macro DEBUGEXT_STARTUP -!macroend -!macro DEBUGEXT_FINISH -!macroend -!macro DEBUGEXT_UNSTARTUP -!macroend -!macro DEBUGEXT_UNINSTALL -!macroend -!macro DEBUGEXT_UNFINISH -!macroend -!endif ;MODULE_DEBUGEXT - diff --git a/util/scripts/win-binary/nsis/modules/eclipse.nsh b/util/scripts/win-binary/nsis/modules/eclipse.nsh deleted file mode 100644 index 8a826ab..0000000 --- a/util/scripts/win-binary/nsis/modules/eclipse.nsh +++ /dev/null @@ -1,398 +0,0 @@ -!ifdef MODULE_ECLIPSE - -;------------------------------------------------------------------------------------------------ -!macro ECLIPSE_INITIALIZE - -!define ECLIPSE_LOCATION_KEY "EclipseLocation" -var ECLIPSE_LOCATION -var ECLIPSE_MINGW_LOCATION - -!ifndef MODULE_ECLIPSE_INSTALLER - !define MODULE_ECLIPSE_INSTALLER "${PRODUCT_NAME} v${PRODUCT_VERSION}" -!endif -!ifndef MODULE_ECLIPSE_ROOT - !define MODULE_ECLIPSE_ROOT "${INSTALL_ROOT}\eclipse" -!endif -!ifndef MODULE_ECLIPSE_VERSION - !define MODULE_ECLIPSE_VERSION ${PRODUCT_VERSION} -!endif - -!define MODULE_ECLIPSE_QT_PREFIX "qtcpp" - -!define MODULE_ECLIPSE_QT_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}_${MODULE_ECLIPSE_VERSION}" - -!define MODULE_ECLIPSE_QTFEATURE_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}.feature_${MODULE_ECLIPSE_VERSION}" - -!define MODULE_ECLIPSE_QTPROJECT_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}project_${MODULE_ECLIPSE_VERSION}" -!define MODULE_ECLIPSE_QTPROJECT_LABEL "Qt Project Integration" -!define MODULE_ECLIPSE_QTPROJECT_INSTALLEDKEY "EclipseQtProjectInstalled" -!define MODULE_ECLIPSE_QTPROJECT_WIN32X86_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}project.win32.x86_${MODULE_ECLIPSE_VERSION}" - -!define MODULE_ECLIPSE_QTDESIGNER_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}designer_${MODULE_ECLIPSE_VERSION}" -!define MODULE_ECLIPSE_QTDESIGNER_LABEL "Qt Designer Integration" -!define MODULE_ECLIPSE_QTDESIGNER_INSTALLEDKEY "EclipseQtDesignerInstalled" -!define MODULE_ECLIPSE_QTDESIGNER_WIN32X86_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}designer.win32.x86_${MODULE_ECLIPSE_VERSION}" -!define MODULE_ECLIPSE_QTDESIGNER_QT_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}designer.${MODULE_ECLIPSE_QT_PREFIX}_${MODULE_ECLIPSE_VERSION}" -!define MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}designerplugins.win32.x86_${MODULE_ECLIPSE_VERSION}" - -!define MODULE_ECLIPSE_QTINTEGRATIONHELP_ID "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}integrationhelp_${MODULE_ECLIPSE_VERSION}" -!define MODULE_ECLIPSE_QTINTEGRATIONHELP_LABEL "Qt Integration Help" -!define MODULE_ECLIPSE_QTINTEGRATIONHELP_INSTALLEDKEY "EclipseQtIntegrationHelpInstalled" -!define MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESSUBFOLDER "com.trolltech.${MODULE_ECLIPSE_QT_PREFIX}integrationhelp.examples_${MODULE_ECLIPSE_VERSION}" -!define MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESSOURCE "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESSUBFOLDER}" -!define MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESTARGET "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESSUBFOLDER}" -!define MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE "${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESSOURCE}\AddressBook" -!define MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET "${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESTARGET}\AddressBook" - -!define MODULE_ECLIPSE_MSRT_VERSION "71" - -LangString ModuleEclipsePageTitle ${LANG_ENGLISH} "Eclipse Installation Location" -LangString ModuleEclipsePageDescription ${LANG_ENGLISH} "Select where eclipse is installed, and where MinGW is located." - -!define MODULE_ECLIPSE_PAGE "eclipse.ini" -Page custom ModuleEclipsePageEnter ModuleEclipsePageExit - -!include "includes\regsvr.nsh" - -!macroend ;ECLIPSE_INITIALIZE - -;------------------------------------------------------------------------------------------------ -!macro ECLIPSE_SECTIONS - -Section -PreEclipseSection - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${ECLIPSE_LOCATION_KEY}" $ECLIPSE_LOCATION -SectionEnd - -SectionGroup "Eclipse Integration" - -Section "${MODULE_ECLIPSE_QTPROJECT_LABEL}" ECLIPSE_SEC01 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "${MODULE_ECLIPSE_QTPROJECT_INSTALLEDKEY}" 1 - SetOutPath "$ECLIPSE_LOCATION\plugins\" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QT_ID}.jar" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTPROJECT_ID}.jar" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTPROJECT_WIN32X86_ID}.jar" - - SetOutPath "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTFEATURE_ID}\corporate.gif" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTFEATURE_ID}\feature.xml" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTFEATURE_ID}\license.html" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTFEATURE_ID}\Changes-0.9.5" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTFEATURE_ID}\Changes-1.0.0" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTFEATURE_ID}\Changes-1.0.1" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTFEATURE_ID}\Changes-1.4.0" - - Call InstallQtModules - - SetOutPath "$ECLIPSE_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\bin\${MODULE_ECLIPSE_QT_PREFIX}proparser.dll" - File "${MODULE_ECLIPSE_ROOT}\bin\${MODULE_ECLIPSE_QT_PREFIX}qrceditor.dll" - - push "$ECLIPSE_INSTDIR\${MODULE_ECLIPSE_QT_PREFIX}proparser.dll" - call RegEclipseSvr - - push "$ECLIPSE_INSTDIR\${MODULE_ECLIPSE_QT_PREFIX}qrceditor.dll" - call RegEclipseSvr - - IfFileExists "$ECLIPSE_MINGW_LOCATION\gcc.exe" 0 done - Call MakeEclipseStartFile - !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\License.lnk" "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\license.html" - !insertmacro CreateConditionalShortCutWithParameters "$SMPROGRAMS\$STARTMENU_STRING\Start Eclipse with MinGW.lnk" "%COMSPEC%" "/c $\"$ECLIPSE_INSTDIR\start.bat$\"" - - done: -SectionEnd - -Section "${MODULE_ECLIPSE_QTDESIGNER_LABEL}" ECLIPSE_SEC02 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "${MODULE_ECLIPSE_QTDESIGNER_INSTALLEDKEY}" 1 - SetOutPath "$ECLIPSE_LOCATION\plugins\" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTDESIGNER_ID}.jar" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTDESIGNER_WIN32X86_ID}.jar" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTDESIGNER_QT_ID}.jar" - - SetOutPath "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\qt3supportwidgets.dll" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\Qt3Support4.dll" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\QtSql4.dll" - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\QtNetwork4.dll" - SetOutPath "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\META-INF\" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\META-INF\MANIFEST.MF" - - Call InstallQtModules - - SetOutPath "$ECLIPSE_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\bin\QtDesigner4.dll" - File "${MODULE_ECLIPSE_ROOT}\bin\QtScript4.dll" - File "${MODULE_ECLIPSE_ROOT}\bin\QtDesignerComponents4.dll" - File "${MODULE_ECLIPSE_ROOT}\bin\${MODULE_ECLIPSE_QT_PREFIX}designer.dll" - - push "$ECLIPSE_INSTDIR\${MODULE_ECLIPSE_QT_PREFIX}designer.dll" - call RegEclipseSvr -SectionEnd - -Section "${MODULE_ECLIPSE_QTINTEGRATIONHELP_LABEL}" ECLIPSE_SEC03 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "${MODULE_ECLIPSE_QTINTEGRATIONHELP_INSTALLEDKEY}" 1 - SetOutPath "$ECLIPSE_LOCATION\plugins\" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\plugins\${MODULE_ECLIPSE_QTINTEGRATIONHELP_ID}.jar" - SetOutPath "${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESTARGET}\META-INF" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESSOURCE}\META-INF\MANIFEST.MF" - SetOutPath "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE}\adddialog.cpp" - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE}\adddialog.h" - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE}\adddialog.ui" - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE}\addressbook.cpp" - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE}\addressbook.h" - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE}\AddressBook.pro" - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE}\addressbook.ui" - File "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKSOURCE}\main.cpp" -SectionEnd - -SectionGroupEnd - -; usage: -; push dll to register -; call RegEclipseSvr -Function RegEclipseSvr - exch $0 ;filename - - ClearErrors - push $0 - call RegSvr - IfErrors 0 +2 - MessageBox MB_OK|MB_ICONEXCLAMATION 'Could not register "$0"' - - pop $0 -FunctionEnd - -# -# creates a start.bat file with mingw in the path -# -Function MakeEclipseStartFile - push $0 ; file handle - - ClearErrors - FileOpen $0 "$ECLIPSE_INSTDIR\start.bat" w - IfErrors done - - FileWrite $0 "@echo off$\r$\n" - FileWrite $0 "rem$\r$\n" - FileWrite $0 "rem This file is generated by the installer$\r$\n" - FileWrite $0 "rem$\r$\n" - FileWrite $0 "$\r$\n" - FileWrite $0 "echo Setting up environment...$\r$\n" - FileWrite $0 "echo -- Using MinGW in: $ECLIPSE_MINGW_LOCATION $\r$\n" - FileWrite $0 "$\r$\n" - FileWrite $0 "set PATH=$ECLIPSE_MINGW_LOCATION$\r$\n" - FileWrite $0 "set PATH=%PATH%;%SystemRoot%\System32$\r$\n" - FileWrite $0 "$\r$\n" - FileWrite $0 "echo Starting eclipse...$\r$\n" - FileWrite $0 'call "$ECLIPSE_LOCATION\eclipse.exe" -clean' - FileWrite $0 "$\r$\n" - FileClose $0 - - done: - pop $0 -FunctionEnd - -Function InstallQtModules - SetOutPath "$ECLIPSE_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_ECLIPSE_ROOT}\bin\msvcp${MODULE_ECLIPSE_MSRT_VERSION}.dll" - File "${MODULE_ECLIPSE_ROOT}\bin\msvcr${MODULE_ECLIPSE_MSRT_VERSION}.dll" - File "${MODULE_ECLIPSE_ROOT}\bin\QtCore4.dll" - File "${MODULE_ECLIPSE_ROOT}\bin\QtGui4.dll" - File "${MODULE_ECLIPSE_ROOT}\bin\QtXml4.dll" -FunctionEnd - -Function ModuleEclipsePageEnter - !insertmacro MUI_HEADER_TEXT "$(ModuleEclipsePageTitle)" "$(ModuleEclipsePageDescription)" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${MODULE_ECLIPSE_PAGE}" -FunctionEnd - -Function ModuleEclipsePageExit - push $0 - push $1 - - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_ECLIPSE_PAGE}" "Field 5" "State" - IfFileExists "$0\eclipse.exe" eclipse_found - MessageBox MB_OK|MB_ICONSTOP "$0\eclipse.exe not found!$\nPlease select a valid installation directory." - Goto failed - eclipse_found: - - ClearErrors - FileOpen $1 "$0\plugins\com.trolltech.writetest" a - IfErrors 0 has_write_access - MessageBox MB_OK|MB_ICONSTOP "Can't write to $0\plugins.$\nPlease select a valid installation directory." - Goto failed - has_write_access: - - FileClose $1 - Delete "$0\plugins\com.trolltech.writetest" - StrCpy $ECLIPSE_LOCATION $0 - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_ECLIPSE_PAGE}" "Field 3" "State" - StrCpy $ECLIPSE_MINGW_LOCATION $0 - IfFileExists "$ECLIPSE_MINGW_LOCATION\g++.exe" done - MessageBox MB_YESNO|MB_ICONSTOP "g++ not found in $ECLIPSE_MINGW_LOCATION . Continue with installation?" IDYES done IDNO failed - - failed: - pop $1 - pop $0 - Abort - - done: - pop $1 - pop $0 -FunctionEnd - -!macroend ;ECLIPSE_SECTIONS - -;------------------------------------------------------------------------------------------------ -!macro ECLIPSE_DESCRIPTION -!ifdef ECLIPSE_SEC01 - !insertmacro MUI_DESCRIPTION_TEXT ${ECLIPSE_SEC01} "This installs the ${MODULE_ECLIPSE_QTPROJECT_LABEL} into Eclipse." -!endif -!ifdef ECLIPSE_SEC02 - !insertmacro MUI_DESCRIPTION_TEXT ${ECLIPSE_SEC02} "This installs the ${MODULE_ECLIPSE_QTDESIGNER_LABEL} into Eclipse." -!endif -!ifdef ECLIPSE_SEC03 - !insertmacro MUI_DESCRIPTION_TEXT ${ECLIPSE_SEC03} "This installs the ${MODULE_ECLIPSE_QTINTEGRATIONHELP_LABEL} into Eclipse." -!endif -!macroend - -;------------------------------------------------------------------------------------------------ -!macro ECLIPSE_STARTUP - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${MODULE_ECLIPSE_PAGE}" - SectionSetFlags ${ECLIPSE_SEC01} 17 - SectionSetFlags ${ECLIPSE_SEC02} 1 - SectionSetFlags ${ECLIPSE_SEC03} 1 - - strcpy $ECLIPSE_INSTDIR "$PROGRAMFILES\Trolltech\Eclipse" -!macroend ;ECLIPSE_STATUP - -;------------------------------------------------------------------------------------------------ -!macro ECLIPSE_FINISH -!macroend - -;------------------------------------------------------------------------------------------------ -!macro ECLIPSE_UNSTARTUP - ReadRegStr $ECLIPSE_LOCATION SHCTX "$PRODUCT_UNIQUE_KEY" "${ECLIPSE_LOCATION_KEY}" - !insertmacro ConfirmOnRemove "${MODULE_ECLIPSE_QTPROJECT_INSTALLEDKEY}" "${MODULE_ECLIPSE_QTPROJECT_LABEL}" - !insertmacro ConfirmOnRemove "${MODULE_ECLIPSE_QTDESIGNER_INSTALLEDKEY}" "${MODULE_ECLIPSE_QTDESIGNER_LABEL}" - !insertmacro ConfirmOnRemove "${MODULE_ECLIPSE_QTINTEGRATIONHELP_INSTALLEDKEY}" "${MODULE_ECLIPSE_QTINTEGRATIONHELP_LABEL}" -!macroend - -;------------------------------------------------------------------------------------------------ -!macro ECLIPSE_UNINSTALL -Section un."Eclipse Integration" - push $0 - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "${MODULE_ECLIPSE_QTPROJECT_INSTALLEDKEY}" - intcmp $0 1 0 DoneUnInstallQtProject - push "$ECLIPSE_INSTDIR\qtproparser.dll" - call un.RegSvr - push "$ECLIPSE_INSTDIR\qtqrceditor.dll" - call un.RegSvr - - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QT_ID}.jar" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTPROJECT_ID}.jar" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTPROJECT_WIN32X86_ID}.jar" - - Delete "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\corporate.gif" - Delete "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\feature.xml" - Delete "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\license.html" - Delete "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\Changes-0.9.5" - Delete "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\Changes-1.0.0" - Delete "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\Changes-1.0.1" - Delete "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}\Changes-1.4.0" - RMDir "$ECLIPSE_LOCATION\features\${MODULE_ECLIPSE_QTFEATURE_ID}" - - Delete "$ECLIPSE_INSTDIR\${MODULE_ECLIPSE_QT_PREFIX}proparser.dll" - Delete "$ECLIPSE_INSTDIR\${MODULE_ECLIPSE_QT_PREFIX}qrceditor.dll" - Delete "$SMPROGRAMS\$STARTMENU_STRING\License.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\Start Eclipse with MinGW.lnk" - Delete "$ECLIPSE_INSTDIR\start.bat" - DoneUnInstallQtProject: - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" ${MODULE_ECLIPSE_QTDESIGNER_INSTALLEDKEY} - intcmp $0 1 0 DoneUnInstallQtDesigner - push "$ECLIPSE_INSTDIR\${MODULE_ECLIPSE_QT_PREFIX}designer.dll" - call un.RegSvr - - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNER_ID}.jar" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNER_WIN32X86_ID}.jar" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNER_QT_ID}.jar" - Delete "$ECLIPSE_INSTDIR\QtDesigner4.dll" - Delete "$ECLIPSE_INSTDIR\QtScript4.dll" - Delete "$ECLIPSE_INSTDIR\QtDesignerComponents4.dll" - Delete "$ECLIPSE_INSTDIR\${MODULE_ECLIPSE_QT_PREFIX}designer.dll" - - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\META-INF\MANIFEST.MF" - RMDir "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\META-INF" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\qt3supportwidgets.dll" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\Qt3Support4.dll" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\QtSql4.dll" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}\QtNetwork4.dll" - RMDir "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTDESIGNERPLUGINS_ID}" - - DoneUnInstallQtDesigner: - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "${MODULE_ECLIPSE_QTINTEGRATIONHELP_INSTALLEDKEY}" - intcmp $0 1 0 DoneUnInstallQtIntegrationHelp - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_ECLIPSE_QTINTEGRATIONHELP_ID}.jar" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESTARGET}\META-INF\MANIFEST.MF" - RMDir "${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESTARGET}\META-INF" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}\adddialog.cpp" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}\adddialog.h" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}\adddialog.ui" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}\addressbook.cpp" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}\addressbook.h" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}\AddressBook.pro" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}\addressbook.ui" - Delete "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}\main.cpp" - RMDir "${MODULE_ECLIPSE_QTINTEGRATIONHELP_ADDRESSBOOKTARGET}" - RMDir "${MODULE_ECLIPSE_QTINTEGRATIONHELP_EXAMPLESTARGET}" - DoneUnInstallQtIntegrationHelp: - - Delete "$ECLIPSE_INSTDIR\msvcp${MODULE_ECLIPSE_MSRT_VERSION}.dll" - Delete "$ECLIPSE_INSTDIR\msvcr${MODULE_ECLIPSE_MSRT_VERSION}.dll" - Delete "$ECLIPSE_INSTDIR\QtCore4.dll" - Delete "$ECLIPSE_INSTDIR\QtGui4.dll" - Delete "$ECLIPSE_INSTDIR\QtXml4.dll" - - RMDir "$ECLIPSE_INSTDIR" - - pop $0 -SectionEnd -!macroend ;ECLIPSE_UNINSTALL - -;------------------------------------------------------------------------------------------------ -!macro ECLIPSE_UNFINISH -!macroend - -!else ;MODULE_ECLIPSE -!macro ECLIPSE_INITIALIZE -!macroend -!macro ECLIPSE_SECTIONS -!macroend -!macro ECLIPSE_DESCRIPTION -!macroend -!macro ECLIPSE_STARTUP -!macroend -!macro ECLIPSE_FINISH -!macroend -!macro ECLIPSE_UNSTARTUP -!macroend -!macro ECLIPSE_UNINSTALL -!macroend -!macro ECLIPSE_UNFINISH -!macroend -!endif ;MODULE_ECLIPSE - diff --git a/util/scripts/win-binary/nsis/modules/environment.nsh b/util/scripts/win-binary/nsis/modules/environment.nsh deleted file mode 100644 index a8d2548..0000000 --- a/util/scripts/win-binary/nsis/modules/environment.nsh +++ /dev/null @@ -1,176 +0,0 @@ -!ifdef MODULE_ENVIRONMENT -!macro ENVIRONMENT_INITIALIZE - !include "includes\writeEnvStr.nsh" - !include "includes\writePathStr.nsh" - - !ifndef MODULE_ENVIRONMENT_QTDIR - !ifdef MODULE_MINGW - !define MODULE_ENVIRONMENT_QTDIR $MINGW_INSTDIR - !endif - - !ifdef MODULE_MSVC - !define MODULE_ENVIRONMENT_QTDIR $MSVC_INSTDIR - !endif - !endif - - !define MODULE_ENVIRONMENT_PAGE "envpage.ini" - var MODULE_ENVIRONMENT_SET - var MODULE_ENVIRONMENT_OLD - LangString ModuleEnvironmentTitle ${LANG_ENGLISH} "Configure Environment" - LangString ModuleEnvironmentDescription ${LANG_ENGLISH} "Configure Qt environment variables" - - Page custom ModuleEnvironmentPageEnter ModuleEnvironmentPageExit -!macroend -!macro ENVIRONMENT_SECTIONS - Section -ModuleEnvironmentRegister - push "${MODULE_ENVIRONMENT_QTDIR}" - call RegisterQtEnvVariables - SectionEnd - - Function ModuleEnvironmentPageEnter - push $0 - Call IsNT - pop $0 - strcmp "$0" "1" +2 - abort - pop $0 - - !insertmacro MUI_HEADER_TEXT "$(ModuleEnvironmentTitle)" "$(ModuleEnvironmentDescription)" - - strcmp $MODULE_ENVIRONMENT_SET "1" 0 envCheckNo - !insertmacro MUI_INSTALLOPTIONS_WRITE "${MODULE_ENVIRONMENT_PAGE}" "Field 2" "State" "1" - goto showEnvPage - envCheckNo: - !insertmacro MUI_INSTALLOPTIONS_WRITE "${MODULE_ENVIRONMENT_PAGE}" "Field 2" "State" "0" - - showEnvPage: - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${MODULE_ENVIRONMENT_PAGE}" - FunctionEnd - - Function ModuleEnvironmentPageExit - !insertmacro MUI_INSTALLOPTIONS_READ $MODULE_ENVIRONMENT_SET "${MODULE_ENVIRONMENT_PAGE}" "Field 2" "State" - FunctionEnd - - Function RegisterQtEnvVariables - exch $2 ; the installation path = QTDIR - push $0 ; I think WriteEnvStr mixes up $0 and $1 - push $1 - - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QtEnvSet" $MODULE_ENVIRONMENT_SET - - strcmp $MODULE_ENVIRONMENT_SET "1" 0 noenv - - StrCmp $MODULE_ENVIRONMENT_OLD "0" +4 - DetailPrint "Removing $MODULE_ENVIRONMENT_OLD\bin from PATH" - push "$MODULE_ENVIRONMENT_OLD\bin" - Call RemoveFromPath ; remove old qtdir - - DetailPrint "Setting QTDIR to $2" - push "QTDIR" - push $2 - Call WriteEnvStr ; set the QTDIR - - DetailPrint "Adding $2\bin to PATH" - push "$2\bin" - Call AddToPath ; set the PATH - - - push "QMAKESPEC" - push ${INSTALL_COMPILER} - Call GetMkSpec - pop $0 - DetailPrint "Setting QMAKESPEC to $0" - push $0 - Call WriteEnvStr ; set the QMAKESPEC - - noenv: - pop $1 - pop $0 - pop $2 - FunctionEnd - - Function un.RegisterQtEnvVariables - exch $0 ; QTDIR - push $1 - - ClearErrors - ReadRegDWORD $MODULE_ENVIRONMENT_SET SHCTX "$PRODUCT_UNIQUE_KEY" "QtEnvSet" - intcmp $MODULE_ENVIRONMENT_SET 0 noenv - - DetailPrint "Removing $0\bin from the PATH" - push "$0\bin" - Call un.RemoveFromPath ; removes qt from the path - - ;Check if QTDIR is equal to installdir - ExpandEnvStrings $1 "%QTDIR%" - - StrCmp "$0" "$1" removeenv - StrCmp "$0\" "$1" removeenv - StrCmp "$0" "$1\" removeenv - Goto noenv - - removeenv: - DetailPrint "Removing QTDIR" - push "QTDIR" - Call un.DeleteEnvStr ; removes QTDIR - - DetailPrint "Removing QMAKESPEC" - push "QMAKESPEC" - Call un.DeleteEnvStr ; removes QMAKESPEC - - noenv: - pop $1 - pop $0 - FunctionEnd -!macroend -!macro ENVIRONMENT_DESCRIPTION -!macroend -!macro ENVIRONMENT_STARTUP - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${MODULE_ENVIRONMENT_PAGE}" - push $0 - ExpandEnvStrings $0 "%QTDIR%" - - StrCmp $0 "%QTDIR%" +4 - strcpy $MODULE_ENVIRONMENT_SET "0" ;QTDIR exists - strcpy $MODULE_ENVIRONMENT_OLD $0 - Goto +3 - strcpy $MODULE_ENVIRONMENT_SET "1" ;no QTDIR - strcpy $MODULE_ENVIRONMENT_OLD "0" - - Call IsNT - pop $0 - strcmp "$0" "1" +2 - strcpy $MODULE_ENVIRONMENT_SET "0" - pop $0 -!macroend -!macro ENVIRONMENT_FINISH -!macroend -!macro ENVIRONMENT_UNSTARTUP -!macroend -!macro ENVIRONMENT_UNINSTALL - Section -un.ModuleEnvironmentRegister - push "${MODULE_ENVIRONMENT_QTDIR}" - call un.RegisterQtEnvVariables - SectionEnd -!macroend -!macro ENVIRONMENT_UNFINISH -!macroend -!else ;MODULE_ENVIRONMENT -!macro ENVIRONMENT_INITIALIZE -!macroend -!macro ENVIRONMENT_SECTIONS -!macroend -!macro ENVIRONMENT_DESCRIPTION -!macroend -!macro ENVIRONMENT_STARTUP -!macroend -!macro ENVIRONMENT_FINISH -!macroend -!macro ENVIRONMENT_UNSTARTUP -!macroend -!macro ENVIRONMENT_UNINSTALL -!macroend -!macro ENVIRONMENT_UNFINISH -!macroend -!endif ;MODULE_ENVIRONMENT - diff --git a/util/scripts/win-binary/nsis/modules/evaluation.nsh b/util/scripts/win-binary/nsis/modules/evaluation.nsh deleted file mode 100644 index 7bcb31e..0000000 --- a/util/scripts/win-binary/nsis/modules/evaluation.nsh +++ /dev/null @@ -1,116 +0,0 @@ -!ifdef MODULE_EVALUATION -!macro EVALUATION_INITIALIZE - !ifndef MODULE_EVALUATION_QTDIR - !ifdef MODULE_MINGW - !define MODULE_EVALUATION_QTDIR $MINGW_INSTDIR - !endif - - !ifdef MODULE_MSVC - !define MODULE_EVALUATION_QTDIR $MSVC_INSTDIR - !endif - - !ifdef MODULE_QTJAMBI - !define MODULE_EVALUATION_QTDIR $QTJAMBI_INSTDIR - !endif - !endif -!macroend -!macro EVALUATION_SECTIONS - Section -ModuleEvaluationSection - !ifdef MODULE_MSVC_WIN32BUILDTREE & MODULE_MSVC_WIN32BUILDINSTALLDIRNAME - push "$MSVC_INSTDIR\${MODULE_MSVC_WIN32BUILDINSTALLDIRNAME}" - push "bin" - call PatchKeyInBinary - !endif - !ifdef MODULE_MSVC_WM50BUILDTREE & MODULE_MSVC_WM50BUILDINSTALLDIRNAME - push "$MSVC_INSTDIR\${MODULE_MSVC_WM50BUILDINSTALLDIRNAME}" - push "lib" - call PatchKeyInBinary - !endif - !ifdef MODULE_MSVC_SSDK50X86BUILDTREE & MODULE_MSVC_SSDK50X86BUILDINSTALLDIRNAME - push "$MSVC_INSTDIR\${MODULE_MSVC_SSDK50X86BUILDINSTALLDIRNAME}" - push "lib" - call PatchKeyInBinary - !endif - !ifndef MODULE_MSVC_WIN32BUILDTREE | MODULE_MSVC_WM50BUILDTREE | MODULE_MSVC_SSDK50X86BUILDTREE - push "${MODULE_EVALUATION_QTDIR}" - push "bin" - call PatchKeyInBinary - !endif - SectionEnd - - Function PatchKeyInBinary - exch $3 - exch - exch $2 - exch - push $0 - push $1 - - DetailPrint "Patching key in core ($2\$3)..." - FindFirst $0 $1 "$2\$3\QtCore*.dll" - StrCmp $1 "" ErrorPatchingCore - qtnsisext::PatchBinary "$2\$3\$1" "qt_qevalkey=" "qt_qevalkey=$LICENSE_KEY" - - FindNext $0 $1 - StrCmp $1 "" ErrorPatchingCore - qtnsisext::PatchBinary "$2\$3\$1" "qt_qevalkey=" "qt_qevalkey=$LICENSE_KEY" - - ErrorPatchingCore: - - DetailPrint "Patching key in gui ($2\$3)..." - FindFirst $0 $1 "$2\$3\QtGui*.dll" - StrCmp $1 "" ErrorPatchingGUI - qtnsisext::PatchBinary "$2\$3\$1" "qt_qevalkey=" "qt_qevalkey=$LICENSE_KEY" - - FindNext $0 $1 - StrCmp $1 "" ErrorPatchingGUI - qtnsisext::PatchBinary "$2\$3\$1" "qt_qevalkey=" "qt_qevalkey=$LICENSE_KEY" - - ErrorPatchingGUI: - - IfFileExists "$2\include\Qt\qconfig.h" 0 NoConfigFileFound - CopyFiles /FILESONLY "$2\include\Qt\qconfig.h" "$2\include\QtCore" - NoConfigFileFound: - - pop $1 - pop $0 - pop $3 - pop $2 - FunctionEnd -!macroend -!macro EVALUATION_DESCRIPTION -!macroend -!macro EVALUATION_STARTUP -!macroend -!macro EVALUATION_FINISH -!macroend -!macro EVALUATION_UNSTARTUP -!macroend -!macro EVALUATION_UNINSTALL - Section un.-ModuleEvaluationSection - Delete "${MODULE_EVALUATION_QTDIR}\include\QtCore\qconfig.h" - RMDir "${MODULE_EVALUATION_QTDIR}\include\QtCore" - RMDir "${MODULE_EVALUATION_QTDIR}\include" - SectionEnd -!macroend -!macro EVALUATION_UNFINISH -!macroend -!else ;MODULE_EVALUATION -!macro EVALUATION_INITIALIZE -!macroend -!macro EVALUATION_SECTIONS -!macroend -!macro EVALUATION_DESCRIPTION -!macroend -!macro EVALUATION_STARTUP -!macroend -!macro EVALUATION_FINISH -!macroend -!macro EVALUATION_UNSTARTUP -!macroend -!macro EVALUATION_UNINSTALL -!macroend -!macro EVALUATION_UNFINISH -!macroend -!endif ;MODULE_EVALUATION - diff --git a/util/scripts/win-binary/nsis/modules/help.nsh b/util/scripts/win-binary/nsis/modules/help.nsh deleted file mode 100644 index ccd0cd2..0000000 --- a/util/scripts/win-binary/nsis/modules/help.nsh +++ /dev/null @@ -1,274 +0,0 @@ -; Help Module - -!ifdef MODULE_HELP - -;------------------------------------------------------------------------------------------------ -!macro HELP_INITIALIZE -!ifndef MODULE_HELP_NAME - !define MODULE_HELP_NAME "Help Integration" -!endif -!ifndef MODULE_HELP_ROOT - !define MODULE_HELP_ROOT "${INSTALL_ROOT}\vsip\help" -!endif -!ifndef MODULE_HELP_QT_FILE_ROOT - !define MODULE_HELP_QT_FILE_ROOT "qt" -!endif - -!include "includes\system.nsh" -!include "includes\help.nsh" - -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro HELP_SECTIONS - -Section -PreHelpSection - ; use default instdir if not set - strcmp "$HELP_INSTDIR" "" 0 +2 - StrCpy $HELP_INSTDIR "$INSTDIR\help" -SectionEnd - -SectionGroup "Help Integration" - -!ifndef MODULE_HELP_NOVS2008 -Section "Visual Studio 2008" HELP_SEC01 - !insertmacro InstallHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} "9.0" - WriteRegDWORD SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 9.0" 1 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp90Installed" 1 -SectionEnd -!endif - -!ifndef MODULE_HELP_NOVS2005 -Section "Visual Studio 2005" HELP_SEC02 - !insertmacro InstallHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} "8.0" - WriteRegDWORD SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 8.0" 1 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp80Installed" 1 -SectionEnd -!endif - -!ifndef MODULE_HELP_NOVS2003 -Section "Visual Studio 2003" HELP_SEC03 - !insertmacro InstallHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} "7.1" - WriteRegDWORD SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 7.1" 1 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp71Installed" 1 -SectionEnd -!endif - -!ifndef MODULE_HELP_NOVS2002 -Section "Visual Studio 2002" HELP_SEC04 - !insertmacro InstallHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} "7.0" - WriteRegDWORD SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 7.0" 1 - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp70Installed" 1 -SectionEnd -!endif - -SectionGroupEnd - -Section -PostHelpSection - IfFileExists "$HELP_INSTDIR\h2reg.exe" 0 PostHelpSectionFinished - !insertmacro RegisterHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} -PostHelpSectionFinished: -SectionEnd - -!macroend - -;------------------------------------------------------------------------------------------------ -!macro HELP_DESCRIPTION -!ifdef HELP_SEC01 - !insertmacro MUI_DESCRIPTION_TEXT ${HELP_SEC01} "This installs the Qt Help Integration for Visual Studio 2008" -!endif -!ifdef HELP_SEC02 - !insertmacro MUI_DESCRIPTION_TEXT ${HELP_SEC02} "This installs the Qt Help Integration for Visual Studio 2005" -!endif -!ifdef HELP_SEC03 - !insertmacro MUI_DESCRIPTION_TEXT ${HELP_SEC03} "This installs the Qt Help Integration for Visual Studio 2003" -!endif -!ifdef HELP_SEC04 - !insertmacro MUI_DESCRIPTION_TEXT ${HELP_SEC04} "This installs the Qt Help Integration for Visual Studio 2002" -!endif -!macroend - -;------------------------------------------------------------------------------------------------ -!macro HELP_STARTUP - Push $0 - Push $1 - Push $2 - - StrCmp $RUNNING_AS_ADMIN "false" 0 Module_Help_CheckForInstallation -!ifdef HELP_SEC01 - SectionSetFlags ${HELP_SEC01} "16" -!endif -!ifdef HELP_SEC02 - SectionSetFlags ${HELP_SEC02} "16" -!endif -!ifdef HELP_SEC03 - SectionSetFlags ${HELP_SEC03} "16" -!endif - Goto Module_Help_Done - - Module_Help_CheckForInstallation: -!ifdef HELP_SEC01 - ReadRegDWORD $0 SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 9.0" - intcmp $0 1 0 +2 - SectionSetFlags ${HELP_SEC01} "16" -!endif - -!ifdef HELP_SEC02 - ReadRegDWORD $0 SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 8.0" - intcmp $0 1 0 +2 - SectionSetFlags ${HELP_SEC02} "16" -!endif - -!ifdef HELP_SEC03 - ReadRegDWORD $0 SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 7.1" - intcmp $0 1 0 +2 - SectionSetFlags ${HELP_SEC03} "16" -!endif - -!ifdef HELP_SEC04 - ReadRegDWORD $0 SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 7.0" - intcmp $0 1 0 +2 - SectionSetFlags ${HELP_SEC04} "16" -!endif - -!ifdef HELP_SEC01 - ClearErrors - Push "9.0" - Call GetVSInstallationDir - Pop $2 - IfErrors 0 +2 - SectionSetFlags ${HELP_SEC01} "16" -!endif - -!ifdef HELP_SEC02 - ClearErrors - Push "8.0" - Call GetVSInstallationDir - Pop $2 - IfErrors 0 +2 - SectionSetFlags ${HELP_SEC02} "16" -!endif - -!ifdef HELP_SEC03 - ClearErrors - Push "7.1" - Call GetVSInstallationDir - Pop $2 - IfErrors 0 +2 - SectionSetFlags ${HELP_SEC03} "16" -!endif - -!ifdef HELP_SEC04 - ClearErrors - Push "7.0" - Call GetVSInstallationDir - Pop $2 - IfErrors 0 +2 - SectionSetFlags ${HELP_SEC04} "16" -!endif - - Module_Help_Done: - Pop $2 - Pop $1 - Pop $0 -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro HELP_FINISH -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro HELP_UNSTARTUP - ; use default instdir if not set - strcmp "$HELP_INSTDIR" "" 0 +2 - StrCpy $HELP_INSTDIR "$INSTDIR\help" -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro HELP_UNINSTALL -Section un."${MODULE_HELP_NAME}" - push $0 - push $1 - push $2 - push $3 - push $4 - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp90Installed" - ReadRegDWORD $1 SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp80Installed" - ReadRegDWORD $2 SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp71Installed" - ReadRegDWORD $3 SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp70Installed" - - IntOp $4 $0 | $1 - IntOp $4 $4 | $2 - IntOp $4 $4 | $3 - IntCmp $4 0 Module_Help_End - - !insertmacro un.RegisterHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} - - IntCmp $0 0 Module_Help_NoVS2008 - !insertmacro un.InstallHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} "9.0" - DeleteRegValue SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp90Installed" - DeleteRegValue SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 9.0" - Module_Help_NoVS2008: - - IntCmp $1 0 Module_Help_NoVS2005 - !insertmacro un.InstallHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} "8.0" - DeleteRegValue SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp80Installed" - DeleteRegValue SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 8.0" - Module_Help_NoVS2005: - - IntCmp $2 0 Module_Help_NoVS2003 - !insertmacro un.InstallHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} "7.1" - DeleteRegValue SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp71Installed" - DeleteRegValue SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 7.1" - Module_Help_NoVS2003: - - IntCmp $3 0 Module_Help_NoVS2002 - !insertmacro un.InstallHelp "$HELP_INSTDIR" ${MODULE_HELP_QT_FILE_ROOT} "7.0" - DeleteRegValue SHCTX "$PRODUCT_UNIQUE_KEY" "QtHelp70Installed" - DeleteRegValue SHCTX "SOFTWARE\Trolltech\QtHelp" "${PRODUCT_NAME} ${PRODUCT_VERSION} - 7.0" - Module_Help_NoVS2002: - - DeleteRegKey /ifempty SHCTX "SOFTWARE\Trolltech\QtHelp" - - push "$HELP_INSTDIR" - Call un.DeleteH2RegFiles - - Module_Help_End: - pop $4 - pop $3 - pop $2 - pop $1 - pop $0 -SectionEnd -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro HELP_UNFINISH -!macroend - -;------------------------------------------------------------------------------------------------ - -!else -!macro HELP_INITIALIZE -!macroend -!macro HELP_SECTIONS -!macroend -!macro HELP_DESCRIPTION -!macroend -!macro HELP_STARTUP -!macroend -!macro HELP_FINISH -!macroend -!macro HELP_UNSTARTUP -!macroend -!macro HELP_UNINSTALL -!macroend -!macro HELP_UNFINISH -!macroend -!endif diff --git a/util/scripts/win-binary/nsis/modules/license.nsh b/util/scripts/win-binary/nsis/modules/license.nsh deleted file mode 100644 index 78b443c..0000000 --- a/util/scripts/win-binary/nsis/modules/license.nsh +++ /dev/null @@ -1,377 +0,0 @@ -!ifdef MODULE_LICENSECHECK - -!macro LICENSECHECK_INITIALIZE - !include "includes\list.nsh" - !define TT_QTKEY_INI_FILE "license.ini" - !define MODULE_LICENSECHECK_PAGE "licensepage.ini" - - LangString LicenseTitle ${LANG_ENGLISH} "Qt License" - LangString LicenseTitleDescription ${LANG_ENGLISH} "Enter your Qt License key." - - LangString LicensePageTitle ${LANG_ENGLISH} "License Agreement" - LangString LicensePageDescription ${LANG_ENGLISH} "Please review the license terms before installing $(^Name)." - - Page custom CheckQtLicense CopyKeyAndValidate - Page custom ModuleLicensePageEnter ModuleLicensePageExit - - !ifdef MODULE_LICENSECHECK_PACKAGEDATE - !echo "Using package date: ${MODULE_LICENSECHECK_PACKAGEDATE}" - !endif -!macroend - -!macro LICENSECHECK_SECTIONS - Section -ModuleLicenseCheck - push $0 - push $1 - push $2 - push $3 - push $4 - push $5 - push $6 - - qtnsisext::GetLicenseInfo - pop $6 ; ExpiryDate - pop $5 ; Products - pop $4 ; CustomerID - pop $1 ; Licensee - pop $3 ; OldLicenseKey - pop $0 ; License Key - - strcmp "$0" "$LICENSE_KEY" done ;use the .qt-license that already exists - - ; create a new .qt-license file - ExpandEnvStrings $0 "%HOME%" - strcmp "$0" "%HOME%" 0 writeLicenseFile - ExpandEnvStrings $0 "%USERPROFILE%" - strcmp "$0" "%USERPROFILE%" 0 writeLicenseFile - ExpandEnvStrings $0 "%HOMEDRIVE%%HOMEPATH%" - - ; if bka exists, write backup to file bkb - writeLicenseFile: - IfFileExists "$0\.qt-license" 0 noBackup - - strcpy $1 "$0\.qt-license-original" - IfFileExists "$1" 0 +2 - strcpy $1 "$0\.qt-license-backup" - - IfFileExists "$1" 0 +2 - Delete "$1" - - ClearErrors - CopyFiles /FILESONLY "$0\.qt-license" "$1" - IfErrors done - Delete "$0\.qt-license" - IfErrors done - - noBackup: - qtnsisext::GetLicenseID $LICENSE_KEY - pop $2 - - ClearErrors - FileOpen $1 "$0\.qt-license" w - IfErrors done - FileWrite $1 '# Qt license file (Created by the binary installer)$\r$\n' - - strcmp "$4" "" +2 - FileWrite $1 'CustomerID="$4"$\r$\n' - - FileWrite $1 'LicenseID="$2"$\r$\n' - FileWrite $1 'Licensee="$LICENSEE"$\r$\n' - - strcmp "$5" "" +2 - FileWrite $1 'Products="$5"$\r$\n' - - strcmp "$6" "" +2 - FileWrite $1 "ExpiryDate=$6$\r$\n" - - strcmp "$3" "" +2 - FileWrite $1 "LicenseKey=$3$\r$\n" - FileWrite $1 "LicenseKeyExt=$LICENSE_KEY$\r$\n" - FileClose $1 - - done: - pop $6 - pop $5 - pop $4 - pop $3 - pop $2 - pop $1 - pop $0 - SectionEnd - - Function ModuleLicensePageEnter - push $0 - push $1 - !insertmacro MUI_HEADER_TEXT "$(LicensePageTitle)" "$(LicensePageDescription)" - - GetDlgItem $1 $HWNDPARENT 1 - EnableWindow $1 0 - !insertmacro MUI_INSTALLOPTIONS_WRITE "${MODULE_LICENSECHECK_PAGE}" "Field 4" "State" "0" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${MODULE_LICENSECHECK_PAGE}" "Field 5" "State" "1" - - !insertmacro MUI_INSTALLOPTIONS_INITDIALOG ${MODULE_LICENSECHECK_PAGE} - FindWindow $0 "#32770" "" $HWNDPARENT - GetDlgItem $1 $0 1200 - SetCtlColors $1 0x000000 0xFFFFFF - qtnsisext::ShowLicenseFile "$1" "$LICENSE_FILE" - !insertmacro MUI_INSTALLOPTIONS_SHOW - - pop $1 - pop $0 - FunctionEnd - - Function ModuleLicensePageExit - push $0 - push $1 - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_LICENSECHECK_PAGE}" "Settings" "State" - strcmp "$0" "4" +2 - strcmp "$0" "5" 0 NoNotify - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_LICENSECHECK_PAGE}" "Field 4" "State" - GetDlgItem $1 $HWNDPARENT 1 - strcmp "$0" "1" +3 - EnableWindow $1 0 - goto +2 - EnableWindow $1 1 - pop $1 - pop $0 - abort - NoNotify: - - pop $1 - pop $0 - call CheckLocalLicenseProduct - FunctionEnd - - Function CheckQtLicense - !insertmacro MUI_HEADER_TEXT "$(LicenseTitle)" "$(LicenseTitleDescription)" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY ${TT_QTKEY_INI_FILE} - FunctionEnd - - Function CopyKeyAndValidate - IfSilent +3 0 - !insertmacro MUI_INSTALLOPTIONS_READ $LICENSEE "${TT_QTKEY_INI_FILE}" "Field 2" "State" - !insertmacro MUI_INSTALLOPTIONS_READ $LICENSE_KEY "${TT_QTKEY_INI_FILE}" "Field 3" "State" - - call ValidateKey - FunctionEnd -!macroend - -Function ValidateKey - push $1 - push $2 - - StrLen $1 $LICENSEE - IntCmp $1 0 wrongLicensee - - ClearErrors - !ifdef MODULE_LICENSECHECK_WINCE - qtnsisext::IsValidWinCELicense $LICENSE_KEY - !else - qtnsisext::IsValidLicense $LICENSE_KEY - !endif - IfErrors wrongKey - pop $1 - strcmp $1 "0" wrongKey - - !ifdef MODULE_LICENSECHECK_CHECKPRODUCT - qtnsisext::HasLicenseProduct $LICENSE_KEY "${MODULE_LICENSECHECK_CHECKPRODUCT}" - pop $1 - strcmp $1 "0" wrongProduct - !endif - - qtnsisext::GetLicenseProduct $LICENSE_KEY - pop $LICENSE_PRODUCT - - qtnsisext::GetLicensePlatform $LICENSE_KEY - pop $LICENSE_PLATFORM - - !ifdef MODULE_LICENSECHECK_PRODUCTLIST - push "$LICENSE_PRODUCT" - push "${MODULE_LICENSECHECK_PRODUCTLIST}" - call ItemInList - pop $1 - strcmp $1 "0" wrongKey - !endif - - strcmp "$LICENSE_PRODUCT" "SupportedEvaluation" 0 +2 - strcpy $LICENSE_PRODUCT "Evaluation" - strcmp "$LICENSE_PRODUCT" "UnsupportedEvaluation" 0 +2 - strcpy $LICENSE_PRODUCT "Evaluation" - strcmp "$LICENSE_PRODUCT" "FullSourceEvaluation" 0 +2 - strcpy $LICENSE_PRODUCT "Evaluation" - - !ifdef MODULE_LICENSECHECK_PACKAGEDATE - strcmp "$LICENSE_PRODUCT" "Evaluation" expiryDateCurrent expiryDatePackage - expiryDateCurrent: - qtnsisext::IsValidDate $LICENSE_KEY "" - pop $1 - strcmp $1 "0" keyExpired - goto expiryDateEnd - expiryDatePackage: - qtnsisext::IsValidDate $LICENSE_KEY "${MODULE_LICENSECHECK_PACKAGEDATE}" - pop $1 - strcmp $1 "0" keyExpired - expiryDateEnd: - !endif - - !ifndef MODULE_LICENSECHECK_LICENSE - ${StrCase} $2 "-$LICENSE_PRODUCT" "U" - strcmp $2 "-UNIVERSAL" 0 +2 - strcpy $2 "-DESKTOP" - strcmp $2 "-DESKTOP" 0 +2 - strcpy $2 "-DESKTOP" - strcmp $2 "-DESKTOPLIGHT" 0 +2 - strcpy $2 "-DESKTOP" - strcpy $LICENSE_FILE "$PLUGINSDIR\.LICENSE$2" - ${If} $LICENSE_PRODUCT != "Evaluation" - ${If} $LICENSE_PLATFORM == "AllOS" - strcpy $LICENSE_FILE "$PLUGINSDIR\.LICENSE-ALLOS" - ${Else} - ${If} $LICENSE_PLATFORM == "Embedded" - strcpy $LICENSE_FILE "$PLUGINSDIR\.LICENSE-EMBEDDED" - ${EndIf} - ${EndIf} - ${EndIf} - !else - strcpy $LICENSE_FILE "$PLUGINSDIR\${MODULE_LICENSECHECK_LICENSE}" - !endif - - ; In case there is a .LICENSE we assume that we have a custom package - ; custom means alpha,beta,rc or such. We still check for a valid - ; license key but display the license provided in that file. - ${If} ${FileExists} "$PLUGINSDIR\.LICENSE" - strcpy $LICENSE_FILE "$PLUGINSDIR\.LICENSE" - ${EndIf} - - qtnsisext::UsesUsLicense $LICENSE_KEY - pop $2 - strcmp "$2" "0" licenseFileCheck - - !ifdef MODULE_LICENSECHECK_USLICENSE - strcpy $LICENSE_FILE "$PLUGINSDIR\${MODULE_LICENSECHECK_USLICENSE}" - !else - strcpy $LICENSE_FILE "$LICENSE_FILE-US" - !endif - - licenseFileCheck: - IfFileExists $LICENSE_FILE 0 wrongLicenseFile - - goto end - wrongLicensee: - IfSilent 0 +3 - MessageBox MB_ICONEXCLAMATION|MB_OK "The licensee name is not valid!" - Quit - MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL "The licensee name is not valid. Do you want to try again?" IDRETRY tryAgain 0 - Quit - wrongKey: - IfSilent 0 +3 - MessageBox MB_ICONEXCLAMATION|MB_OK "The specified license key is not valid!" - Quit - MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL "The license key you entered is not valid. Do you want to try again?" IDRETRY tryAgain 0 - Quit - keyExpired: - IfSilent 0 +3 - MessageBox MB_ICONEXCLAMATION|MB_OK "The specified license key has expired!" - Quit - MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL "The license key you entered has expired. Do you want to try again?" IDRETRY tryAgain 0 - Quit - wrongProduct: - IfSilent 0 +3 - MessageBox MB_ICONEXCLAMATION|MB_OK "The license key you specified does not include ${MODULE_LICENSECHECK_CHECKPRODUCT}!" - Quit - MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL "The license key you entered does not include ${MODULE_LICENSECHECK_CHECKPRODUCT}. Do you want to try again?" IDRETRY tryAgain 0 - Quit - wrongLicenseFile: - IfSilent 0 +3 - MessageBox MB_ICONEXCLAMATION|MB_OK "No license agreement file found. Please contact support." - Quit - MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL "No license agreement file found. Please contact support." IDRETRY tryAgain 0 - Quit - tryAgain: - pop $2 - pop $1 - Abort - end: - pop $2 - pop $1 -FunctionEnd - - -!macro LICENSECHECK_STARTUP - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${TT_QTKEY_INI_FILE}" - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${MODULE_LICENSECHECK_PAGE}" - - SetOutPath "$PLUGINSDIR" - !ifndef MODULE_LICENSECHECK_LICENSE - File "${MODULE_LICENSECHECK_LICENSEDIR}\.LICENSE*" - !else - File "${MODULE_LICENSECHECK_LICENSEDIR}\${MODULE_LICENSECHECK_LICENSE}" - !ifdef MODULE_LICENSECHECK_USLICENSE - File "${MODULE_LICENSECHECK_LICENSEDIR}\${MODULE_LICENSECHECK_USLICENSE}" - !endif - !endif - - push $0 - push $1 - push $2 - push $3 - push $4 - push $5 - - qtnsisext::GetLicenseInfo - pop $5 ; ExpiryDate - pop $4 ; Products - pop $3 ; CustomerID - pop $1 ; Licensee - pop $2 ; OldLicenseKey - pop $0 ; License Key - - strcmp $LICENSEE "" +2 - strcpy $1 $LICENSEE - - strcmp $LICENSE_KEY "" +2 - strcpy $0 $LICENSE_KEY - - !insertmacro MUI_INSTALLOPTIONS_WRITE "${TT_QTKEY_INI_FILE}" "Field 2" "State" "$1" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${TT_QTKEY_INI_FILE}" "Field 3" "State" "$0" - IfSilent 0 +4 - strcpy $LICENSEE "$1" - strcpy $LICENSE_KEY "$0" - call ValidateKey - - pop $5 - pop $4 - pop $3 - pop $2 - pop $1 - pop $0 -!macroend - -!macro LICENSECHECK_FINISH -!macroend -!macro LICENSECHECK_UNSTARTUP -!macroend -!macro LICENSECHECK_UNINSTALL -!macroend -!macro LICENSECHECK_UNFINISH -!macroend -!else ;MODULE_LICENSECHECK -!macro LICENSECHECK_INITIALIZE - !ifdef LICENSE_FILE - !define MUI_LICENSEPAGE_RADIOBUTTONS - !insertmacro MUI_PAGE_LICENSE ${LICENSE_FILE} - !endif -!macroend -!macro LICENSECHECK_SECTIONS -!macroend -!macro LICENSECHECK_STARTUP -!macroend -!macro LICENSECHECK_FINISH -!macroend -!macro LICENSECHECK_UNSTARTUP -!macroend -!macro LICENSECHECK_UNINSTALL -!macroend -!macro LICENSECHECK_UNFINISH -!macroend -!endif ;MODULE_LICENSECHECK diff --git a/util/scripts/win-binary/nsis/modules/mingw.nsh b/util/scripts/win-binary/nsis/modules/mingw.nsh deleted file mode 100644 index 9d19e8d..0000000 --- a/util/scripts/win-binary/nsis/modules/mingw.nsh +++ /dev/null @@ -1,629 +0,0 @@ -!ifdef MODULE_MINGW -!macro MINGW_INITIALIZE -!include "includes\qtcommon.nsh" -!ifndef MODULE_MINGW_NAME - !define MODULE_MINGW_NAME "Qt" -!endif -!ifndef MODULE_MINGW_VERSION - !define MODULE_MINGW_VERSION "${PRODUCT_VERSION}" -!endif -!ifndef MODULE_MINGW_BUILDDIR - !error "MODULE_MINGW_BUILDDIR not defined!" -!endif -!ifndef MODULE_MINGW_URL - !define MODULE_MINGW_URL "ftp://ftp.trolltech.com/misc" -!endif -!ifndef MODULE_MINGW_COMPILERVERSION - !define MODULE_MINGW_COMPILERVERSION "3.4.2" -!endif -!ifndef MODULE_MINGW_LICENSE - !define MODULE_MINGW_LICENSE "C:\MinGW\COPYING" -!endif - -!define MODULE_MINGW_DOWNLOADPAGE "gwdownload.ini" -!define MODULE_MINGW_MIRRORPAGE "gwmirror.ini" -!define MODULE_MINGW_RUNTIME_LIB "mingw*.dll" -!define MODULE_MINGW_DOWNLOADFILE "MinGW-${MODULE_MINGW_COMPILERVERSION}" - -var MODULE_MINGW_DOWNLOAD -var MODULE_MINGW_SOURCEDOWNLOAD -var MODULE_MINGW_MIRRORS -var MODULE_MINGW_INSTOK -var MODULE_MINGW_COMPILERINSTDIR - -LangString ModuleMinGWTitle ${LANG_ENGLISH} "MinGW Installation" -LangString ModuleMinGWDescription ${LANG_ENGLISH} "You need MinGW to be able to compile Qt applications." -LangString ModuleMinGWMirrorTitle ${LANG_ENGLISH} "MinGW Download Mirror" -LangString ModuleMinGWMirrorDescription ${LANG_ENGLISH} "Select a download mirror." - -Page custom ModuleMinGWDownloadPageEnter ModuleMinGWDownloadPageExit -!define MUI_PAGE_CUSTOMFUNCTION_PRE ModuleMinGWLicensePageEnter -!define MUI_PAGE_HEADER_TEXT "MinGW License Agreement" -!define MUI_PAGE_HEADER_SUBTEXT "Please review the license terms before installing MinGW." -!define MUI_LICENSEPAGE_TEXT_TOP "MinGW License Information" -!insertmacro MUI_PAGE_LICENSE "${MODULE_MINGW_LICENSE}" -Page custom ModuleMinGWMirrorPageEnter ModuleMinGWMirrorPageExit - -!include "includes\qtenv.nsh" -!macroend - -!macro MINGW_SECTIONS -Section "${MODULE_MINGW_NAME} ${MODULE_MINGW_VERSION}" MINGW_SEC01 - strcmp "$MINGW_INSTDIR" "" 0 +5 - StrCpy $MINGW_INSTDIR "$INSTDIR\${MODULE_MINGW_NAME} ${MODULE_MINGW_VERSION}" - push $MINGW_INSTDIR - call MakeQtDirectory - pop $MINGW_INSTDIR - - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "MINGWInstalled" 1 - - SetOutPath "$MINGW_INSTDIR" - SetOverwrite ifnewer - !insertmacro MODULE_MINGW_INSTALLFILES - - push "$MINGW_INSTDIR" - call DeleteFloatingLicenseProgram - - push "$MINGW_INSTDIR\bin" - call AddStartmenuApplication - - push ${MODULE_MINGW_BUILDDIR} - push "$MINGW_INSTDIR" - call PatchPrlFiles - - IfFileExists "$MINGW_INSTDIR\.qmake.cache" 0 +5 - push "$MINGW_INSTDIR\.qmake.cache" - push ${MODULE_MINGW_BUILDDIR} - push $MINGW_INSTDIR - call PatchPath - - IfFileExists "$MINGW_INSTDIR\mkspecs\default\qmake.conf" 0 +5 - push "$MINGW_INSTDIR\mkspecs\default\qmake.conf" - push ${MODULE_MINGW_BUILDDIR} - push $MINGW_INSTDIR - call PatchPath - - Push "bin" - push $MINGW_INSTDIR - call PatchCommonBinaryFiles - - push $MINGW_INSTDIR - call PatchLicenseInformation - - WriteRegStr SHCTX "SOFTWARE\Trolltech\Common\${MODULE_MINGW_VERSION}\$LICENSE_PRODUCT" "Key" "$LICENSE_KEY" - - push $MINGW_INSTDIR - call ModuleMinGWMakeEnvFile - !insertmacro CreateConditionalShortCutWithParameters "$SMPROGRAMS\$STARTMENU_STRING\${MODULE_MINGW_NAME} ${MODULE_MINGW_VERSION} Command Prompt.lnk" "%COMSPEC%" "/k $\"$MINGW_INSTDIR\bin\qtvars.bat$\"" - !insertmacro CreateConditionalShortCutWithParameters "$SMPROGRAMS\$STARTMENU_STRING\${MODULE_MINGW_NAME} ${MODULE_MINGW_VERSION} (Build Debug Libraries).lnk" "%COMSPEC%" "/k $\"$MINGW_INSTDIR\bin\qtvars.bat compile_debug$\"" - - push $0 - strcmp $MODULE_MINGW_DOWNLOAD "no" DoneMinGWInstall - DetailPrint "Installing MinGW into $MODULE_MINGW_COMPILERINSTDIR" - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "MinGWInstDir" "$MODULE_MINGW_COMPILERINSTDIR" - nsExec::ExecToLog '"$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}.exe" /S /D=$MODULE_MINGW_COMPILERINSTDIR' - pop $0 - strcmp $MODULE_MINGW_SOURCEDOWNLOAD "no" DoneMinGWInstall - DetailPrint "Installing MinGW sources into $MODULE_MINGW_COMPILERINSTDIR\src" - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "MinGWSources" 1 - nsExec::ExecToLog '"$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}-src.exe" /S /D=$MODULE_MINGW_COMPILERINSTDIR\src' - pop $0 - DoneMinGWInstall: - pop $0 - - DetailPrint "Copying MinGW runtime..." - SetDetailsPrint none - CopyFiles /SILENT "$MODULE_MINGW_COMPILERINSTDIR\bin\${MODULE_MINGW_RUNTIME_LIB}" "$MINGW_INSTDIR\bin" - SetDetailsPrint both -SectionEnd - -Function EnableButtons - Push $0 - GetDlgItem $0 $HWNDPARENT 3 - EnableWindow $0 1 - GetDlgItem $0 $HWNDPARENT 1 - EnableWindow $0 1 - GetDlgItem $0 $HWNDPARENT 2 - EnableWindow $0 1 - Pop $0 -FunctionEnd - -Function DisableButtons - Push $0 - GetDlgItem $0 $HWNDPARENT 3 - EnableWindow $0 0 - GetDlgItem $0 $HWNDPARENT 1 - EnableWindow $0 0 - GetDlgItem $0 $HWNDPARENT 2 - EnableWindow $0 0 - Pop $0 -FunctionEnd - -Function ModuleMinGWDownloadPageEnter - strcmp $MODULE_MINGW_INSTOK "yes" 0 +2 - Abort - - !insertmacro MUI_HEADER_TEXT "$(ModuleMinGWTitle)" "$(ModuleMinGWTitleDescription)" - Call UpdateCtrlStates - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${MODULE_MINGW_DOWNLOADPAGE}" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${MODULE_MINGW_DOWNLOADPAGE}" "Field 8" "State" "0" -FunctionEnd - -Function ModuleMinGWMirrorPageEnter - strcmp $MODULE_MINGW_DOWNLOAD "yes" +2 - Abort - - !insertmacro MUI_HEADER_TEXT "$(ModuleMinGWMirrorTitle)" "$(ModuleMinGWMirrorDescription)" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${MODULE_MINGW_MIRRORPAGE}" -FunctionEnd - -Function ModuleMinGWLicensePageEnter - strcmp $MODULE_MINGW_DOWNLOAD "yes" +2 - Abort -FunctionEnd - -Function UpdateCtrlStates - push $0 - push $1 - push $2 - - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_MINGW_DOWNLOADPAGE}" "Field 8" "State" - intop $0 $0 ! - FindWindow $2 "#32770" "" $HWNDPARENT - GetDlgItem $1 $2 1205 - EnableWindow $1 $0 - GetDlgItem $1 $2 1202 - EnableWindow $1 $0 - GetDlgItem $1 $2 1203 - EnableWindow $1 $0 - - intop $0 $0 ! - GetDlgItem $1 $2 1206 - EnableWindow $1 $0 - GetDlgItem $1 $2 1207 - EnableWindow $1 $0 - GetDlgItem $1 $2 1208 - EnableWindow $1 $0 - - GetDlgItem $1 $HWNDPARENT 1 - IntCmp $0 0 +3 - SendMessage $1 ${WM_SETTEXT} 0 "STR:Next >" - Goto +2 - SendMessage $1 ${WM_SETTEXT} 0 "STR:Install" - - pop $2 - pop $1 - pop $0 -FunctionEnd - -Function ModuleMinGWDownloadPageExit - push $0 - push $1 - - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_MINGW_DOWNLOADPAGE}" "Settings" "State" - strcmp "$0" "8" 0 NoNotify - Call UpdateCtrlStates - abort - NoNotify: - - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_MINGW_DOWNLOADPAGE}" "Field 8" "State" - strcmp "$0" "0" noDownload doDownload - -doDownload: - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_MINGW_DOWNLOADPAGE}" "Field 6" "State" - strcmp $0 "" 0 +3 - MessageBox MB_ICONEXCLAMATION|MB_OK "You need to specify an installation directory!" - goto tryAgain - - strcpy $MODULE_MINGW_COMPILERINSTDIR $0 - strcpy $MODULE_MINGW_DOWNLOAD "yes" - CreateDirectory "$MINGW_INSTDIR\downloads" - - Call DisableButtons - InetLoad::load /BANNER "Mirror Download" "Downloading mirrors from server..." "${MODULE_MINGW_URL}/${MODULE_MINGW_DOWNLOADFILE}.mirrors" "$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}.mirrors" /END - Pop $1 ;Get the return value - Call EnableButtons - - StrCmp $1 "OK" +3 - MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL "Was not able to download mirror list ($1)." IDRETRY tryAgain 0 - Quit - - call ModuleMinGWReadMirrors - !insertmacro MUI_INSTALLOPTIONS_WRITE ${MODULE_MINGW_MIRRORPAGE} "Field 3" "ListItems" "$MODULE_MINGW_MIRRORS" - goto done - -noDownload: - strcpy $MODULE_MINGW_DOWNLOAD "no" - strcpy $MODULE_MINGW_SOURCEDOWNLOAD "no" - call ModuleMinGWChecking - strcmp $MODULE_MINGW_INSTOK "yes" done - MessageBox MB_ICONEXCLAMATION|MB_YESNO "There is a problem with your MinGW installation:$\r$\n$MODULE_MINGW_INSTOK$\r$\nDo you still want to continue? (Your installation may not work)" IDNO tryAgain - goto done - -tryAgain: - pop $1 - pop $0 - Abort - -done: - pop $1 - pop $0 -FunctionEnd - -Function ModuleMinGWMirrorPageExit - push $0 - push $2 - push $1 - - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_MINGW_MIRRORPAGE}" "Field 3" "State" - strcmp "$0" "" 0 +3 - MessageBox MB_ICONEXCLAMATION|MB_OK "You must select a mirror to download from!" - goto tryAgain - - push $0 - call ModuleMinGWGetMirror - pop $0 - - Call DisableButtons - InetLoad::load /BANNER "MinGW Download" "Downloading MinGW from server..." "$0/${MODULE_MINGW_DOWNLOADFILE}.exe" "$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}.exe" /END - Pop $2 ;get the return value - Call EnableButtons - - StrCmp $2 "OK" +3 - MessageBox MB_ICONEXCLAMATION|MB_OK "Was not able to download MinGW ($2). Please try another mirror." - Goto tryAgain - - !insertmacro MUI_INSTALLOPTIONS_READ $1 "${MODULE_MINGW_MIRRORPAGE}" "Field 2" "State" - strcmp "$1" "0" done - - Call DisableButtons - InetLoad::load /BANNER "MinGW Sources Download" "Downloading MinGW Sources from server..." "$0/${MODULE_MINGW_DOWNLOADFILE}-src.exe" "$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}-src.exe" /END - Pop $2 - Call EnableButtons - - strcpy $MODULE_MINGW_SOURCEDOWNLOAD "yes" - - StrCmp $2 "OK" +3 - MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL "Was not able to download MinGW sources ($2). Please try another mirror?" IDRETRY tryAgain 0 - Quit - - goto done - -tryAgain: - pop $1 - pop $2 - pop $0 - Abort - -done: - pop $1 - pop $2 - pop $0 -FunctionEnd - -Function ModuleMinGWReadMirrors - push $0 ;file handle - push $1 ;line - - ClearErrors - FileOpen $0 "$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}.mirrors" r - IfErrors done - - strcpy $MODULE_MINGW_MIRRORS "" - -nextline: - FileRead $0 $1 - IfErrors done - push $1 - call ModuleMinGWRemoveNewLine - pop $1 - strcpy $MODULE_MINGW_MIRRORS "$MODULE_MINGW_MIRRORS|$1" - FileRead $0 $1 ;Jump over next line - IfErrors done - goto nextline - -done: - FileClose $0 - strlen $1 $MODULE_MINGW_MIRRORS - intcmp $1 0 failed failed cleanup - -failed: - MessageBox MB_ICONSTOP|MB_OK "Unable to parse mirror list, exiting!" - Quit - -cleanup: - pop $1 - pop $0 -FunctionEnd - -#this just removes the last two chars -Function ModuleMinGWRemoveNewLine -exch $0 -push $1 -push $2 - -strlen $1 $0 -intop $1 $1 - 1 -strcpy $2 $0 1 $1 ;get last char - -strcmp "$2" "$\n" 0 +2 -intop $1 $1 - 1 - -strcpy $2 $0 1 $1 ;get last char -strcmp "$2" "$\r" 0 +2 -intop $1 $1 - 1 - -intop $1 $1 + 1 -strcpy $0 $0 $1 - -pop $2 -pop $1 -exch $0 -FunctionEnd - -#push serverid -#call GetMirror -#pop server -Function ModuleMinGWGetMirror - exch $1 ;id - push $0 ;file handle - push $2 ;line - push $3 ;tmp - - strcpy $3 "" - - ClearErrors - FileOpen $0 "$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}.mirrors" r - IfErrors done - -nextline: - FileRead $0 $2 - IfErrors done - push $2 - call ModuleMinGWRemoveNewLine - pop $2 - strcmp $1 $2 0 nextline - FileRead $0 $3 - IfErrors done - push $3 - call ModuleMinGWRemoveNewLine - pop $3 - -done: - strcpy $1 $3 - FileClose $0 - strlen $2 $1 - intcmp $2 0 failed failed cleanup - -failed: - MessageBox MB_ICONSTOP|MB_OK "Unable to parse mirror list, exiting!" - Quit - -cleanup: - pop $3 - pop $2 - pop $0 - exch $1 -FunctionEnd - -Function ModuleMinGWChecking - push $0 - - ### update with plugin - strcpy $MODULE_MINGW_INSTOK "yes" - strcpy $MODULE_MINGW_COMPILERINSTDIR "C:\MinGW" ;fallback dir - - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_MINGW_DOWNLOADPAGE}" "Field 3" "State" - strcmp "$0" "" +2 - strcpy $MODULE_MINGW_COMPILERINSTDIR $0 - - IfFileExists "$MODULE_MINGW_COMPILERINSTDIR\bin\g++.exe" +3 0 - strcpy $MODULE_MINGW_INSTOK "g++ not found in $MODULE_MINGW_COMPILERINSTDIR\bin\" - goto DoneChecking - - ; check w32api.h - push $MODULE_MINGW_COMPILERINSTDIR - qtnsisext::HasValidWin32Library - pop $0 - strcmp "$0" "1" +3 0 - strcpy $MODULE_MINGW_INSTOK "The installer could not find a valid $MODULE_MINGW_COMPILERINSTDIR\include\w32api.h$\r$\n(The supported version is 3.2)" - goto DoneChecking - - ; check version - push $MODULE_MINGW_COMPILERINSTDIR - qtnsisext::GetMinGWVersion - pop $0 - strcmp "$0" "${MODULE_MINGW_COMPILERVERSION}" +3 0 - strcpy $MODULE_MINGW_INSTOK "g++ version found does not match ${MODULE_MINGW_COMPILERVERSION} (Found version $0)." - goto DoneChecking - -DoneChecking: - pop $0 -FunctionEnd - -# -# creates a qtvars.bat file in $QTDIR\bin -# push "c:\qt" #QTDIR -# call ModuleMinGWMakeEnvFile -# -Function ModuleMinGWMakeEnvFile - push $0 ; file handle - - ClearErrors - FileOpen $0 "$MINGW_INSTDIR\bin\qtvars.bat" w - IfErrors WriteMakeFile - FileWrite $0 "@echo off$\r$\n" - FileWrite $0 "rem$\r$\n" - FileWrite $0 "rem This file is generated$\r$\n" - FileWrite $0 "rem$\r$\n" - FileWrite $0 "$\r$\n" - FileWrite $0 "echo Setting up a MinGW/Qt only environment...$\r$\n" - FileWrite $0 "echo -- QTDIR set to $MINGW_INSTDIR$\r$\n" - FileWrite $0 "echo -- PATH set to $MINGW_INSTDIR\bin$\r$\n" - FileWrite $0 "echo -- Adding $MODULE_MINGW_COMPILERINSTDIR\bin to PATH$\r$\n" - FileWrite $0 "echo -- Adding %SystemRoot%\System32 to PATH$\r$\n" - FileWrite $0 "echo -- QMAKESPEC set to win32-g++$\r$\n" - FileWrite $0 "$\r$\n" - FileWrite $0 "set QTDIR=$MINGW_INSTDIR$\r$\n" - FileWrite $0 "set PATH=$MINGW_INSTDIR\bin$\r$\n" - FileWrite $0 "set PATH=%PATH%;$MODULE_MINGW_COMPILERINSTDIR\bin$\r$\n" - FileWrite $0 "set PATH=%PATH%;%SystemRoot%\System32$\r$\n" - FileWrite $0 "set QMAKESPEC=win32-g++$\r$\n" - FileWrite $0 "$\r$\n" - - FileWrite $0 'if not "%1"=="compile_debug" goto END$\r$\n' - FileWrite $0 "cd %QTDIR%$\r$\n" - FileWrite $0 "echo This will configure and compile qt in debug.$\r$\n" - FileWrite $0 "echo The release libraries will not be recompiled.$\r$\n" - FileWrite $0 "pause$\r$\n" - FileWrite $0 "configure -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg$\r$\n" - FileWrite $0 "cd %QTDIR%\src$\r$\n" - FileWrite $0 "qmake$\r$\n" - FileWrite $0 "mingw32-make debug$\r$\n" - FileWrite $0 ":END$\r$\n" - FileClose $0 - -WriteMakeFile: - ClearErrors - FileOpen $0 "$MINGW_INSTDIR\bin\make.bat" w - IfErrors done - FileWrite $0 "@echo off$\r$\n" - FileWrite $0 "mingw32-make %*$\r$\n" - FileClose $0 - -done: -; pop $1 - pop $0 -FunctionEnd - -Function MINGW_ValidateDirectoryFunc - push "${MODULE_MINGW_BUILDDIR}" - push $MINGW_INSTDIR - call CommonCheckDirectory -FunctionEnd -!macroend - -!macro MINGW_DESCRIPTION - !insertmacro MUI_DESCRIPTION_TEXT ${MINGW_SEC01} "This installs ${MODULE_MINGW_NAME} version ${MODULE_MINGW_VERSION} on your system." -!macroend - -!macro MINGW_STARTUP - !ifndef MODULE_MINGW_NODEFAULT - SectionSetFlags ${MINGW_SEC01} 17 - !endif - strcpy $MINGW_INSTDIR "C:\Qt\${MODULE_MINGW_VERSION}" - push $MINGW_INSTDIR - call MakeQtDirectory - pop $MINGW_INSTDIR - - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${MODULE_MINGW_DOWNLOADPAGE}" - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${MODULE_MINGW_MIRRORPAGE}" - - !insertmacro MUI_INSTALLOPTIONS_WRITE "${MODULE_MINGW_DOWNLOADPAGE}" "Field 3" "State" "C:\MinGW" - !insertmacro MUI_INSTALLOPTIONS_WRITE "${MODULE_MINGW_DOWNLOADPAGE}" "Field 6" "State" "C:\MinGW" - - strcpy $MODULE_MINGW_DOWNLOAD "no" - strcpy $MODULE_MINGW_SOURCEDOWNLOAD "no" -!macroend - -!macro MINGW_FINISH -!macroend - -!macro MINGW_RUN_FUNCTION - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "MINGWInstalled" - intcmp $0 1 0 DoneRunFunctionMINGW - - IfFileExists "$MINGW_INSTDIR\bin\qtdemo.exe" 0 +2 - Exec '$MINGW_INSTDIR\bin\qtdemo.exe' - goto DoneRunFunction ;don't run more applications - - DoneRunFunctionMINGW: -!macroend - -!macro MINGW_README_FUNCTION - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "MINGWInstalled" - intcmp $0 1 0 DoneReadmeFunctionMINGW - - IfFileExists "$MINGW_INSTDIR\bin\assistant.exe" 0 +2 - Exec '$MINGW_INSTDIR\bin\assistant.exe' - goto DoneReadmeFunction ;don't run more applications - - DoneReadmeFunctionMINGW: -!macroend - -!macro MINGW_UNSTARTUP - strcmp "$MINGW_INSTDIR" "" 0 +5 - StrCpy $MINGW_INSTDIR "$INSTDIR\${MODULE_MINGW_NAME} ${MODULE_MINGW_VERSION}" - push $MINGW_INSTDIR - call un.MakeQtDirectory - pop $MINGW_INSTDIR - - !insertmacro ConfirmOnRemove "MINGWInstalled" "- ${MODULE_MINGW_NAME} ${MODULE_MINGW_VERSION} in $MINGW_INSTDIR" -!macroend - -!macro MINGW_UNINSTALL -Section un.ModuleMinGW - push $0 - push $1 - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "MINGWInstalled" - intcmp $0 1 0 DoneUnInstallMINGW - - Delete "$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}.mirrors" - - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "MinGWSources" - strcmp $0 "" MinGWSourcesUninstallDone ;not installed - Delete "$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}-src.exe" - nsExec::ExecToLog '"$0\src\uninst.exe"' - pop $1 - MinGWSourcesUninstallDone: - - ReadRegStr $0 SHCTX "$PRODUCT_UNIQUE_KEY" "MinGWInstDir" - strcmp $0 "" MinGWUninstallDone ;not installed - Delete "$MINGW_INSTDIR\downloads\${MODULE_MINGW_DOWNLOADFILE}.exe" - nsExec::ExecToLog '"$0\uninst.exe"' - pop $1 - MinGWUninstallDone: - - DetailPrint "Removing start menu shortcuts" - call un.RemoveStartmenuApplication - Delete "$SMPROGRAMS\$STARTMENU_STRING\${MODULE_MINGW_NAME} ${MODULE_MINGW_VERSION} Command Prompt.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\${MODULE_MINGW_NAME} ${MODULE_MINGW_VERSION} (Build Debug Libraries).lnk" - - Delete "$MINGW_INSTDIR\bin\${MODULE_MINGW_RUNTIME_LIB}" - Delete "$MINGW_INSTDIR\bin\make.bat" - Delete "$MINGW_INSTDIR\bin\qtvars.bat" - - !insertmacro MODULE_MINGW_REMOVE "$MINGW_INSTDIR" - RMDir $MINGW_INSTDIR ;removes it if empty - - DoneUnInstallMINGW: - pop $1 - pop $0 -SectionEnd -!macroend -!macro MINGW_UNFINISH -!macroend -!else ;MODULE_MINGW -!macro MINGW_INITIALIZE -!macroend -!macro MINGW_SECTIONS -!macroend -!macro MINGW_DESCRIPTION -!macroend -!macro MINGW_STARTUP -!macroend -!macro MINGW_FINISH -!macroend -!macro MINGW_RUN_FUNCTION -!macroend -!macro MINGW_README_FUNCTION -!macroend -!macro MINGW_UNSTARTUP -!macroend -!macro MINGW_UNINSTALL -!macroend -!macro MINGW_UNFINISH -!macroend -!endif ;MODULE_MINGW - diff --git a/util/scripts/win-binary/nsis/modules/msvc.nsh b/util/scripts/win-binary/nsis/modules/msvc.nsh deleted file mode 100644 index 5c52ec4..0000000 --- a/util/scripts/win-binary/nsis/modules/msvc.nsh +++ /dev/null @@ -1,439 +0,0 @@ -!ifdef MODULE_MSVC - -!include "includes\system.nsh" - -!macro MSVC_INITIALIZE -!include "includes\qtcommon.nsh" -!ifndef MODULE_MSVC_NAME - !define MODULE_MSVC_NAME "Qt" -!endif -!ifndef MODULE_MSVC_VERSION - !define MODULE_MSVC_VERSION "${PRODUCT_VERSION}" -!endif -!ifndef MODULE_MSVC_BUILDDIR - !error "MODULE_MSVC_BUILDDIR not defined!" -!endif -var MSVC_QtDesktopInstallBuildTree -!include "includes\qtenv.nsh" -!macroend - -!macro MSVC_PATCH_QT_INSTALLATION QtBuildTree QtInstallBuildTree QtSourceTree QtInstallSourceTree DLLPDBDirName - Push "${QtInstallBuildTree}" - Call DeleteFloatingLicenseProgram - - Push "${QtInstallBuildTree}\bin" - Call AddStartmenuApplication - - Push "${QtBuildTree}" - Push "${QtInstallBuildTree}" - Call PatchPrlFiles - - ${If} ${FileExists} "${QtInstallBuildTree}\.qmake.cache" - Push "${QtInstallBuildTree}\.qmake.cache" - Push "${QtBuildTree}" - Push "${QtInstallBuildTree}" - Call PatchPath - ${If} "${QtInstallBuildTree}" != "${QtInstallSourceTree}" - Push "${QtInstallBuildTree}\.qmake.cache" - Push "${QtSourceTree}" - Push "${QtInstallSourceTree}" - Call PatchPath - ${EndIf} - ${EndIf} - - ${If} ${FileExists} "${QtInstallBuildTree}\mkspecs\default\qmake.conf" - Push "${QtInstallBuildTree}\mkspecs\default\qmake.conf" - Push "${QtSourceTree}" - Push "${QtInstallSourceTree}" - Call PatchPath - ${EndIf} - - Push "${DLLPDBDirName}" - Push "${QtInstallBuildTree}" - Call PatchCommonBinaryFiles - -!ifndef MODULE_MSVC_SKIPPATCHLICENSEINFORMATION - Push "${QtInstallBuildTree}" - Call PatchLicenseInformation -!endif - - Push "${DLLPDBDirName}" - Push "${QtBuildTree}" - Push "${QtInstallBuildTree}" - Call PatchMSVCBinaryFiles - ${If} "${QtInstallBuildTree}" != "${QtInstallSourceTree}" - Push "${DLLPDBDirName}" - Push "${QtSourceTree}" - Push "${QtInstallSourceTree}" - Call PatchMSVCBinaryFiles - ${EndIf} -!macroend ;MSVC_PATCH_QT_INSTALLATION - -!macro MSVC_POST_WIN32_INSTALLFILES QtBuildTree QtInstallBuildTree QtSourceTree QtInstallSourceTree VersionName - !insertmacro MSVC_PATCH_QT_INSTALLATION \ - "${QtBuildTree}" \ - "${QtInstallBuildTree}" \ - "${QtSourceTree}" \ - "${QtInstallSourceTree}" \ - "bin" - - Push "${VersionName}" - Push "${QtInstallBuildTree}" - Call MSVC_AddQtVersionToRegistry - - Push "${INSTALL_COMPILER}" - Push "${QtInstallBuildTree}" - Push "" - Push "${VersionName}" - Call MSVC_CreateQtVarsBatAndShortcut - - StrCpy $MSVC_QtDesktopInstallBuildTree "${QtInstallBuildTree}" -!macroend ;MSVC_POST_WIN32_INSTALLFILES - -!macro MSVC_POST_WINCE_INSTALLFILES QtBuildTree QtInstallBuildTree QtSourceTree QtInstallSourceTree VersionName WinCESDK - !insertmacro MSVC_PATCH_QT_INSTALLATION \ - "${QtBuildTree}" \ - "${QtInstallBuildTree}" \ - "${QtSourceTree}" \ - "${QtInstallSourceTree}" \ - "lib" - - Push "${VersionName}" - Push "${QtInstallBuildTree}" - Call MSVC_AddQtVersionToRegistry - - Push "${INSTALL_COMPILER}ce" - Push "${QtInstallBuildTree}" - Push "${WinCESDK}" - Push "${VersionName}" - Call MSVC_CreateQtVarsBatAndShortcut -!macroend ;MSVC_POST_WINCE_INSTALLFILES - -!macro MSVC_PATCH_MSVC_BINARY_FILE BinaryFile QtBuildDir QtInstallDir - ${If} ${FileExists} "${BinaryFile}" - DetailPrint "Patching ${BinaryFile} (${QtInstallDir})..." -!ifdef MODULE_MSVC_VC60 - qtnsisext::PatchVC6Binary "${BinaryFile}" "${QtBuildDir}" "${QtInstallDir}" -!else - qtnsisext::PatchVC7Binary "${BinaryFile}" "${QtBuildDir}" "${QtInstallDir}" -!endif - ${EndIf} -!macroend - -!macro MSVC_SECTIONS -Section "${MODULE_MSVC_NAME} ${MODULE_MSVC_VERSION}" MSVC_SEC01 - ${If} "$MSVC_INSTDIR" == "" - StrCpy $MSVC_INSTDIR "$INSTDIR\${MODULE_MSVC_NAME} ${MODULE_MSVC_VERSION}" - Push $MSVC_INSTDIR - Call MakeQtDirectory - Pop $MSVC_INSTDIR - ${EndIf} - - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "MSVCInstalled" 1 - - SetOutPath "$MSVC_INSTDIR" - SetOverwrite ifnewer - !insertmacro MODULE_MSVC_INSTALLFILES - -!ifdef MODULE_MSVC_WIN32BUILDTREE & MODULE_MSVC_WIN32BUILDINSTALLDIRNAME & MODULE_MSVC_QTSOURCETREE & MODULE_MSVC_QTSOURCEINSTALLDIRNAME - !insertmacro MSVC_POST_WIN32_INSTALLFILES \ - "${MODULE_MSVC_WIN32BUILDTREE}" /* QtBuildTree */ \ - "$MSVC_INSTDIR\${MODULE_MSVC_WIN32BUILDINSTALLDIRNAME}" /* QtInstallBuildTree */ \ - "${MODULE_MSVC_QTSOURCETREE}" /* QtSourceTree */ \ - "$MSVC_INSTDIR\${MODULE_MSVC_QTSOURCEINSTALLDIRNAME}" /* QtInstallSourceTree */ \ - "${MODULE_MSVC_VERSION} Desktop" /* VersionName */ -!endif -!ifdef MODULE_MSVC_WM50BUILDTREE & MODULE_MSVC_WM50BUILDINSTALLDIRNAME & MODULE_MSVC_QTSOURCETREE & MODULE_MSVC_QTSOURCEINSTALLDIRNAME - !insertmacro MSVC_POST_WINCE_INSTALLFILES \ - "${MODULE_MSVC_WM50BUILDTREE}" /* QtBuildTree */ \ - "$MSVC_INSTDIR\${MODULE_MSVC_WM50BUILDINSTALLDIRNAME}" /* QtInstallBuildTree */ \ - "${MODULE_MSVC_QTSOURCETREE}" /* QtSourceTree */ \ - "$MSVC_INSTDIR\${MODULE_MSVC_QTSOURCEINSTALLDIRNAME}" /* QtInstallSourceTree */ \ - "${MODULE_MSVC_VERSION} ${MODULE_MSVC_WM50VERSIONPRETTY}" /* VersionName */ \ - ${MODULE_MSVC_WM50SDK} /* WinCESDK */ -!endif -!ifdef MODULE_MSVC_SSDK50X86BUILDTREE & MODULE_MSVC_SSDK50X86BUILDINSTALLDIRNAME & MODULE_MSVC_QTSOURCETREE & MODULE_MSVC_QTSOURCEINSTALLDIRNAME - !insertmacro MSVC_POST_WINCE_INSTALLFILES \ - "${MODULE_MSVC_SSDK50X86BUILDTREE}" /* QtBuildTree */ \ - "$MSVC_INSTDIR\${MODULE_MSVC_SSDK50X86BUILDINSTALLDIRNAME}" /* QtInstallBuildTree */ \ - "${MODULE_MSVC_QTSOURCETREE}" /* QtSourceTree */ \ - "$MSVC_INSTDIR\${MODULE_MSVC_QTSOURCEINSTALLDIRNAME}" /* QtInstallSourceTree */ \ - "${MODULE_MSVC_VERSION} ${MODULE_MSVC_SSDK50X86VERSIONPRETTY}" /* VersionName */ \ - ${MODULE_MSVC_SSDK50X86SDK} /* WinCESDK */ -!endif -!ifndef MODULE_MSVC_WIN32BUILDTREE | MODULE_MSVC_WM50BUILDTREE | MODULE_MSVC_QTSOURCETREE | MODULE_MSVC_QTSOURCEINSTALLDIRNAME - !insertmacro MSVC_POST_WIN32_INSTALLFILES \ - "${MODULE_MSVC_BUILDDIR}" /* QtBuildTree */ \ - "$MSVC_INSTDIR" /* QtInstallBuildTree */ \ - "${MODULE_MSVC_BUILDDIR}" /* QtSourceTree */ \ - "$MSVC_INSTDIR" /* QtInstallSourceTree */ \ - "${MODULE_MSVC_VERSION}" /* VersionName */ -!endif - -!ifdef MODULE_LICENSECHECK - WriteRegStr SHCTX "SOFTWARE\Trolltech\Common\${MODULE_MSVC_VERSION}\$LICENSE_PRODUCT" "Key" "$LICENSE_KEY" - call MSVC_UpdateExistingVsipLicenseKeys -!endif - -SectionEnd - -Function PatchMSVCBinaryFiles - Exch $0 ; Absolute path to where Qt is installed - Exch - Exch $1 ; Absolute path to where Qt was built - Exch - Exch 2 - Exch $2 ; Name of directory containing PDBs - Exch 2 - Push $3 ; FindFirst/FindNext handle - Push $4 ; Found .pdb file name - - FindFirst $3 $4 "$0\$2\*.pdb" - ${DoWhile} $4 != "" - !insertmacro MSVC_PATCH_MSVC_BINARY_FILE "$0\$2\$4" "$1" "$0" - FindNext $3 $4 - ${Loop} - - !insertmacro MSVC_PATCH_MSVC_BINARY_FILE "$0\lib\qtmaind.lib" "$1" "$0" - - Pop $4 - Pop $3 - Pop $0 - Pop $1 - Pop $2 -FunctionEnd - -Function MSVC_AddQtVersionToRegistry - Exch $0 ; VersionDir - Exch - Exch $1 ; VersionName - Exch - Push $2 - - WriteRegStr HKCU "${QT_VERSION_KEY_NAME}\$1\" "InstallDir" "$0" - ${If} "$RUNNING_AS_ADMIN" == true - WriteRegStr HKLM "${QT_VERSION_KEY_NAME}\$1\" "InstallDir" "$0" - ${EndIf} - - ReadRegStr $2 HKCU "${QT_VERSION_KEY_NAME}" "DefaultQtVersion" - ${If} $2 == "" - WriteRegStr HKCU "${QT_VERSION_KEY_NAME}" "DefaultQtVersion" "$1" - ${EndIf} - - Pop $2 - Pop $0 - Pop $1 -FunctionEnd ;MSVC_AddQtVersionToRegistry - -Function MSVC_CreateQtVarsBatAndShortcut - Exch $0 ; VersionName - Exch - Exch $1 ; WinCESDK - Exch - Exch 2 - Exch $2 ; QtBuildTree - Exch 2 - Exch 3 - Exch $3 ; Compiler - Exch 3 - Push $4 ; Found substring "command.com" - Push $5 ; Expanded %COMSPEC% - - ${If} ${FileExists} "$2\bin\qmake.exe" - !insertmacro MAKE_QTVARS_FILE "$3" "$2" "$1" - !insertmacro CreateConditionalShortCutWithParameters "$SMPROGRAMS\$STARTMENU_STRING\Visual Studio with ${MODULE_MSVC_NAME} $0.lnk" "$2\bin\qtvars.bat" "vsstart" - - ExpandEnvStrings $5 "%COMSPEC%" - ${StrStr} $4 "$5" "command.com" - ${If} "$4" == "" - !insertmacro CreateConditionalShortCutWithParameters "$SMPROGRAMS\$STARTMENU_STRING\${MODULE_MSVC_NAME} $0 Command Prompt.lnk" "%COMSPEC%" "/k $\"$2\bin\qtvars.bat vsvars$\"" - ${Else} - !insertmacro CreateConditionalShortCutWithParameters "$SMPROGRAMS\$STARTMENU_STRING\${MODULE_MSVC_NAME} $0 Command Prompt.lnk" "%COMSPEC%" "/e:4096 /k $\"$2\bin\qtvars.bat vsvars$\"" - ${EndIf} - ${EndIf} - - Pop $5 - Pop $4 - Pop $0 - Pop $1 - Pop $2 - Pop $3 -FunctionEnd ;MSVC_CreateQtVarsBatAndShortcut - -Function MSVC_ValidateDirectoryFunc - push "${MODULE_MSVC_BUILDDIR}" - push $MSVC_INSTDIR - call CommonCheckDirectory -FunctionEnd - -Function MSVC_UpdateExistingVsipLicenseKeys - Push $0 ; EnumRegKey loop index - Push $1 ; Reg key - Push $2 ; StrStr result - - StrCpy $0 0 - loop: - EnumRegKey $1 SHCTX SOFTWARE\Trolltech $0 - StrCmp $1 "" no_reg_key_found - ${StrStr} $2 $1 "Qt4VS" - StrCmp $2 $1 0 +1 - WriteRegStr SHCTX "SOFTWARE\Trolltech\$2" "LicenseKey" "$LICENSE_KEY" - IntOp $0 $0 + 1 - goto loop - no_reg_key_found: - - Pop $2 - Pop $1 - Pop $0 -FunctionEnd -!macroend - -!macro MSVC_DESCRIPTION - !insertmacro MUI_DESCRIPTION_TEXT ${MSVC_SEC01} "This installs ${MODULE_MSVC_NAME} version ${MODULE_MSVC_VERSION} on your system." -!macroend - -!macro MSVC_STARTUP - !ifdef MODULE_MSVC_VS2005 - Call IsVS2005SP1Installed - Pop $1 - ${If} $1 == 0 - MessageBox MB_OK|MB_ICONEXCLAMATION "Service Pack 1 for Visual Studio 2005 is not installed.$\n${PRODUCT_NAME} for VS 2005 will not work properly without it." - Abort - ${EndIf} - !endif - - !ifndef MODULE_MSVC_NODEFAULT - SectionSetFlags ${MSVC_SEC01} 17 - !endif - strcpy $MSVC_INSTDIR "C:\Qt\${MODULE_MSVC_VERSION}" - push $MSVC_INSTDIR - call MakeQtDirectory - pop $MSVC_INSTDIR -!macroend - -!macro MSVC_FINISH -!macroend - -!macro MSVC_RUN_FUNCTION - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "MSVCInstalled" - ${If} $0 == 1 - ${If} ${FileExists} "$MSVC_QtDesktopInstallBuildTree\bin\qtdemo.exe" - Exec '$MSVC_QtDesktopInstallBuildTree\bin\qtdemo.exe' - ${EndIf} - Goto DoneRunFunction ;don't run more applications - ${EndIf} -!macroend - -!macro MSVC_README_FUNCTION - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "MSVCInstalled" - ${If} $0 == 1 - ${If} ${FileExists} "$MSVC_QtDesktopInstallBuildTree\bin\assistant.exe" -!ifndef README_STARTPAGE - Exec "$MSVC_QtDesktopInstallBuildTree\bin\assistant.exe" -!else - Exec "$MSVC_QtDesktopInstallBuildTree\bin\assistant.exe -showurl $\"${README_STARTPAGE}$\"" -!endif - ${EndIf} - Goto DoneReadmeFunction ;don't run more applications - ${EndIf} -!macroend - -!macro MSVC_UNSTARTUP - ${If} "$MSVC_INSTDIR" == "" - StrCpy $MSVC_INSTDIR "$INSTDIR\${MODULE_MSVC_NAME} ${MODULE_MSVC_VERSION}" - Push $MSVC_INSTDIR - Call un.MakeQtDirectory - Pop $MSVC_INSTDIR - ${EndIf} - - !insertmacro ConfirmOnRemove "MSVCInstalled" "- ${MODULE_MSVC_NAME} ${MODULE_MSVC_VERSION} in $MSVC_INSTDIR" -!macroend - -!macro MSVC_POST_UNINSTALLFILES QtInstallBuildTree VersionName - Delete "$SMPROGRAMS\$STARTMENU_STRING\Visual Studio with ${MODULE_MSVC_NAME} ${VersionName}.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\${MODULE_MSVC_NAME} ${VersionName} Command Prompt.lnk" - Delete "${QtInstallBuildTree}\bin\qtvars.bat" - - Push "${VersionName}" - Push "${QtInstallBuildTree}" - Call un.MSVC_RemoveQtVersionFromRegistry -!macroend ;MSVC_POST_UNINSTALLFILES - -!macro MSVC_UNINSTALL -Section un."${MODULE_MSVC_NAME} ${MODULE_MSVC_VERSION}" - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "MSVCInstalled" - ${If} $0 == 1 - DetailPrint "Removing start menu shortcuts and registry entries" - Call un.RemoveStartmenuApplication -!ifdef MODULE_MSVC_WIN32BUILDTREE & MODULE_MSVC_WIN32BUILDINSTALLDIRNAME & MODULE_MSVC_QTSOURCETREE & MODULE_MSVC_QTSOURCEINSTALLDIRNAME - !insertmacro MSVC_POST_UNINSTALLFILES \ - "$MSVC_INSTDIR\${MODULE_MSVC_WIN32BUILDINSTALLDIRNAME}" \ - "${MODULE_MSVC_VERSION} Desktop" -!endif -!ifdef MODULE_MSVC_WM50BUILDTREE & MODULE_MSVC_WM50BUILDINSTALLDIRNAME & MODULE_MSVC_QTSOURCETREE & MODULE_MSVC_QTSOURCEINSTALLDIRNAME - !insertmacro MSVC_POST_UNINSTALLFILES \ - "$MSVC_INSTDIR\${MODULE_MSVC_WM50BUILDINSTALLDIRNAME}" \ - "${MODULE_MSVC_VERSION} ${MODULE_MSVC_WM50VERSIONPRETTY}" -!endif -!ifdef MODULE_MSVC_SSDK50X86BUILDTREE & MODULE_MSVC_SSDK50X86BUILDINSTALLDIRNAME & MODULE_MSVC_QTSOURCETREE & MODULE_MSVC_QTSOURCEINSTALLDIRNAME - !insertmacro MSVC_POST_UNINSTALLFILES \ - "$MSVC_INSTDIR\${MODULE_MSVC_SSDK50X86BUILDINSTALLDIRNAME}" \ - "${MODULE_MSVC_VERSION} ${MODULE_MSVC_SSDK50X86VERSIONPRETTY}" -!endif -!ifndef MODULE_MSVC_WIN32BUILDTREE | MODULE_MSVC_WM50BUILDTREE | MODULE_MSVC_QTSOURCETREE | MODULE_MSVC_QTSOURCEINSTALLDIRNAME - !insertmacro MSVC_POST_UNINSTALLFILES \ - "$MSVC_INSTDIR" \ - "${MODULE_MSVC_VERSION}" -!endif - !insertmacro MODULE_MSVC_REMOVE "$MSVC_INSTDIR" - RMDir $MSVC_INSTDIR ;removes it if empty - ${EndIf} -SectionEnd - -Function un.MSVC_RemoveQtVersionFromRegistry - Exch $0 ; QtInstallBuildTree - Exch - Exch $1 ; VersionName - Exch - Push $2 ; Temp - - ReadRegStr $2 HKCU "${QT_VERSION_KEY_NAME}\$1" "InstallDir" - ${If} "$2" == "$0" - DeleteRegKey HKCU "${QT_VERSION_KEY_NAME}\$1" - ${EndIf} - - ReadRegStr $2 HKLM "${QT_VERSION_KEY_NAME}\$1" "InstallDir" - ${If} "$2" == "$0" - DeleteRegKey HKLM "${QT_VERSION_KEY_NAME}\$1" - ${EndIf} - - Pop $2 - Pop $0 - Pop $1 -FunctionEnd -!macroend -!macro MSVC_UNFINISH -!macroend -!else ;MODULE_MSVC -!macro MSVC_INITIALIZE -!macroend -!macro MSVC_SECTIONS -!macroend -!macro MSVC_DESCRIPTION -!macroend -!macro MSVC_STARTUP -!macroend -!macro MSVC_FINISH -!macroend -!macro MSVC_README_FUNCTION -!macroend -!macro MSVC_RUN_FUNCTION -!macroend -!macro MSVC_UNSTARTUP -!macroend -!macro MSVC_UNINSTALL -!macroend -!macro MSVC_UNFINISH -!macroend -!endif ;MODULE_MSVC - diff --git a/util/scripts/win-binary/nsis/modules/opensource.nsh b/util/scripts/win-binary/nsis/modules/opensource.nsh deleted file mode 100644 index 19f154d..0000000 --- a/util/scripts/win-binary/nsis/modules/opensource.nsh +++ /dev/null @@ -1,56 +0,0 @@ -!ifdef MODULE_OPENSOURCE -!macro OPENSOURCE_INITIALIZE - !define MODULE_OPENSOURCE_PAGE "opensource.ini" - page custom ModuleOpenSourceShowPage -!macroend -!macro OPENSOURCE_SECTIONS - Section -ModuleOpenSourceSection - !ifdef MODULE_OPENSOURCE_ROOT - SetOutPath "$INSTDIR" - File "${MODULE_OPENSOURCE_ROOT}\OPENSOURCE-NOTICE.TXT" - !endif - !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\OpenSource Notice.lnk" "$INSTDIR\OPENSOURCE-NOTICE.TXT" - SectionEnd - - Function ModuleOpenSourceShowPage - !insertmacro MUI_HEADER_TEXT "Open Source Edition" " " - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${MODULE_OPENSOURCE_PAGE}" - strcpy "$LICENSEE" "Open Source" - strcpy "$LICENSE_PRODUCT" "OpenSource" - FunctionEnd -!macroend -!macro OPENSOURCE_DESCRIPTION -!macroend -!macro OPENSOURCE_STARTUP - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${MODULE_OPENSOURCE_PAGE}" -!macroend -!macro OPENSOURCE_FINISH -!macroend -!macro OPENSOURCE_UNSTARTUP -!macroend -!macro OPENSOURCE_UNINSTALL - Section -un.ModuleOpenSourceSection - Delete "$SMPROGRAMS\$STARTMENU_STRING\OpenSource Notice.lnk" - SectionEnd -!macroend -!macro OPENSOURCE_UNFINISH -!macroend -!else ;MODULE_OPENSOURCE -!macro OPENSOURCE_INITIALIZE -!macroend -!macro OPENSOURCE_SECTIONS -!macroend -!macro OPENSOURCE_DESCRIPTION -!macroend -!macro OPENSOURCE_STARTUP -!macroend -!macro OPENSOURCE_FINISH -!macroend -!macro OPENSOURCE_UNSTARTUP -!macroend -!macro OPENSOURCE_UNINSTALL -!macroend -!macro OPENSOURCE_UNFINISH -!macroend -!endif ;MODULE_OPENSOURCE - diff --git a/util/scripts/win-binary/nsis/modules/qsa.nsh b/util/scripts/win-binary/nsis/modules/qsa.nsh deleted file mode 100644 index ab74300..0000000 --- a/util/scripts/win-binary/nsis/modules/qsa.nsh +++ /dev/null @@ -1,255 +0,0 @@ -!ifdef MODULE_QSA -!macro QSA_INITIALIZE - !include "includes\qtenv.nsh" - !define MODULE_QSA_OPTIONPAGE "qsa.ini" - !ifndef MODULE_QSA_NAME - !define MODULE_QSA_NAME "QSA" - !endif - !ifndef MODULE_QSA_VERSION - !define MODULE_QSA_VERSION ${PRODUCT_VERSION} - !endif - !ifndef MODULE_QSA_ROOT - !define MODULE_QSA_ROOT "${INSTALL_ROOT}\qsa" - !endif - !ifndef MODULE_QSA_INTEGRATE - !include "includes\qtdir.nsh" - !insertmacro QTDIR_INITIALIZE - !endif - - var MODULE_QSA_NOIDE - var MODULE_QSA_NOEDITOR - - LangString ModuleQSATitle ${LANG_ENGLISH} "${MODULE_QSA_NAME} ${MODULE_QSA_VERSION} Build Options" - LangString ModuleQSADescription ${LANG_ENGLISH} "Do you want build the QSA Workbench and the QSA Editor?" - Page custom ModuleQSAOptionsPageEnter ModuleQSAOptionsPageExit -!macroend -!macro QSA_SECTIONS - Section "${MODULE_QSA_NAME} ${MODULE_QSA_VERSION}" QSA_SEC01 - push $0 - strcmp "$QSA_INSTDIR" "" 0 +2 - StrCpy $QSA_INSTDIR "$INSTDIR\${MODULE_QSA_NAME} ${MODULE_QSA_VERSION}" - - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QSAInstalled" 1 - - SetOutPath "$QSA_INSTDIR" - SetOverwrite ifnewer - File /r "${MODULE_QSA_ROOT}\*.*" - - call QsaModuleWriteBuildFile - - DetailPrint "Please wait while building ${MODULE_QSA_NAME} ${MODULE_QSA_VERSION}..." - nsExec::ExecToLog "$QSA_INSTDIR\qsabuild.bat" - pop $0 - strcmp "$0" "0" +2 - MessageBox MB_OK|MB_ICONEXCLAMATION "Building ${MODULE_QSA_NAME} ${MODULE_QSA_VERSION} failed.$\r$\nLook at the output, resolve the problem, and try to rebuild it manually.$\r$\n(errorcode: $0)" - - call ModuleQSAAddShortCuts - - pop $0 - SectionEnd - - !ifndef MODULE_QSA_INTEGRATE - !insertmacro QTDIR_FUNCTIONS - !endif - - Function ModuleQSAOptionsPageEnter - !insertmacro MUI_HEADER_TEXT "$(ModuleQSATitle)" "$(ModuleQSADescription)" - push $0 - ${strstr} $0 "$QTDIR_SELECTED" "4.0.0" - strcmp $0 "" +2 - MessageBox MB_OK|MB_ICONEXCLAMATION "QSA 1.2.0 requires Qt 4.0.1 snapshots or later" - pop $0 - - - strcmp "$MODULE_QSA_NOIDE" "" +3 - !insertmacro MUI_INSTALLOPTIONS_WRITE ${MODULE_QSA_OPTIONPAGE} "Field 2" "State" "1" - goto +2 - !insertmacro MUI_INSTALLOPTIONS_WRITE ${MODULE_QSA_OPTIONPAGE} "Field 2" "State" "0" - - strcmp "$MODULE_QSA_NOEDITOR" "" +3 - !insertmacro MUI_INSTALLOPTIONS_WRITE ${MODULE_QSA_OPTIONPAGE} "Field 3" "State" "1" - goto +2 - !insertmacro MUI_INSTALLOPTIONS_WRITE ${MODULE_QSA_OPTIONPAGE} "Field 3" "State" "0" - - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${MODULE_QSA_OPTIONPAGE}" - FunctionEnd - -Function ModuleQSAAddShortCuts - push $0 - push $1 - push $2 - push $3 - - !insertmacro CreateConditionalShortCutDirectory "$SMPROGRAMS\$STARTMENU_STRING\Examples" - - FindFirst $0 $1 "$QSA_INSTDIR\examples\*.*" -loop: - StrCmp $1 "" done - IfFileExists "$QSA_INSTDIR\examples\$1\release\$1.exe" 0 +3 - strcpy $2 "release" - goto +3 - IfFileExists "$QSA_INSTDIR\examples\$1\debug\$1.exe" 0 example_shortcuts_next - strcpy $2 "debug" - - FileOpen $3 "$QSA_INSTDIR\examples\$1\$1.bat" w - IfErrors example_shortcuts_next - FileWrite $3 "@rem ----------------------$\r$\n" - FileWrite $3 "@rem This file is generated$\r$\n" - FileWrite $3 "@rem ----------------------$\r$\n" - FileWrite $3 "$\r$\n" - FileWrite $3 "set PATH=$QTDIR_SELECTED\bin;%PATH%$\r$\n" - FileWrite $3 "start $2\$1.exe$\r$\n" - FileClose $3 - - SetOutPath "$QSA_INSTDIR\examples\$1" - !insertmacro CreateConditionalShortCutWithParameters "$SMPROGRAMS\$STARTMENU_STRING\Examples\$1.lnk" "%COMSPEC%" "/c $1.bat" -example_shortcuts_next: - FindNext $0 $1 - Goto loop - - done: - SetOutPath "$QSA_INSTDIR" - pop $3 - pop $2 - pop $1 - pop $0 -FunctionEnd - - - Function ModuleQSAOptionsPageExit - push $0 - !insertmacro MUI_INSTALLOPTIONS_READ $0 ${MODULE_QSA_OPTIONPAGE} "Field 2" "State" - strcmp "$0" "1" +3 - strcpy $MODULE_QSA_NOIDE "" - goto +2 - strcpy $MODULE_QSA_NOIDE "-no-ide " - - !insertmacro MUI_INSTALLOPTIONS_READ $0 ${MODULE_QSA_OPTIONPAGE} "Field 3" "State" - strcmp "$0" "1" +3 - strcpy $MODULE_QSA_NOEDITOR "" - goto +2 - strcpy $MODULE_QSA_NOEDITOR "-no-editor " - - pop $0 - FunctionEnd - - Function QsaModuleWriteBuildFile - push $0 ; file handle - push $1 ; compiler - push $2 ; qmakespec - push $3 ; vars file - - push $COMPILER_SELECTED - call GetShortCompilerName - pop $1 - - push $1 - call GetMkSpec - pop $2 - - push $1 - call GetVSVarsFile - pop $3 - - ClearErrors - FileOpen $0 "$QSA_INSTDIR\qsabuild.bat" w - IfErrors done - FileWrite $0 "@rem ----------------------$\r$\n" - FileWrite $0 "@rem This file is generated$\r$\n" - FileWrite $0 "@rem ----------------------$\r$\n" - FileWrite $0 "$\r$\n" - FileWrite $0 "@echo Setting QTDIR to $QTDIR_SELECTED$\r$\n" - FileWrite $0 "@set QTDIR=$QTDIR_SELECTED$\r$\n" - FileWrite $0 "$\r$\n" - FileWrite $0 "@echo Adding %QTDIR%\bin to PATH$\r$\n" - FileWrite $0 "@set PATH=%QTDIR%\bin;%PATH%$\r$\n" - FileWrite $0 "$\r$\n" - FileWrite $0 "@echo Setting QMAKESPEC to $2$\r$\n" - FileWrite $0 "@set QMAKESPEC=$2$\r$\n" - FileWrite $0 "$\r$\n" - strcmp "$3" "" +3 - FileWrite $0 '@call "$3"$\r$\n' - FileWrite $0 "$\r$\n" - FileWrite $0 "@echo Running configure in $QSA_INSTDIR$\r$\n" - FileWrite $0 "@cd $QSA_INSTDIR$\r$\n" - FileWrite $0 "@configure $MODULE_QSA_NOIDE$MODULE_QSA_NOEDITOR-automake$\r$\n" - FileWrite $0 "$\r$\n" - FileClose $0 - done: - - pop $3 - pop $2 - pop $1 - pop $0 - FunctionEnd -!macroend -!macro QSA_CHECKLICENSEPRODUCT - push $0 - qtnsisext::HasLicenseProduct $LICENSE_KEY "QSA" - pop $0 - strcmp $0 "1" QSALicenseOK - SectionSetText ${QSA_SEC01} "${MODULE_QSA_NAME} (No License)" - SectionSetFlags ${QSA_SEC01} 16 - QSALicenseOK: - pop $0 -!macroend -!macro QSA_DESCRIPTION - !insertmacro MUI_DESCRIPTION_TEXT ${QSA_SEC01} "This installs ${MODULE_QSA_NAME} version ${MODULE_QSA_VERSION} on your system." -!macroend -!macro QSA_STARTUP - !ifndef MODULE_QSA_INTEGRATE - !insertmacro QTDIR_STARTUP - !endif - strcpy $QSA_INSTDIR "C:\${MODULE_QSA_NAME}\${MODULE_QSA_VERSION}" - strcpy $MODULE_QSA_NOIDE "" - strcpy $MODULE_QSA_NOEDITOR "" - - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${MODULE_QSA_OPTIONPAGE}" -!macroend -!macro QSA_FINISH -!macroend -!macro QSA_RUN_FUNCTION -!macroend -!macro QSA_UNSTARTUP - strcmp "$QSA_INSTDIR" "" 0 +2 - StrCpy $QSA_INSTDIR "$INSTDIR\${MODULE_QSA_NAME} ${MODULE_QSA_VERSION}" - - !insertmacro ConfirmOnRemove "QSAInstalled" "$QSA_INSTDIR" -!macroend -!macro QSA_UNINSTALL - Section un."${MODULE_QSA_NAME} ${MODULE_QSA_VERSION}" - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "QSAInstalled" - intcmp $0 1 0 DoneUnInstallQSA - - DetailPrint "Removing installation directory..." - RMDir /r "$QSA_INSTDIR" - RmDir /r "$SMPROGRAMS\$STARTMENU_STRING\Examples" - - DoneUnInstallQSA: - SectionEnd -!macroend -!macro QSA_UNFINISH -!macroend -!else ;MODULE_QSA -!macro QSA_INITIALIZE -!macroend -!macro QSA_SECTIONS -!macroend -!macro QSA_CHECKLICENSEPRODUCT -!macroend -!macro QSA_DESCRIPTION -!macroend -!macro QSA_STARTUP -!macroend -!macro QSA_FINISH -!macroend -!macro QSA_RUN_FUNCTION -!macroend -!macro QSA_UNSTARTUP -!macroend -!macro QSA_UNINSTALL -!macroend -!macro QSA_UNFINISH -!macroend -!endif ;MODULE_QSA - diff --git a/util/scripts/win-binary/nsis/modules/qtdemo.nsh b/util/scripts/win-binary/nsis/modules/qtdemo.nsh deleted file mode 100644 index 9f4fe5f..0000000 --- a/util/scripts/win-binary/nsis/modules/qtdemo.nsh +++ /dev/null @@ -1,112 +0,0 @@ -!ifdef MODULE_QTDEMO - -;------------------------------- -; Test which version of Microsoft DirectX is installed -; Returns e.g. 900 for version 9 -; -; Original code is from nsis.sourceforge.net -Function GetDXVersion - Push $0 - Push $1 - - ClearErrors - ReadRegStr $0 HKLM "Software\Microsoft\DirectX" "Version" - IfErrors noDirectX - - StrCpy $1 $0 2 5 ; get the minor version - StrCpy $0 $0 2 2 ; get the major version - IntOp $0 $0 * 100 ; $0 = major * 100 + minor - IntOp $0 $0 + $1 - Goto done - -noDirectX: - StrCpy $0 0 - -done: - Pop $1 - Exch $0 -FunctionEnd - -;------------------------------- -; Test if Visual Studio Redistributables 2005+ SP1 installed -; Returns -1 if there is no VC redistributables installed -; otherwise returns version number (e.g. 134274064 for VS2005 SP1) -; -; Original code is from nsis.sourceforge.net -Function CheckVCRedist - Push $0 - ClearErrors - ReadRegDword $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7299052b-02a4-4627-81f2-1818da5d550d}" "Version" - - IfErrors 0 done - StrCpy $0 -1 - -done: - Exch $0 -FunctionEnd - - -!macro INSTALLVCREDIST VCREDIST_EXE - Push $R0 - DetailPrint "Checking for Microsoft Visual C++ 2005 SP1 Redistributable Runtime ..." - Call CheckVCRedist - Pop $R0 - IntCmp $R0 134274064 vcexists +1 +1 ; 134274064 = 800dc10 - MessageBox MB_YESNO|MB_ICONINFORMATION "Qt demo requires the Microsoft Visual C++ 2005 SP1 Runtime to be installed. Do you want to install the Runtime now?" IDYES vcinstall IDNO vcdone -vcinstall: - DetailPrint "Installing Microsoft Visual C++ 2005 SP1 Runtime ..." - nsExec::Exec '"$INSTDIR\${VCREDIST_EXE}" /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /i vcredist.msi /qb!"" "' $R0 - IntCmp $R0 1 vcdone vcdone +1 ; return value 0,1 -> done - IntCmp $R0 3010 0 vcerror vcerror ; other return values - MessageBox MB_OK|MB_ICONINFORMATION "Please reboot after finishing this installation" - Goto vcdone -vcerror: - MessageBox MB_OK|MB_ICONEXCLAMATION "Installing the Microsoft Visual C++ 2005 SP1 Runtime failed (error code $R0)! Please try to run '$INSTDIR\${VCREDIST_EXE}' manually" - Goto vcdone -vcexists: - DetailPrint "Microsoft Visual C++ 2005 SP1 Runtime SP1 is already installed" -vcdone: - Pop $R0 -!macroend - -!macro INSTALLDIRECTX DIRECTX_EXE - Push $R0 - DetailPrint "Checking for Microsoft Direct X version 9 or higher ..." - Call GetDXVersion - Pop $R0 - IntCmp $R0 900 dxexists +1 dxexists - MessageBox MB_YESNO|MB_ICONINFORMATION "The mediaplayer demo requires Microsoft Direct X 9 or higher to be installed. Do you want to download and install Direct X 9 now?" IDYES dxinstall IDNO dxdone -dxinstall: - DetailPrint "Running Microsoft Direct X installer ..." - nsExec::Exec '"$INSTDIR\${DIRECTX_EXE}"' - Goto dxdone -dxexists: - DetailPrint "Microsoft Direct X version 9 or higher is already installed (version detected: $R0)" -dxdone: - Pop $R0 -!macroend - -!macro QTDEMO_STARTUP - SectionSetFlags ${QTDEMO_SEC01} 17 ; selected & read-only -!macroend - -!macro QTDEMO_SECTIONS - Section "Prerequisites" QTDEMO_SEC01 - !ifdef MODULE_QTDEMO_VCREDIST - !insertmacro INSTALLVCREDIST "${MODULE_QTDEMO_VCREDIST}" - !endif - !ifdef MODULE_QTDEMO_DIRECTX - !insertmacro INSTALLDIRECTX "${MODULE_QTDEMO_DIRECTX}" - !endif - SectionEnd -!macroend - -!else ;MODULE_QTDEMO - -!macro QTDEMO_STARTUP -!macroend - -!macro QTDEMO_SECTIONS -!macroend - -!endif
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/modules/qtjambi.nsh b/util/scripts/win-binary/nsis/modules/qtjambi.nsh deleted file mode 100644 index 948945b..0000000 --- a/util/scripts/win-binary/nsis/modules/qtjambi.nsh +++ /dev/null @@ -1,98 +0,0 @@ -!ifdef MODULE_QTJAMBI -;------------------------------------------------------------------------------------------------ -!macro QTJAMBI_INITIALIZE -!include "includes\qtcommon.nsh" -!ifndef MODULE_QTJAMBI_NAME - !define MODULE_QTJAMBI_NAME "Qt Jambi" -!endif -!ifndef MODULE_QTJAMBI_VERSION - !define MODULE_QTJAMBI_VERSION ${PRODUCT_VERSION} -!endif - -!macroend ;QTJAMBI_INITIALIZE - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBI_SECTIONS -SectionGroup "${MODULE_QTJAMBI_NAME}" -Section "QtJambi" QTJAMBI_SEC01 - SetOutPath "$QTJAMBI_INSTDIR" - SetOverwrite ifnewer - !insertmacro MODULE_QTJAMBI_INSTALLFILES - - !insertmacro CreateConditionalShortCutWithParameters "$SMPROGRAMS\$STARTMENU_STRING\Readme.lnk" "notepad" "$QTJAMBI_INSTDIR\README" - !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\Examples and Demos.lnk" "$QTJAMBI_INSTDIR\qtjambi.exe" - - Push "bin" - push $QTJAMBI_INSTDIR - call PatchCommonBinaryFiles - - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QtJambiInstalled" 1 -SectionEnd -SectionGroupEnd -!macroend ;QTJAMBI_SECTIONS - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBI_DESCRIPTION - !insertmacro MUI_DESCRIPTION_TEXT ${QTJAMBI_SEC01} "This installs the Qt Jambi ${MODULE_QTJAMBI_VERSION} for Visual Studio 6.0" -!macroend - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBI_STARTUP - push $0 - SectionSetFlags ${QTJAMBI_SEC01} 1 -!ifdef MODULE_ENVIRONMENT - strcpy $QTJAMBI_INSTDIR "C:\Qt\qtjambi-win32-eval-${MODULE_QTJAMBI_VERSION}" -!else - strcpy $QTJAMBI_INSTDIR "C:\Qt\qtjambi-win32-commercial-${MODULE_QTJAMBI_VERSION}" -!endif - - pop $0 -!macroend ;QTJAMBI_STATUP - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBI_FINISH -!macroend - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBI_UNSTARTUP - !insertmacro ConfirmOnRemove "QtJambiInstalled" "Qt Jambi" -!macroend - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBI_UNINSTALL - push $0 - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "QtJambiInstalled" - - intcmp $0 1 0 DoneUnInstallQtJambi - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "QtJambiInstalled" 0 - Delete "$SMPROGRAMS\$STARTMENU_STRING\Readme.lnk" - Delete "$SMPROGRAMS\$STARTMENU_STRING\Examples and Demos.lnk" - !insertmacro MODULE_QTJAMBI_REMOVE "$QTJAMBI_INSTDIR" - RMDir $QTJAMBI_INSTDIR ;removes it if empty - DoneUnInstallQtJambi: - pop $0 -!macroend ;QTJAMBI_UNINSTALL - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBI_UNFINISH -!macroend - -!else ;MODULE_QTJAMBI -!macro QTJAMBI_INITIALIZE -!macroend -!macro QTJAMBI_SECTIONS -!macroend -!macro QTJAMBI_DESCRIPTION -!macroend -!macro QTJAMBI_STARTUP -!macroend -!macro QTJAMBI_FINISH -!macroend -!macro QTJAMBI_UNSTARTUP -!macroend -!macro QTJAMBI_UNINSTALL -!macroend -!macro QTJAMBI_UNFINISH -!macroend -!endif ;MODULE_QTJAMBI - diff --git a/util/scripts/win-binary/nsis/modules/qtjambieclipse.nsh b/util/scripts/win-binary/nsis/modules/qtjambieclipse.nsh deleted file mode 100644 index d8cae70..0000000 --- a/util/scripts/win-binary/nsis/modules/qtjambieclipse.nsh +++ /dev/null @@ -1,223 +0,0 @@ -!ifdef MODULE_QTJAMBIECLIPSE - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBIECLIPSE_INITIALIZE - -!define ECLIPSE_LOCATION_KEY "EclipseLocation" -var ECLIPSE_LOCATION - -!ifndef MODULE_QTJAMBIECLIPSE_INSTALLER - !define MODULE_QTJAMBIECLIPSE_INSTALLER "${PRODUCT_NAME} v${PRODUCT_VERSION}" -!endif -!ifndef MODULE_QTJAMBIECLIPSE_ROOT - !define MODULE_QTJAMBIECLIPSE_ROOT "${INSTALL_ROOT}\qtjambieclipse" -!endif -!ifndef MODULE_QTJAMBIECLIPSE_VERSION - !define MODULE_QTJAMBIECLIPSE_VERSION ${PRODUCT_VERSION} -!endif - -!define MODULE_QTJAMBIECLIPSE_QTJAMBIVERSION "1.0.0" - -!define MODULE_QTJAMBIECLIPSE_QT_ID "com.trolltech.qt_${MODULE_QTJAMBIECLIPSE_QTJAMBIVERSION}" -!define MODULE_QTJAMBIECLIPSE_QTJAMBI_ID "com.trolltech.qtjambi_${MODULE_QTJAMBIECLIPSE_QTJAMBIVERSION}" -!define MODULE_QTJAMBIECLIPSE_QTDESIGNER_ID "com.trolltech.qtdesigner_${MODULE_QTJAMBIECLIPSE_QTJAMBIVERSION}" -!define MODULE_QTJAMBIECLIPSE_QTDESIGNER_QTJAMBI_ID "com.trolltech.qtdesigner.qtjambi_${MODULE_QTJAMBIECLIPSE_QTJAMBIVERSION}" -!define MODULE_QTJAMBIECLIPSE_QTDESIGNERPLUGINS_ID "com.trolltech.qtdesignerplugins" - -!define MODULE_QTJAMBIECLIPSE_BINARIES "${MODULE_QTJAMBIECLIPSE_ROOT}\plugins\com.trolltech.qtdesigner.win32.x86_${MODULE_QTJAMBIECLIPSE_QTJAMBIVERSION}" - -LangString ModuleQtjambieclipsePageTitle ${LANG_ENGLISH} "Eclipse Installation Location" -LangString ModuleQtjambieclipsePageDescription ${LANG_ENGLISH} "Select where eclipse is installed." - -!define MODULE_QTJAMBIECLIPSE_PAGE "qtjambieclipse.ini" -Page custom ModuleQtjambieclipsePageEnter ModuleQtjambieclipsePageExit - -!include "includes\regsvr.nsh" - -!define MODULE_QTJAMBIECLIPSE_INCOMPATIBLEPRODUCT "Qt Eclipse Integration" - -!macroend ;QTJAMBIECLIPSE_INITIALIZE - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBIECLIPSE_SECTIONS - -Section -PreEclipseSection - WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${ECLIPSE_LOCATION_KEY}" $ECLIPSE_LOCATION -SectionEnd - -SectionGroup "Eclipse Integration" - -Section "Qt Jambi Eclipse Integration" QTJAMBIECLIPSE_SEC01 - SetOutPath "$ECLIPSE_LOCATION\plugins\" - SetOverwrite ifnewer - File "${MODULE_QTJAMBIECLIPSE_ROOT}\plugins\${MODULE_QTJAMBIECLIPSE_QT_ID}.jar" - File "${MODULE_QTJAMBIECLIPSE_ROOT}\plugins\${MODULE_QTJAMBIECLIPSE_QTJAMBI_ID}.jar" - File "${MODULE_QTJAMBIECLIPSE_ROOT}\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNER_ID}.jar" - File "${MODULE_QTJAMBIECLIPSE_ROOT}\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNER_QTJAMBI_ID}.jar" - - SetOutPath "$ECLIPSE_LOCATION\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNERPLUGINS_ID}" - SetOverwrite ifnewer - File "${MODULE_QTJAMBIECLIPSE_ROOT}\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNERPLUGINS_ID}\JambiCustomWidget.dll" - File "${MODULE_QTJAMBIECLIPSE_ROOT}\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNERPLUGINS_ID}\JambiLanguage.dll" - - SetOutPath "$QTJAMBIECLIPSE_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_QTJAMBIECLIPSE_ROOT}\LICENSE.QT_JAMBI_ECLIPSE_INTEGRATION" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\msvcp71.dll" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\msvcr71.dll" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\QtCore4.dll" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\QtGui4.dll" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\QtXml4.dll" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\QtScript4.dll" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\QtDesigner4.dll" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\QtDesignerComponents4.dll" - File "${MODULE_QTJAMBIECLIPSE_BINARIES}\qtdesigner.dll" - - push "$QTJAMBIECLIPSE_INSTDIR\qtdesigner.dll" - call RegEclipseSvr - - push "$QTJAMBIECLIPSE_INSTDIR\qtdesigner.dll" - call RegEclipseSvr - - Rename "$QTJAMBIECLIPSE_INSTDIR\LICENSE.QT_JAMBI_ECLIPSE_INTEGRATION" "$QTJAMBIECLIPSE_INSTDIR\LICENSE.txt" - !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\License.lnk" "$QTJAMBIECLIPSE_INSTDIR\LICENSE.txt" -SectionEnd - -SectionGroupEnd - -; usage: -; push dll to register -; call RegEclipseSvr -Function RegEclipseSvr - exch $0 ;filename - - ClearErrors - push $0 - call RegSvr - IfErrors 0 +2 - MessageBox MB_OK|MB_ICONEXCLAMATION 'Could not register "$0"' - - pop $0 -FunctionEnd - -Function ModuleQtjambieclipsePageEnter - !insertmacro MUI_HEADER_TEXT "$(ModuleQtjambieclipsePageTitle)" "$(ModuleQtjambieclipsePageDescription)" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${MODULE_QTJAMBIECLIPSE_PAGE}" -FunctionEnd - -Function ModuleQtjambieclipsePageExit - push $0 - push $1 - - !insertmacro MUI_INSTALLOPTIONS_READ $0 "${MODULE_QTJAMBIECLIPSE_PAGE}" "Field 2" "State" - IfFileExists "$0\eclipse.exe" eclipse_found - MessageBox MB_OK|MB_ICONSTOP "$0\eclipse.exe not found!$\nPlease select a valid installation directory." - Goto failed - eclipse_found: - - ClearErrors - FileOpen $1 "$0\plugins\com.trolltech.writetest" a - IfErrors 0 has_write_access - MessageBox MB_OK|MB_ICONSTOP "Can't write to $0\plugins.$\nPlease select a valid installation directory." - Goto failed - has_write_access: - - FileClose $1 - Delete "$0\plugins\com.trolltech.writetest" - StrCpy $ECLIPSE_LOCATION $0 - - Goto done - failed: - pop $1 - pop $0 - Abort - - done: - pop $1 - pop $0 -FunctionEnd - -!macroend ;QTJAMBIECLIPSE_SECTIONS - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBIECLIPSE_DESCRIPTION -!ifdef QTJAMBIECLIPSE_SEC01 - !insertmacro MUI_DESCRIPTION_TEXT ${QTJAMBIECLIPSE_SEC01} "This installs the Qt Jambi plugin into Eclipse." -!endif -!macroend - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBIECLIPSE_STARTUP - push "${MODULE_QTJAMBIECLIPSE_INCOMPATIBLEPRODUCT}" - call WarnIfInstalledProductDetected - - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${MODULE_QTJAMBIECLIPSE_PAGE}" - SectionSetFlags ${QTJAMBIECLIPSE_SEC01} 17 - - strcpy $QTJAMBIECLIPSE_INSTDIR "$PROGRAMFILES\Trolltech\Qt Jambi Eclipse Integration" -!macroend ;QTJAMBIECLIPSE_STATUP - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBIECLIPSE_FINISH -!macroend ;QTJAMBIECLIPSE_FINISH - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBIECLIPSE_UNSTARTUP - ReadRegStr $ECLIPSE_LOCATION SHCTX "$PRODUCT_UNIQUE_KEY" "${ECLIPSE_LOCATION_KEY}" -!macroend ;QTJAMBIECLIPSE_UNSTARTUP - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBIECLIPSE_UNINSTALL -Section un."Eclipse Integration" - push "$QTJAMBIECLIPSE_INSTDIR\qtdesigner.dll" - call un.RegSvr - - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_QTJAMBIECLIPSE_QT_ID}.jar" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_QTJAMBIECLIPSE_QTJAMBI_ID}.jar" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNER_ID}.jar" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNER_QTJAMBI_ID}.jar" - - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNERPLUGINS_ID}\JambiCustomWidget.dll" - Delete "$ECLIPSE_LOCATION\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNERPLUGINS_ID}\JambiLanguage.dll" - RMDir "$ECLIPSE_LOCATION\plugins\${MODULE_QTJAMBIECLIPSE_QTDESIGNERPLUGINS_ID}" - - Delete "$SMPROGRAMS\$STARTMENU_STRING\License.lnk" - - Delete "$QTJAMBIECLIPSE_INSTDIR\LICENSE.txt" - Delete "$QTJAMBIECLIPSE_INSTDIR\msvcp71.dll" - Delete "$QTJAMBIECLIPSE_INSTDIR\msvcr71.dll" - Delete "$QTJAMBIECLIPSE_INSTDIR\QtCore4.dll" - Delete "$QTJAMBIECLIPSE_INSTDIR\QtGui4.dll" - Delete "$QTJAMBIECLIPSE_INSTDIR\QtXml4.dll" - Delete "$QTJAMBIECLIPSE_INSTDIR\QtScript4.dll" - Delete "$QTJAMBIECLIPSE_INSTDIR\QtDesigner4.dll" - Delete "$QTJAMBIECLIPSE_INSTDIR\QtDesignerComponents4.dll" - Delete "$QTJAMBIECLIPSE_INSTDIR\qtdesigner.dll" - - RMDir "$QTJAMBIECLIPSE_INSTDIR" -SectionEnd -!macroend ;QTJAMBIECLIPSE_UNINSTALL - -;------------------------------------------------------------------------------------------------ -!macro QTJAMBIECLIPSE_UNFINISH -!macroend - -!else ;MODULE_QTJAMBIECLIPSE -!macro QTJAMBIECLIPSE_INITIALIZE -!macroend -!macro QTJAMBIECLIPSE_SECTIONS -!macroend -!macro QTJAMBIECLIPSE_DESCRIPTION -!macroend -!macro QTJAMBIECLIPSE_STARTUP -!macroend -!macro QTJAMBIECLIPSE_FINISH -!macroend -!macro QTJAMBIECLIPSE_UNSTARTUP -!macroend -!macro QTJAMBIECLIPSE_UNINSTALL -!macroend -!macro QTJAMBIECLIPSE_UNFINISH -!macroend -!endif ;MODULE_QTJAMBIECLIPSE - diff --git a/util/scripts/win-binary/nsis/modules/registeruiext.nsh b/util/scripts/win-binary/nsis/modules/registeruiext.nsh deleted file mode 100644 index 51f7df5..0000000 --- a/util/scripts/win-binary/nsis/modules/registeruiext.nsh +++ /dev/null @@ -1,174 +0,0 @@ -; UI Extension Module - -!ifdef MODULE_REGISTERUIEXT - -;------------------------------------------------------------------------------------------------ -!macro REGISTERUIEXT_INITIALIZE - !include "includes\system.nsh" - - !ifndef MODULE_REGISTERUIEXT_QTDIR - !ifdef MODULE_MINGW - !define MODULE_REGISTERUIEXT_QTDIR $MINGW_INSTDIR - !endif - - !ifdef MODULE_MSVC - !define MODULE_REGISTERUIEXT_QTDIR $MSVC_INSTDIR - !endif - !endif - - !define MODULE_REGISTERUIEXT_INTERNAL_DESC "Trolltech.DesignerForm" - !define MODULE_REGISTERUIEXT_DESC_DESIGNER "Open with Qt Designer" - !define MODULE_REGISTERUIEXT_DESC_DEVENV "Open with Visual Studio .NET" - !define MODULE_REGISTERUIEXT_FILE_DESC "Qt Designer File" -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro REGISTERUIEXT_SECTIONS - -Function GetSelectedVSIP - Push $0 - Push $1 - - StrCpy $0 "" -!ifdef MODULE_VSIP -!ifdef VSIP_SEC01 - SectionGetFlags ${VSIP_SEC01} $1 - IntOp $1 $1 & 1 - IntCmp $1 0 +2 - StrCpy $0 "7.1" -!endif -!ifdef VSIP_SEC02 - SectionGetFlags ${VSIP_SEC02} $1 - IntOp $1 $1 & 1 - IntCmp $1 0 +2 - StrCpy $0 "8.0" -!endif -!ifdef VSIP_SEC03 - SectionGetFlags ${VSIP_SEC03} $1 - IntOp $1 $1 & 1 - IntCmp $1 0 +2 - StrCpy $0 "9.0" -!endif -!endif - - Pop $1 - Exch $0 -FunctionEnd - -SectionGroup "File Associations" -Section "UI Files (*.ui)" REGISTERUIEXT_SEC01 - call ModuleRegisterUI -SectionEnd -SectionGroupEnd - -Function ModuleRegisterUI - push $0 - push $1 - - WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "UIExtRegistered" 1 - WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}" "" "${MODULE_REGISTERUIEXT_FILE_DESC}" - WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell" "" "open" - - Call GetSelectedVSIP - Pop $1 - - StrCmp "$1" "" 0 RegisterVSIP - WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell\open" "" "${MODULE_REGISTERUIEXT_DESC_DESIGNER}" - WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell\open\command" "" "${MODULE_REGISTERUIEXT_QTDIR}\bin\designer.exe $\"%1$\"" - WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\DefaultIcon" "" "${MODULE_REGISTERUIEXT_QTDIR}\bin\designer.exe,0" - goto RegisterFinished - - RegisterVSIP: - Push $1 - Call GetVSInstallationDir - Pop $0 - - WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell\open" "" "${MODULE_REGISTERUIEXT_DESC_DEVENV}" - WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell\${MODULE_REGISTERUIEXT_DESC_DEVENV}\command" "" "$0\devenv.exe $\"%1$\"" - WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\DefaultIcon" "" "$VSIP_INSTDIR\ui.ico" - RegisterFinished: - WriteRegStr HKCR ".ui" "" "${MODULE_REGISTERUIEXT_INTERNAL_DESC}" - - pop $1 - pop $0 -FunctionEnd - -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro REGISTERUIEXT_DESCRIPTION - !insertmacro MUI_DESCRIPTION_TEXT ${REGISTERUIEXT_SEC01} "This will associate the file extention .ui with the Qt GUI editor." -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro REGISTERUIEXT_STARTUP - ${If} $RUNNING_AS_ADMIN == false - SectionSetFlags ${REGISTERUIEXT_SEC01} 16 - ${EndIf} -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro REGISTERUIEXT_FINISH -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro REGISTERUIEXT_UNSTARTUP -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro REGISTERUIEXT_UNINSTALL -Function un.ModuleRegisterUI - push $1 - ReadRegStr $1 HKCR ".ui" "" - strcmp $1 "${MODULE_REGISTERUIEXT_INTERNAL_DESC}" 0 continue - ; do not delete this key since a subkey openwithlist - ; or open withprogid may exist - WriteRegStr HKCR ".ui" "" "" - continue: - ; just delete it since nobody else is supposed to use it - DeleteRegKey HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}" - - pop $1 -FunctionEnd - -Section -un.ModuleRegisterUIExtSection - push $0 - ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "UIExtRegistered" - intcmp $0 1 0 DoneUnRegister - call un.ModuleRegisterUI - DoneUnRegister: - pop $0 -SectionEnd -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro REGISTERUIEXT_UNFINISH -!macroend - -;------------------------------------------------------------------------------------------------ - -!else -!macro REGISTERUIEXT_INITIALIZE -!macroend -!macro REGISTERUIEXT_SECTIONS -!macroend -!macro REGISTERUIEXT_DESCRIPTION -!macroend -!macro REGISTERUIEXT_STARTUP -!macroend -!macro REGISTERUIEXT_FINISH -!macroend -!macro REGISTERUIEXT_UNSTARTUP -!macroend -!macro REGISTERUIEXT_UNINSTALL -!macroend -!macro REGISTERUIEXT_UNFINISH -!macroend -!endif diff --git a/util/scripts/win-binary/nsis/modules/vsip.nsh b/util/scripts/win-binary/nsis/modules/vsip.nsh deleted file mode 100644 index a11763b..0000000 --- a/util/scripts/win-binary/nsis/modules/vsip.nsh +++ /dev/null @@ -1,1030 +0,0 @@ -; Integration Module - -!ifdef MODULE_VSIP - -;------------------------------------------------------------------------------------------------ -!macro VSIP_INITIALIZE - -!ifndef MODULE_VSIP_NAME - !define MODULE_VSIP_NAME "Qt Visual Studio Integration" -!endif -!ifndef MODULE_VSIP_VERSION - !define MODULE_VSIP_VERSION ${PRODUCT_VERSION} -!endif -!ifndef MODULE_VSIP_ROOT - !define MODULE_VSIP_ROOT "${INSTALL_ROOT}\vsip" -!endif -!ifndef MODULE_HELP_ROOT - !define MODULE_HELP_ROOT "${MODULE_VSIP_ROOT}\help" -!endif - - -!include "includes\templates.nsh" -!include "includes\system.nsh" -!include "includes\help.nsh" -!include "includes\regsvr.nsh" -!include "includes\qtcommon.nsh" -!include "WinMessages.nsh" - -!macroend ;VSIP_INITIALIZE - -;------------------------------------------------------------------------------------------------ - -!macro VSIP_SECTIONS - -SectionGroup "Qt Visual Studio Integration" -!ifndef MODULE_VSIP_NO2003 -Section "Visual Studio 2003" VSIP_SEC01 - WriteRegStr SHCTX "SOFTWARE\\Trolltech\\Qt4VS2003" "LicenseKey" $LICENSE_KEY - - SetOutPath "$VSIP_INSTDIR" - SetOverwrite ifnewer - - WriteRegDWord SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VS2003" "1" - - StrCpy $VS_VERSION_SHORT "7.1" - StrCpy $VS_VERSION "2003" - Push $VS_VERSION_SHORT - Call InstallVSIP - - !insertmacro InstallHelp "$VSIP_INSTDIR\help" "qt4vs" "$VS_VERSION_SHORT" - - ;install readme file - SetOutPath "$VSIP_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_VSIP_ROOT}\Readme.txt" - File "${MODULE_VSIP_ROOT}\ui.ico" - File "${MODULE_VSIP_ROOT}\Changes-${MODULE_VSIP_VERSION}" -SectionEnd -!endif - -!ifndef MODULE_VSIP_NO2005 -Section "Visual Studio 2005" VSIP_SEC02 - WriteRegStr SHCTX "SOFTWARE\\Trolltech\\Qt4VS2005" "LicenseKey" $LICENSE_KEY - - SetOutPath "$VSIP_INSTDIR" - SetOverwrite ifnewer - - WriteRegDWord SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VS2005" "1" - - StrCpy $VS_VERSION_SHORT "8.0" - StrCpy $VS_VERSION "2005" - Push $VS_VERSION_SHORT - Call InstallVSIP - - !insertmacro InstallHelp "$VSIP_INSTDIR\help" "qt4vs" "$VS_VERSION_SHORT" - - ;install readme file - SetOutPath "$VSIP_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_VSIP_ROOT}\Readme.txt" - File "${MODULE_VSIP_ROOT}\ui.ico" - File "${MODULE_VSIP_ROOT}\Changes-${MODULE_VSIP_VERSION}" -SectionEnd -!endif - -!ifndef MODULE_VSIP_NO2008 -Section "Visual Studio 2008" VSIP_SEC03 - WriteRegStr SHCTX "SOFTWARE\\Trolltech\\Qt4VS2008" "LicenseKey" $LICENSE_KEY - - SetOutPath "$VSIP_INSTDIR" - SetOverwrite ifnewer - - WriteRegDWord SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VS2008" "1" - - StrCpy $VS_VERSION_SHORT "9.0" - StrCpy $VS_VERSION "2008" - Push $VS_VERSION_SHORT - Call InstallVSIP - - !insertmacro InstallHelp "$VSIP_INSTDIR\help" "qt4vs" "$VS_VERSION_SHORT" - - ;install readme file - SetOutPath "$VSIP_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_VSIP_ROOT}\Readme.txt" - File "${MODULE_VSIP_ROOT}\ui.ico" - File "${MODULE_VSIP_ROOT}\Changes-${MODULE_VSIP_VERSION}" -SectionEnd -!endif - -SectionGroupEnd - -Section -PostVSIPSection - IfFileExists "$VSIP_INSTDIR\help\h2reg.exe" 0 PostVSIPSectionHelp_Done - !insertmacro RegisterHelp "$VSIP_INSTDIR\help" "qt4vs" - PostVSIPSectionHelp_Done: - - IfFileExists "$VSIP_INSTDIR\Readme.txt" 0 PostVSIPSection_Done - !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\Visual Studio Integration Readme.lnk" "$VSIP_INSTDIR\Readme.txt" - PostVSIPSection_Done: -SectionEnd - -Function InstallVSIP - Exch $0 - - Push $0 - Call InstallIntegration - - Push $0 - Call RegisterIntegration - - Push $VSIP_INSTDIR - Call InstallProjectTemplates - - Push $VSIP_INSTDIR - Call InstallItemTemplates - - Call InstallResources - - Call InstallSamples - - Push $0 - Call InstallAddin - - Pop $0 -FunctionEnd - - -Function InstallIntegration - Exch $0 - Push $1 - - CreateDirectory "$VSIP_INSTDIR\bin" - SetOutPath "$VSIP_INSTDIR\bin" - SetOverwrite ifnewer - - ; Install common files - File "${MODULE_VSIP_ROOT}\bin\QtCore4.dll" - File "${MODULE_VSIP_ROOT}\bin\QtGui4.dll" - File "${MODULE_VSIP_ROOT}\bin\QtXml4.dll" - File "${MODULE_VSIP_ROOT}\bin\QtScript4.dll" - - File "${MODULE_VSIP_ROOT}\bin\QtDesigner4.dll" - File "${MODULE_VSIP_ROOT}\bin\QtDesignerComponents4.dll" - File "${MODULE_VSIP_ROOT}\bin\FormEditor1.dll" - - DetailPrint "Patching $VSIP_INSTDIR\bin\QtCore4.dll..." - Push "$VSIP_INSTDIR" - Push "$VSIP_INSTDIR\bin\QtCore4.dll" - Call PatchBinaryPaths - - CreateDirectory "$VSIP_INSTDIR\bin\$0" - SetOutPath "$VSIP_INSTDIR\bin\$0" - SetOverwrite ifnewer - - StrCmp $0 "7.1" 0 MODULE_VSIP_2005_1 - File "${MODULE_VSIP_ROOT}\bin\7.1\Qt4VSa.dll" - SetFileAttributes "$VSIP_INSTDIR\bin\7.1\Qt4VSa.dll" HIDDEN - ClearErrors - - ; Install Integration Libs - File "${MODULE_VSIP_ROOT}\bin\7.1\Axformeditor1Lib.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\formeditor1Lib.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\QtProjectLib.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\Microsoft.VisualStudio.dll" - - File "${MODULE_VSIP_ROOT}\bin\7.1\Qt4VS2003.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\Trolltech.Qt4VS2003Base.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\Microsoft.VisualStudio.Designer.Interfaces.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\RegQt4VS2003.exe" - - File "${MODULE_VSIP_ROOT}\bin\7.1\QtProjectEngineLib.dll" - - ; Install MS Interop Assemblies - File "${MODULE_VSIP_ROOT}\bin\7.1\Microsoft.VisualStudio.OLE.Interop.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\Microsoft.VisualStudio.Shell.Interop.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\Microsoft.VisualStudio.TextManager.Interop.dll" - - Goto MODULE_VSIP_ALL - - MODULE_VSIP_2005_1: - StrCmp $0 "8.0" 0 MODULE_VSIP_2008 - File "${MODULE_VSIP_ROOT}\bin\8.0\Qt4VSa.dll" - SetFileAttributes "$VSIP_INSTDIR\bin\8.0\Qt4VSa.dll" HIDDEN - ClearErrors - - File "${MODULE_VSIP_ROOT}\bin\8.0\Axformeditor1Lib.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\formeditor1Lib.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\QtProjectLib.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\Microsoft.VisualStudio.dll" - - File "${MODULE_VSIP_ROOT}\bin\8.0\Qt4VS2005.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\Trolltech.Qt4VS2005Base.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\RegQt4VS2005.exe" - - File "${MODULE_VSIP_ROOT}\bin\8.0\QtProjectEngineLib.dll" - - ; Install MS Interop Assemblies - File "${MODULE_VSIP_ROOT}\bin\8.0\Microsoft.VisualStudio.OLE.Interop.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\Microsoft.VisualStudio.Shell.Interop.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\Microsoft.VisualStudio.TextManager.Interop.dll" - Goto MODULE_VSIP_ALL - - MODULE_VSIP_2008: - StrCmp $0 "9.0" 0 MODULE_VSIP_ALL - File "${MODULE_VSIP_ROOT}\bin\9.0\Qt4VSa.dll" - SetFileAttributes "$VSIP_INSTDIR\bin\9.0\Qt4VSa.dll" HIDDEN - ClearErrors - - File "${MODULE_VSIP_ROOT}\bin\9.0\Axformeditor1Lib.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\formeditor1Lib.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\QtProjectLib.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\Microsoft.VisualStudio.dll" - - File "${MODULE_VSIP_ROOT}\bin\9.0\Qt4VS2008.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\Trolltech.Qt4VS2008Base.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\RegQt4VS2008.exe" - - File "${MODULE_VSIP_ROOT}\bin\9.0\QtProjectEngineLib.dll" - - ; Install MS Interop Assemblies - File "${MODULE_VSIP_ROOT}\bin\9.0\Microsoft.VisualStudio.OLE.Interop.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\Microsoft.VisualStudio.Shell.Interop.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\Microsoft.VisualStudio.TextManager.Interop.dll" - - - MODULE_VSIP_ALL: - !insertmacro InstallUnManagedTranslation $0 "1033" - !insertmacro InstallUnManagedTranslation $0 "1031" - !insertmacro InstallUnManagedTranslation $0 "1041" - !insertmacro InstallManagedTranslation $0 "de" - !insertmacro InstallManagedTranslation $0 "ja" - - ;CreateDirectory "$VSIP_INSTDIR\bin\$0\1033" - ;SetOutPath "$VSIP_INSTDIR\bin\$0\1033" - ;SetOverwrite ifnewer - - ;StrCmp $0 "8.0" 0 +2 - ; File "${MODULE_VSIP_ROOT}\bin\8.0\1033\Qt4VS2005UI.dll" - - ;StrCmp $0 "7.1" 0 +2 - ;File "${MODULE_VSIP_ROOT}\bin\7.1\1033\Qt4VS2003UI.dll" - - SetOutPath "$VSIP_INSTDIR\plugins\designer" - SetOverwrite ifnewer - File "${MODULE_VSIP_ROOT}\plugins\designer\qaxwidget.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\qt3supportwidgets.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\customwidgetplugin.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\worldtimeclockplugin.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\containerextension.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\taskmenuextension.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\QtNetwork4.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\Qt3Support4.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\QtSql4.dll" - ${If} $0 != "7.1" - File "${MODULE_VSIP_ROOT}\plugins\designer\phonon4.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\QtWebKit4.dll" - File "${MODULE_VSIP_ROOT}\plugins\designer\qwebview.dll" - ${EndIf} - - SetOutPath "$VSIP_INSTDIR\plugins\imageformats" - SetOverwrite ifnewer - File "${MODULE_VSIP_ROOT}\plugins\imageformats\QtSvg4.dll" - File "${MODULE_VSIP_ROOT}\plugins\imageformats\qsvg4.dll" - File "${MODULE_VSIP_ROOT}\plugins\imageformats\qgif4.dll" - File "${MODULE_VSIP_ROOT}\plugins\imageformats\qjpeg4.dll" - File "${MODULE_VSIP_ROOT}\plugins\imageformats\qtiff4.dll" - File "${MODULE_VSIP_ROOT}\plugins\imageformats\qico4.dll" - - ; Install VC redistributable - Push $0 - Call IsVS2008RedistInstalled - Pop $0 - ${If} $0 == 0 - SetOutPath "$VSIP_INSTDIR" - SetOverwrite ifnewer - File "${MODULE_VSIP_ROOT}\redist\vcredist_x86.exe" - ExecWait '"$VSIP_INSTDIR\vcredist_x86.exe" /q' $0 - Delete "$VSIP_INSTDIR\vcredist_x86.exe" - ${EndIf} - Pop $0 - - ; Install usertype.dat - - Push $0 - Call GetVSInstallationDir - Pop $1 - SetOutPath "$1" - SetOverwrite off ;ifnewer - File "${MODULE_VSIP_ROOT}\usertype.dat" - - Pop $1 - Pop $0 -FunctionEnd - - -Function InstallAddin - Exch $0 - CreateDirectory "$VSIP_INSTDIR\bin\$0" - ClearErrors - SetOutPath "$VSIP_INSTDIR\bin\$0" - SetOverwrite ifnewer - - StrCmp $0 "7.1" MODULE_VSIP_ADDIN_71 - StrCmp $0 "8.0" MODULE_VSIP_ADDIN_80 - File "${MODULE_VSIP_ROOT}\bin\9.0\StartQtVSIP.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\StartQtVSIP2008.AddIn" - WriteRegStr SHCTX "Software\Microsoft\VisualStudio\9.0\AutomationOptions\LookInFolders" "$VSIP_INSTDIR\bin\$0" "" - Goto MODULE_VSIP_ADDIN_End - - MODULE_VSIP_ADDIN_80: - File "${MODULE_VSIP_ROOT}\bin\8.0\StartQtVSIP.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\StartQtVSIP2005.AddIn" - WriteRegStr SHCTX "Software\Microsoft\VisualStudio\8.0\AutomationOptions\LookInFolders" "$VSIP_INSTDIR\bin\$0" "" - Goto MODULE_VSIP_ADDIN_End - - MODULE_VSIP_ADDIN_71: - Push $1 - Push $2 - - Push $0 - Call IsDotNETInstalled - Pop $1 - - File "${MODULE_VSIP_ROOT}\bin\7.1\StartQtVSIP.dll" - - ClearErrors - DetailPrint "Registering StartQtVSIP..." - nsExec::ExecToLog '"$1\regasm.exe" /codebase "StartQtVSIP.dll"' - Pop $2 - StrCmp $2 "error" 0 +3 - MessageBox MB_OK 'The command $\n"$1\regasm.exe" /codebase "StartQtVSIP.dll"$\n failed.' - Goto MODULE_VSIP_ADDIN_71_End - - WriteRegDWORD SHCTX "Software\Microsoft\VisualStudio\7.1\Addins\StartQtVSIP" "CommandLineSafe" 0x00000001 - WriteRegDWORD SHCTX "Software\Microsoft\VisualStudio\7.1\Addins\StartQtVSIP" "CommandPreload" 0x00000000 - WriteRegDWORD SHCTX "Software\Microsoft\VisualStudio\7.1\Addins\StartQtVSIP" "LoadBehavior" 0x00000003 - - MODULE_VSIP_ADDIN_71_End: - Pop $2 - Pop $1 - - MODULE_VSIP_ADDIN_End: - Pop $0 -FunctionEnd - - -Function RegisterIntegration - Exch $0 - Push $1 - Push $2 - Push $3 - - Push $0 - Call GetVSInstallationDir - Pop $1 - - Push $0 - Call IsDotNETInstalled - Pop $2 - - SetOutPath "$VSIP_INSTDIR\bin" - -; MessageBox MB_OK '"$2\regasm.exe" /codebase "$0\bin\QtProjectEngineLib.dll"' -; MessageBox MB_OK '"$0\bin\RegQt4VS${MODULE_VSIP_VS_VERSION}.exe" /templatepath:"$0//" "$0\bin\Qt4VS${MODULE_VSIP_VS_VERSION}.dll"' -; MessageBox MB_OK "Can not setup devenv! The command $\n$1\devenv.exe /setup$\n failed. Try to run in manually!" - - ClearErrors ; clear the error flag - nsExec::ExecToLog '"$2\regasm.exe" /codebase "$VSIP_INSTDIR\bin\$0\QtProjectEngineLib.dll"' - Pop $3 - StrCmp $3 "error" 0 Module_VSIP_RegFormEditor - MessageBox MB_OK "Can not register QtProjectEngineLib.dll!" - MessageBox MB_OK '"$2\regasm.exe" /codebase "$VSIP_INSTDIR\bin\$0\QtProjectEngineLib.dll"' - - Module_VSIP_RegFormEditor: - ClearErrors - push "$VSIP_INSTDIR\bin\formeditor1.dll" - call RegSvr - IfErrors 0 Module_VSIP_RegPackage - MessageBox MB_OK "Can not register formeditor1.dll!" - - Module_VSIP_RegPackage: - StrCpy $VS_VERSION "2008" - StrCmp $0 "8.0" 0 +2 - StrCpy $VS_VERSION "2005" - StrCmp $0 "7.1" 0 +2 - StrCpy $VS_VERSION "2003" - nsExec::ExecToLog '"$VSIP_INSTDIR\bin\$0\RegQt4VS$VS_VERSION.exe" /root:Software\Microsoft\VisualStudio\$0 /templatepath:"$VSIP_INSTDIR//" "$VSIP_INSTDIR\bin\$0\Qt4VS$VS_VERSION.dll"' - Pop $3 - StrCmp $3 "error" 0 Module_VSIP_SetupVS - MessageBox MB_OK "Can not register package!" - - Module_VSIP_SetupVS: - DetailPrint "Calling devenv /setup ..." - nsExec::Exec '"$1\devenv.exe" /setup' - Pop $3 - StrCmp $3 "error" 0 Module_VSIP_SetupOK - MessageBox MB_OK "Can not setup devenv! The command $\n$1\devenv.exe /setup$\n failed. Try to run in manually!" - goto Module_VSIP_EndRegisterPackage - Module_VSIP_SetupOK: - DetailPrint "Running setup was successfull." - Module_VSIP_EndRegisterPackage: - - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - - -Function InstallSamples - CreateDirectory "$VSIP_INSTDIR\samples\AddressBook" - SetOutPath "$VSIP_INSTDIR\samples\AddressBook" - SetOverwrite ifnewer - - File "${MODULE_VSIP_ROOT}\samples\AddressBook\adddialog.cpp" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\adddialog.h" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\adddialog.ui" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\addressbook.cpp" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\addressbook.h" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\AddressBook.ico" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\AddressBook.rc" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\addressbook.ui" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\AddressBook.vcproj" - File "${MODULE_VSIP_ROOT}\samples\AddressBook\main.cpp" -FunctionEnd - -Function InstallResources - CreateDirectory "$VSIP_INSTDIR\resources" - - SetOutPath "$VSIP_INSTDIR\resources" - SetOverWrite ifnewer - - !insertmacro InstallResourceFiles "bmp" "bitmap" - !insertmacro InstallResourceFiles "txt" "text" - !insertmacro InstallResourceFiles "htm" "page" - !insertmacro InstallResourceFiles "xml" "xmlfile" - !insertmacro InstallResourceFiles "png" "image" - !insertmacro InstallResourceFiles "ui" "form" -FunctionEnd - -Function un.InstallVSIP - Exch $0 - - Push $0 - Call un.InstallAddin - - Call un.InstallSamples - - Call un.InstallResources - - Push $VSIP_INSTDIR - Call un.InstallProjectTemplates - - Push $VSIP_INSTDIR - Call un.InstallItemTemplates - - Push $0 - Call un.RegisterIntegration - - Push $0 - Call un.InstallIntegration - - Pop $0 -FunctionEnd - - -Function un.InstallIntegration - Exch $0 - Push $1 - - Delete "$VSIP_INSTDIR\bin\$0\Microsoft.VisualStudio.TextManager.Interop.dll" - Delete "$VSIP_INSTDIR\bin\$0\Microsoft.VisualStudio.Shell.Interop.dll" - Delete "$VSIP_INSTDIR\bin\$0\Microsoft.VisualStudio.OLE.Interop.dll" - Delete "$VSIP_INSTDIR\bin\$0\QtProjectEngineLib.dll" - Delete "$VSIP_INSTDIR\bin\$0\Microsoft.VisualStudio.dll" - - StrCmp $0 "7.1" 0 MODULE_VSIP_UNINST_2005 - ;Delete "$VSIP_INSTDIR\bin\$0\1033\Qt4VS2003UI.dll" - Delete "$VSIP_INSTDIR\bin\$0\RegQt4VS2003.exe" - Delete "$VSIP_INSTDIR\bin\$0\Microsoft.VisualStudio.Designer.Interfaces.dll" - Delete "$VSIP_INSTDIR\bin\$0\Trolltech.Qt4VS2003Base.dll" - Delete "$VSIP_INSTDIR\bin\$0\Qt4VS2003.dll" - Goto MODULE_VSIP_CONTINUE - - MODULE_VSIP_UNINST_2005: - StrCmp $0 "8.0" 0 MODULE_VSIP_UNINST_2008 - ;Delete "$VSIP_INSTDIR\bin\$0\1033\Qt4VS2005UI.dll" - Delete "$VSIP_INSTDIR\bin\$0\RegQt4VS2005.exe" - Delete "$VSIP_INSTDIR\bin\$0\Trolltech.Qt4VS2005Base.dll" - Delete "$VSIP_INSTDIR\bin\$0\Qt4VS2005.dll" - Goto MODULE_VSIP_CONTINUE - - MODULE_VSIP_UNINST_2008: - ;Delete "$VSIP_INSTDIR\bin\$0\1033\Qt4VS2008UI.dll" - Delete "$VSIP_INSTDIR\bin\$0\RegQt4VS2008.exe" - Delete "$VSIP_INSTDIR\bin\$0\Trolltech.Qt4VS2008Base.dll" - Delete "$VSIP_INSTDIR\bin\$0\Qt4VS2008.dll" - - MODULE_VSIP_CONTINUE: - !insertmacro UnInstallUnManagedTranslation $0 "1033" - !insertmacro UnInstallUnManagedTranslation $0 "1031" - !insertmacro UnInstallUnManagedTranslation $0 "1041" - !insertmacro UnInstallManagedTranslation $0 "de" - !insertmacro UnInstallManagedTranslation $0 "ja" - - ;RmDir "$VSIP_INSTDIR\bin\$0\1033" - - Delete "$VSIP_INSTDIR\bin\$0\QtProjectLib.dll" - Delete "$VSIP_INSTDIR\bin\$0\formeditor1Lib.dll" - Delete "$VSIP_INSTDIR\bin\$0\Axformeditor1Lib.dll" - Delete "$VSIP_INSTDIR\bin\$0\Qt4VSa.dll" - RmDir "$VSIP_INSTDIR\bin\$0" - - Delete "$VSIP_INSTDIR\bin\FormEditor1.dll" - Delete "$VSIP_INSTDIR\bin\QtDesigner4.dll" - Delete "$VSIP_INSTDIR\bin\QtDesignerComponents4.dll" - Delete "$VSIP_INSTDIR\bin\QtCore4.dll" - Delete "$VSIP_INSTDIR\bin\QtGui4.dll" - Delete "$VSIP_INSTDIR\bin\QtXml4.dll" - Delete "$VSIP_INSTDIR\bin\QtScript4.dll" - RmDir "$VSIP_INSTDIR\bin" - - Push $0 - Call un.GetVSInstallationDir - Pop $1 - ;Delete "$1\usertype.dat" - - Delete "$VSIP_INSTDIR\plugins\imageformats\QtSvg4.dll" - Delete "$VSIP_INSTDIR\plugins\imageformats\qsvg4.dll" - Delete "$VSIP_INSTDIR\plugins\imageformats\qgif4.dll" - Delete "$VSIP_INSTDIR\plugins\imageformats\qjpeg4.dll" - Delete "$VSIP_INSTDIR\plugins\imageformats\qtiff4.dll" - Delete "$VSIP_INSTDIR\plugins\imageformats\qico4.dll" - RmDir "$VSIP_INSTDIR\plugins\imageformats" - - Delete "$VSIP_INSTDIR\plugins\designer\qaxwidget.dll" - Delete "$VSIP_INSTDIR\plugins\designer\qt3supportwidgets.dll" - Delete "$VSIP_INSTDIR\plugins\designer\customwidgetplugin.dll" - Delete "$VSIP_INSTDIR\plugins\designer\worldtimeclockplugin.dll" - Delete "$VSIP_INSTDIR\plugins\designer\containerextension.dll" - Delete "$VSIP_INSTDIR\plugins\designer\taskmenuextension.dll" - Delete "$VSIP_INSTDIR\plugins\designer\qwebview.dll" - Delete "$VSIP_INSTDIR\plugins\designer\QtSql4.dll" - Delete "$VSIP_INSTDIR\plugins\designer\QtNetwork4.dll" - Delete "$VSIP_INSTDIR\plugins\designer\phonon4.dll" - Delete "$VSIP_INSTDIR\plugins\designer\QtWebKit4.dll" - Delete "$VSIP_INSTDIR\plugins\designer\Qt3Support4.dll" - RmDir "$VSIP_INSTDIR\plugins\designer" - RmDir "$VSIP_INSTDIR\plugins" - - Pop $1 - Pop $0 -FunctionEnd - - -Function un.InstallAddin - Exch $0 - - StrCmp $0 "7.1" MODULE_VSIP_ADDIN_71 0 - StrCmp $0 "8.0" MODULE_VSIP_ADDIN_80 0 - Delete "$VSIP_INSTDIR\bin\$0\StartQtVSIP2008.AddIn" - DeleteRegValue SHCTX "Software\Microsoft\VisualStudio\9.0\AutomationOptions\LookInFolders" "$VSIP_INSTDIR\bin\$0" - Goto MODULE_VSIP_ADDIN_End - - MODULE_VSIP_ADDIN_80: - Delete "$VSIP_INSTDIR\bin\$0\StartQtVSIP2005.AddIn" - DeleteRegValue SHCTX "Software\Microsoft\VisualStudio\8.0\AutomationOptions\LookInFolders" "$VSIP_INSTDIR\bin\$0" - Goto MODULE_VSIP_ADDIN_End - - MODULE_VSIP_ADDIN_71: - Push $1 - Push $2 - - Push $0 - Call un.IsDotNETInstalled - Pop $1 - - ClearErrors - DetailPrint "Unregistering StartQtVSIP..." - nsExec::ExecToLog '"$1\regasm.exe" /unregister "$VSIP_INSTDIR\bin\$0\StartQtVSIP.dll"' - Pop $2 - StrCmp $2 "error" 0 +3 - MessageBox MB_OK 'The command $\n"$1\regasm.exe" /unregister "$VSIP_INSTDIR\bin\$0\StartQtVSIP.dll"$\n failed.' - Goto MODULE_VSIP_ADDIN_71_End - - DeleteRegKey SHCTX "Software\Microsoft\VisualStudio\7.1\Addins\StartQtVSIP" - - MODULE_VSIP_ADDIN_71_End: - Pop $2 - Pop $1 - - MODULE_VSIP_ADDIN_End: - - Delete "$VSIP_INSTDIR\bin\$0\StartQtVSIP.dll" - Pop $0 -FunctionEnd - - -Function un.RegisterIntegration - Exch $0 - Push $1 - Push $2 - Push $3 - - Push $0 - Call un.GetVSInstallationDir - Pop $1 - - Push $0 - Call un.IsDotNETInstalled - Pop $2 - -; UnRegPackage: - IfErrors 0 ; clear the error flag - StrCpy $VS_VERSION "2003" - StrCmp $0 "8.0" 0 +2 - StrCpy $VS_VERSION "2005" - StrCmp $0 "9.0" 0 +2 - StrCpy $VS_VERSION "2008" - - IfFileExists "$VSIP_INSTDIR\bin\$0\RegQt4VS$VS_VERSION.exe" 0 Module_VSIP_UnRegProjectEngine - nsExec::ExecToLog '"$VSIP_INSTDIR\bin\$0\RegQt4VS$VS_VERSION.exe" /root:Software\Microsoft\VisualStudio\$0 /unregister "$VSIP_INSTDIR\bin\$0\Qt4VS$VS_VERSION.dll"' - Pop $3 - StrCmp $3 "error" 0 Module_VSIP_UnRegProjectEngine - MessageBox MB_OK "Can not unregister Package!" - - Module_VSIP_UnRegProjectEngine: - IfFileExists "$VSIP_INSTDIR\bin\$0\QtProjectEngineLib.dll" 0 Module_VSIP_UnRegFormEditor - nsExec::ExecToLog '"$2\regasm.exe" /unregister "$VSIP_INSTDIR\bin\$0\QtProjectEngineLib.dll"' - Pop $3 - StrCmp $3 "error" 0 Module_VSIP_UnRegFormEditor - MessageBox MB_OK "Can not unregister QtProjectEngineLib.dll!" - - Module_VSIP_UnRegFormEditor: - IfFileExists "$VSIP_INSTDIR\bin\formeditor1.dll" 0 Module_VSIP_SetupVS - - ClearErrors - SetOutPath "$VSIP_INSTDIR\bin" - push "$VSIP_INSTDIR\bin\formeditor1.dll" - call un.RegSvr - - Module_VSIP_SetupVS: - SetOutPath "$1" ; don't stay in .\bin - StrCmp $1 "" Module_VSIP_EndUnReg 0 - DetailPrint "Calling devenv /setup ..." - nsExec::Exec '"$1\devenv.exe" /setup' - Pop $3 - StrCmp $3 "error" 0 Module_VSIP_SetupOK - MessageBox MB_OK "Can not setup devenv! The command $\n$1\devenv.exe /setup$\n failed. Try to run in manually!" - Goto Module_VSIP_EndUnReg - Module_VSIP_SetupOK: - DetailPrint "Running setup was successfull." - Module_VSIP_EndUnReg: - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - - -Function un.InstallSamples - Delete "$VSIP_INSTDIR\samples\AddressBook\adddialog.cpp" - Delete "$VSIP_INSTDIR\samples\AddressBook\adddialog.h" - Delete "$VSIP_INSTDIR\samples\AddressBook\adddialog.ui" - Delete "$VSIP_INSTDIR\samples\AddressBook\addressbook.cpp" - Delete "$VSIP_INSTDIR\samples\AddressBook\addressbook.h" - Delete "$VSIP_INSTDIR\samples\AddressBook\AddressBook.ico" - Delete "$VSIP_INSTDIR\samples\AddressBook\AddressBook.rc" - Delete "$VSIP_INSTDIR\samples\AddressBook\addressbook.ui" - Delete "$VSIP_INSTDIR\samples\AddressBook\AddressBook.vcproj" - Delete "$VSIP_INSTDIR\samples\AddressBook\main.cpp" - RMDir "$VSIP_INSTDIR\samples\AddressBook" - RMDir "$VSIP_INSTDIR\samples" -FunctionEnd - -Function un.InstallResources - !insertmacro UnInstallResourceFiles "bmp" "bitmap" - !insertmacro UnInstallResourceFiles "txt" "text" - !insertmacro UnInstallResourceFiles "htm" "page" - !insertmacro UnInstallResourceFiles "xml" "xmlfile" - !insertmacro UnInstallResourceFiles "png" "image" - !insertmacro UnInstallResourceFiles "ui" "form" - - RmDir "$VSIP_INSTDIR\resources" -FunctionEnd -!macroend - -!macro InstallResourceFiles TYPE TMPLNAME - File "${MODULE_VSIP_ROOT}\resources\${TYPE}.xml" - File "${MODULE_VSIP_ROOT}\resources\${TYPE}icon.bmp" - File "${MODULE_VSIP_ROOT}\resources\${TMPLNAME}.${TYPE}" -!macroend - -!macro UnInstallResourceFiles TYPE TMPLNAME - Delete "$VSIP_INSTDIR\resources\${TYPE}.xml" - Delete "$VSIP_INSTDIR\resources\${TYPE}icon.bmp" - Delete "$VSIP_INSTDIR\resources\${TMPLNAME}.${TYPE}" -!macroend - -!macro InstallUnManagedTranslation VS_SHORT LOCALE - CreateDirectory "$VSIP_INSTDIR\bin\${VS_SHORT}\${LOCALE}" - SetOutPath "$VSIP_INSTDIR\bin\${VS_SHORT}\${LOCALE}" - SetOverwrite ifnewer - - StrCmp ${VS_SHORT} "9.0" 0 +2 - File "${MODULE_VSIP_ROOT}\bin\9.0\${LOCALE}\Qt4VS2008UI.dll" - - StrCmp ${VS_SHORT} "8.0" 0 +2 - File "${MODULE_VSIP_ROOT}\bin\8.0\${LOCALE}\Qt4VS2005UI.dll" - - StrCmp ${VS_SHORT} "7.1" 0 +2 - File "${MODULE_VSIP_ROOT}\bin\7.1\${LOCALE}\Qt4VS2003UI.dll" -!macroend - -!macro UnInstallUnManagedTranslation VS_SHORT LOCALE - StrCmp ${VS_SHORT} "9.0" 0 +2 - Delete "$VSIP_INSTDIR\bin\9.0\${LOCALE}\Qt4VS2008UI.dll" - - StrCmp ${VS_SHORT} "8.0" 0 +2 - Delete "$VSIP_INSTDIR\bin\8.0\${LOCALE}\Qt4VS2005UI.dll" - - StrCmp ${VS_SHORT} "7.1" 0 +2 - Delete "$VSIP_INSTDIR\bin\7.1\${LOCALE}\Qt4VS2003UI.dll" - - RMDir "$VSIP_INSTDIR\bin\${VS_SHORT}\${LOCALE}" -!macroend - -!macro InstallManagedTranslation VS_SHORT LOCALE - CreateDirectory "$VSIP_INSTDIR\bin\${VS_SHORT}\${LOCALE}" - SetOutPath "$VSIP_INSTDIR\bin\${VS_SHORT}\${LOCALE}" - SetOverwrite ifnewer - - StrCmp ${VS_SHORT} "9.0" 0 +3 - File "${MODULE_VSIP_ROOT}\bin\9.0\${LOCALE}\Qt4VS2008.resources.dll" - File "${MODULE_VSIP_ROOT}\bin\9.0\${LOCALE}\QtProjectLib.resources.dll" - - StrCmp ${VS_SHORT} "8.0" 0 +3 - File "${MODULE_VSIP_ROOT}\bin\8.0\${LOCALE}\Qt4VS2005.resources.dll" - File "${MODULE_VSIP_ROOT}\bin\8.0\${LOCALE}\QtProjectLib.resources.dll" - - StrCmp ${VS_SHORT} "7.1" 0 +3 - File "${MODULE_VSIP_ROOT}\bin\7.1\${LOCALE}\Qt4VS2003.resources.dll" - File "${MODULE_VSIP_ROOT}\bin\7.1\${LOCALE}\QtProjectLib.resources.dll" -!macroend - -!macro UnInstallManagedTranslation VS_SHORT LOCALE - StrCmp ${VS_SHORT} "9.0" 0 +2 - Delete "$VSIP_INSTDIR\bin\9.0\${LOCALE}\Qt4VS2008.resources.dll" - - StrCmp ${VS_SHORT} "8.0" 0 +2 - Delete "$VSIP_INSTDIR\bin\8.0\${LOCALE}\Qt4VS2005.resources.dll" - - StrCmp ${VS_SHORT} "7.1" 0 +2 - Delete "$VSIP_INSTDIR\bin\7.1\${LOCALE}\Qt4VS2003.resources.dll" - - Delete "$VSIP_INSTDIR\bin\${VS_SHORT}\${LOCALE}\QtProjectLib.resources.dll" - RMDir "$VSIP_INSTDIR\bin\${VS_SHORT}\${LOCALE}" -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro VSIP_DESCRIPTION - !insertmacro MUI_DESCRIPTION_TEXT ${VSIP_SEC01} "Qt Integration for Visual Studio .NET 2003 v${MODULE_VSIP_VERSION}." - !insertmacro MUI_DESCRIPTION_TEXT ${VSIP_SEC02} "Qt Integration for Visual Studio .NET 2005 v${MODULE_VSIP_VERSION}." - !insertmacro MUI_DESCRIPTION_TEXT ${VSIP_SEC03} "Qt Integration for Visual Studio .NET 2008 v${MODULE_VSIP_VERSION}." -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro VSIP_STARTUP - Push $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - Push $6 - - ClearErrors - StrCmp "$RUNNING_AS_ADMIN" "false" 0 Module_VSIP_CheckForInstallation -!ifndef MODULE_VSIP_NO2003 - SectionSetFlags ${VSIP_SEC01} "16" -!endif -!ifndef MODULE_VSIP_NO2005 - SectionSetFlags ${VSIP_SEC02} "16" -!endif -!ifndef MODULE_VSIP_NO2008 - SectionSetFlags ${VSIP_SEC03} "16" -!endif - Module_VSIP_CheckForInstallation: - - StrCpy $2 "0" - StrCpy $4 "0" - StrCpy $5 "0" - - ClearErrors - - Push "7.1" - Call IsIntegrationInstalled - Pop $1 - -!ifndef MODULE_VSIP_NO2003 - Push "7.1" - Call IsQMsNetInstalled - Pop $4 - - IntCmp $1 0 +2 - SectionSetFlags ${VSIP_SEC01} "16" - - Push "7.1" - Call GetVSInstallationDir - Pop $3 - StrCmp $3 "" 0 +2 - SectionSetFlags ${VSIP_SEC01} "16" -!endif - - ClearErrors - - Push "8.0" - Call IsIntegrationInstalled - Pop $1 - -!ifndef MODULE_VSIP_NO2005 - Push "8.0" - Call IsQMsNetInstalled - Pop $2 - - IntCmp $1 0 +2 - SectionSetFlags ${VSIP_SEC02} "16" - - Push "8.0" - Call GetVSInstallationDir - Pop $3 - StrCmp $3 "" 0 +3 - SectionSetFlags ${VSIP_SEC02} "16" - Goto VSIP_STARTUP_2008 - - Call IsVS2005SP1Installed - Pop $1 - ${If} $1 == 0 - SectionSetFlags ${VSIP_SEC02} ${SF_RO} - MessageBox MB_OK|MB_ICONEXCLAMATION "Service Pack 1 for Visual Studio 2005 is not installed.$\n${PRODUCT_NAME} for VS 2005 will not work properly without it.$\nYou will not be able to choose the ${PRODUCT_NAME} for VS 2005 component for installation." - ${EndIf} - - Call IsDotNet2SP1Installed - Pop $1 - ${If} $1 == 0 - StrCpy $6 "1" - SectionSetFlags ${VSIP_SEC02} ${SF_RO} - MessageBox MB_OK|MB_ICONEXCLAMATION "Service Pack 1 for .NET Framework 2.0 is not installed.$\n${PRODUCT_NAME} for VS 2005 will not work properly without it.$\nYou will not be able to choose the ${PRODUCT_NAME} for VS 2005 component for installation." - ${Else} - StrCpy $6 "0" - ${EndIf} -VSIP_STARTUP_2008: -!endif - - ClearErrors - - Push "9.0" - Call IsIntegrationInstalled - Pop $1 - -!ifndef MODULE_VSIP_NO2008 - Push "9.0" - Call IsQMsNetInstalled - Pop $5 - - IntCmp $1 0 +2 - SectionSetFlags ${VSIP_SEC03} "16" - - Push "9.0" - Call GetVSInstallationDir - Pop $3 - StrCmp $3 "" 0 +2 - SectionSetFlags ${VSIP_SEC03} "16" - - ${If} $6 == "0" - Call IsDotNet2SP1Installed - Pop $1 - ${If} $1 == 0 - SectionSetFlags ${VSIP_SEC02} ${SF_RO} - MessageBox MB_OK|MB_ICONEXCLAMATION "Service Pack 1 for .NET Framework 2.0 is not installed.$\n${PRODUCT_NAME} for VS 2008 will not work properly without it.$\nYou will not be able to choose the ${PRODUCT_NAME} for VS 2008 component for installation." - ${EndIf} - ${EndIf} -!endif - - IntOp $1 $2 + $4 - IntOp $1 $1 + $5 - IntCmp $1 0 +2 - MessageBox MB_OK|MB_ICONEXCLAMATION "The installer has detected that the Qt Visual Studio Add-In is installed.$\r$\nThe Add-In conflicts with the integration." - - StrCpy $VSIP_INSTDIR "$PROGRAMFILES\Nokia\Qt VS Integration" - -!ifndef MODULE_VSIP_NO2003 - SectionSetSize ${VSIP_SEC01} 7000 -!endif -!ifndef MODULE_VSIP_NO2005 - SectionSetSize ${VSIP_SEC02} 7000 -!endif -!ifndef MODULE_VSIP_NO2008 - SectionSetSize ${VSIP_SEC03} 7000 -!endif - - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro VSIP_FINISH -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro VSIP_UNSTARTUP - !insertmacro ConfirmOnRemove "Qt4VS2003" "Qt Visual Studio Integration (VS2003)" - !insertmacro ConfirmOnRemove "Qt4VS2005" "Qt Visual Studio Integration (VS2005)" - !insertmacro ConfirmOnRemove "Qt4VS2008" "Qt Visual Studio Integration (VS2008)" -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro VSIP_UNINSTALL - - Push $0 - Push $1 - Push $2 - - ReadRegDWord $0 SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VS2003" - IntCmp $0 1 0 MODULE_VSIP_UNINSTALL2005 - StrCpy $VS_VERSION_SHORT "7.1" - StrCpy $VS_VERSION "2003" - Push $VS_VERSION_SHORT - Call un.InstallVSIP - !insertmacro un.InstallHelpInVS "qt4vs" "$VS_VERSION_SHORT" - - MODULE_VSIP_UNINSTALL2005: - ReadRegDWord $1 SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VS2005" - IntCmp $1 1 0 MODULE_VSIP_UNINSTALL2008 - StrCpy $VS_VERSION_SHORT "8.0" - StrCpy $VS_VERSION "2005" - Push $VS_VERSION_SHORT - Call un.InstallVSIP - !insertmacro un.InstallHelpInVS "qt4vs" "$VS_VERSION_SHORT" - - MODULE_VSIP_UNINSTALL2008: - ReadRegDWord $2 SHCTX "$PRODUCT_UNIQUE_KEY" "Qt4VS2008" - IntCmp $2 1 0 MODULE_VSIP_UNINSTALL_COMMON - StrCpy $VS_VERSION_SHORT "9.0" - StrCpy $VS_VERSION "2008" - Push $VS_VERSION_SHORT - Call un.InstallVSIP - !insertmacro un.InstallHelpInVS "qt4vs" "$VS_VERSION_SHORT" - - MODULE_VSIP_UNINSTALL_COMMON: - Delete "$SMPROGRAMS\$STARTMENU_STRING\Visual Studio Integration Readme.lnk" - - IfFileExists "$VSIP_INSTDIR\help\h2reg.exe" 0 MODULE_VSIP_UNINSTALL_HELP_DONE - !insertmacro un.RegisterHelp "$VSIP_INSTDIR\help" "qt4vs" - !insertmacro un.InstallHelp "$VSIP_INSTDIR\help" "qt4vs" "0.0" - Push "$VSIP_INSTDIR\help" - Call un.DeleteH2RegFiles - MODULE_VSIP_UNINSTALL_HELP_DONE: - - Delete "$VSIP_INSTDIR\Readme.txt" - Delete "$VSIP_INSTDIR\ui.ico" - Delete "$VSIP_INSTDIR\Changes-${MODULE_VSIP_VERSION}" - RmDir "$VSIP_INSTDIR" - - Pop $2 - Pop $1 - Pop $0 - -!macroend - -;------------------------------------------------------------------------------------------------ - -!macro VSIP_UNFINISH -!macroend - -;------------------------------------------------------------------------------------------------ - -!else -!macro VSIP_INITIALIZE -!macroend -!macro VSIP_SECTIONS -!macroend -!macro VSIP_MERGE_HELP_NAMESPACE_SECTIONS -!macroend -!macro VSIP_DESCRIPTION -!macroend -!macro VSIP_STARTUP -!macroend -!macro VSIP_FINISH -!macroend -!macro VSIP_UNSTARTUP -!macroend -!macro VSIP_CLEANUP_HELP_NAMESPACE -!macroend -!macro VSIP_UNINSTALL -!macroend -!macro VSIP_UNFINISH -!macroend -!endif diff --git a/util/scripts/win-binary/nsis/opensource.ini b/util/scripts/win-binary/nsis/opensource.ini deleted file mode 100644 index 03d6178..0000000 --- a/util/scripts/win-binary/nsis/opensource.ini +++ /dev/null @@ -1,38 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=4 - -[Field 1] -Type=Label -Text=You are now installing the Open Source Edition of Qt. It is licensed under GNU LGPL version 2.1 and the GPL version 3. -Left=0 -Right=300 -Top=0 -Bottom=78 - -[Field 2] -Type=Link -Text=http://qtsoftware.com/developer/downloads/qt -State=http://qtsoftware.com/developer/downloads/qt -Left=0 -Right=278 -Top=80 -Bottom=88 - -[Field 3] -Type=Link -Text=http://qtsoftware.com/company/model -State=http://qtsoftware.com/company/model -Left=0 -Right=267 -Top=112 -Bottom=120 - -[Field 4] -Type=Label -Text=To read more about Nokia's licensing, please go to: -Left=0 -Right=278 -Top=97 -Bottom=105 - diff --git a/util/scripts/win-binary/nsis/qsa.ini b/util/scripts/win-binary/nsis/qsa.ini deleted file mode 100644 index 7af62e2..0000000 --- a/util/scripts/win-binary/nsis/qsa.ini +++ /dev/null @@ -1,28 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=3 - -[Field 1] -Type=Groupbox -Text=QSA Build Options -Left=0 -Right=299 -Top=9 -Bottom=65 - -[Field 2] -Type=Checkbox -Text=Don't compile QSA Workbench into QSA. -Left=20 -Right=284 -Top=27 -Bottom=37 - -[Field 3] -Type=Checkbox -Text=Don't compile QSA Workbench nor QSA Editor into QSA. -Left=20 -Right=247 -Top=45 -Bottom=56 - diff --git a/util/scripts/win-binary/nsis/qtdir.ini b/util/scripts/win-binary/nsis/qtdir.ini deleted file mode 100644 index 698a1d6..0000000 --- a/util/scripts/win-binary/nsis/qtdir.ini +++ /dev/null @@ -1,70 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=8 - -[Field 1] -Type=Groupbox -Text=Select Qt Version -Left=0 -Right=299 -Top=65 -Bottom=130 - -[Field 2] -Type=Label -Text=Please choose a Qt Version from the detected versions list. If the Qt Version you want to use is missing from the list, you should specify QTDIR manually. -Left=4 -Right=294 -Top=1 -Bottom=20 - -[Field 3] -Type=Droplist -Text=Droplist -Flags=NOTIFY -Left=9 -Right=290 -Top=85 -Bottom=138 -ListItems= - -[Field 4] -Type=Label -Text=Detected Qt Versions: -Left=9 -Right=154 -Top=76 -Bottom=84 - -[Field 5] -Type=DirRequest -Left=9 -Right=290 -Top=110 -Bottom=123 - -[Field 6] -Type=Label -Text=Specify QTDIR manually: -Left=9 -Right=154 -Top=102 -Bottom=110 - -[Field 7] -Type=Groupbox -Text=Select a Compiler -Left=0 -Right=299 -Top=24 -Bottom=59 - -[Field 8] -Type=Droplist -Text=Droplist -ListItems= -Left=9 -Right=290 -Top=39 -Bottom=89 - diff --git a/util/scripts/win-binary/nsis/qtjambieclipse.ini b/util/scripts/win-binary/nsis/qtjambieclipse.ini deleted file mode 100644 index 2898c24..0000000 --- a/util/scripts/win-binary/nsis/qtjambieclipse.ini +++ /dev/null @@ -1,26 +0,0 @@ -[Settings] -NumFields=3 - -[Field 1] -Type=Groupbox -Text=Eclipse Installation -Left=1 -Right=300 -Top=8 -Bottom=59 - -[Field 2] -Type=DirRequest -State=C:\Eclipse -Left=12 -Right=286 -Top=33 -Bottom=46 - -[Field 3] -Type=Label -Text=Select the Eclipse installation you want to use: -Left=12 -Right=157 -Top=22 -Bottom=30 diff --git a/util/scripts/win-binary/nsis/qtnsisext/binpatch.cpp b/util/scripts/win-binary/nsis/qtnsisext/binpatch.cpp deleted file mode 100644 index 1c5109c..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/binpatch.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <stdio.h> -#include <locale> - -#include "binpatch.h" - -// returns positive value if it finds a null termination inside the buffer -long BinPatch::getBufferStringLength(char *data, char *end) -{ - long size = 0; - while (data < end) { - if (*data == '\0') - return size; - ++data; - ++size; - } - - return -1; -} - -// returns true if data ends with one of the tokens. (Sep. with ;) -bool BinPatch::endsWithTokens(const char *data) -{ - if(strlen(endTokens) > 0) { - char endstmp[1024]; - ulong tlen = ulong(strlen(data)); - - if(strlen(endTokens) >= sizeof(endstmp)) - return false; - - strcpy(endstmp, endTokens); - - char *token = strtok(endstmp, ";"); - - while(token != NULL) { - // check if it ends with the token - if ((tlen >= strlen(token)) - && (stricmp((data+tlen)-strlen(token), token) == 0)) - return true; - token = strtok(NULL, ";"); - } - } else { - return true; //true if no tokens - } - - return false; //no matching tokens -} - -bool BinPatch::patchHelper(char *inbuffer, const char *oldstr, const char *newstr, size_t len, long *rw) -{ - char nc1 = *oldstr; - char nc2 = 0; - char *inend = inbuffer + len; - size_t oldlen = strlen(oldstr); - size_t newlen = strlen(newstr); - char *instart = inbuffer; - *rw = 0; - bool write = true; - - isupper(nc1) ? nc2 = tolower(nc1) : nc2 = toupper(nc1); - - while(inbuffer < inend) { - if ((*inbuffer == nc1) || (*inbuffer == nc2)) { - if (inbuffer > (inend-oldlen) || inbuffer > (inend-newlen)) { - *rw = (long)(inend-inbuffer); //rewind, not enough to make a compare - break; - } - - if (strnicmp(inbuffer, oldstr, oldlen) == 0) { - if (useLength && (instart == inbuffer)) { - *rw = (long)(len+1); //we don't have access to the length byte, rewind all + 1! - write = false; - break; - } - - long oldsize = -1; - if (useLength) { //VC60 - oldsize = (unsigned char)(*(inbuffer-1)); - - // vc60 pdb files sometimes uses 0A, then it should be null terminated - if (oldsize < (long)oldlen) { - if (oldsize != 0x0A) { //strange case... skip - inbuffer+=oldlen; - continue; - } - - oldsize = getBufferStringLength(inbuffer, inend); - - if (oldsize < 0) { - *rw = (long)(inend-inbuffer); //rewind, entire string not in buffer - break; - } - } - - if (inbuffer > (inend-oldsize)) { - *rw = (long)(inend-inbuffer); //rewind, entire string not in buffer - break; - } - } else { //VC7x - oldsize = getBufferStringLength(inbuffer, inend); - if (oldsize < 0) { - *rw = (long)(inend-inbuffer); //rewind, entire string not in buffer - break; - } - } - - char oldPath[1024]; - if (oldsize > sizeof(oldPath)) { - //at least don't crash - inbuffer+=oldsize; - continue; - } - memset(oldPath, '\0', sizeof(oldPath)); - strncpy(oldPath, newstr, newlen); - - if (insertReplace) - strncat(oldPath, inbuffer+oldlen, oldsize-oldlen); - - // just replace if it ends with a token in endTokens - if (endsWithTokens(oldPath)) { - if (oldsize < (long)strlen(oldPath)) - oldsize = (long)strlen(oldPath); - - memcpy(inbuffer, oldPath, oldsize); - } - - inbuffer+=oldsize; - continue; - } - } - ++inbuffer; - } - - return write; -} - -bool BinPatch::patch(const char *oldstr, const char *newstr) -{ - size_t oldlen = strlen(oldstr); - size_t newlen = strlen(newstr); - - if ((!fileName || strlen(fileName) < 1) - || (!oldstr || oldlen < 1) - || (!newstr || newlen < 1)) - return false; - - FILE *input; - - if (!(input = fopen(fileName, "r+b"))) - { - fprintf(stderr, "Cannot open file %s!\n", fileName); - return false; - } - - char data[60000]; - long rw = 0; - long offset = 0; - - size_t len; - len = fread(data, sizeof(char), sizeof(data), input); - - do { - if (patchHelper(data, oldstr, newstr, len, &rw)) { - fseek(input, offset, SEEK_SET); //overwrite - fwrite(data, sizeof(char), len, input); - } - - offset += (long)((-rw) + len); - if (fseek(input, offset, SEEK_SET) != 0) - break; - len = fread(data, sizeof(char), sizeof(data), input); - } while(!(feof(input) && (len <= oldlen || len <= newlen))); - - fclose(input); - - return true; -} diff --git a/util/scripts/win-binary/nsis/qtnsisext/exdll.h b/util/scripts/win-binary/nsis/qtnsisext/exdll.h deleted file mode 100644 index 3f5a0ef..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/exdll.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef _EXDLL_H_ -#define _EXDLL_H_ - -// only include this file from one place in your DLL. -// (it is all static, if you use it in two places it will fail) - -#define EXDLL_INIT() { \ - g_stringsize=string_size; \ - g_stacktop=stacktop; \ - g_variables=variables; } - -// For page showing plug-ins -#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8) -#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd) -#define NOTIFY_BYE_BYE 'x' - -typedef struct _stack_t { - struct _stack_t *next; - char text[1]; // this should be the length of string_size -} stack_t; - - -static unsigned int g_stringsize; -static stack_t **g_stacktop; -static char *g_variables; - -static int __stdcall popstring(char *str); // 0 on success, 1 on empty stack -static void __stdcall pushstring(char *str); - -enum -{ -INST_0, // $0 -INST_1, // $1 -INST_2, // $2 -INST_3, // $3 -INST_4, // $4 -INST_5, // $5 -INST_6, // $6 -INST_7, // $7 -INST_8, // $8 -INST_9, // $9 -INST_R0, // $R0 -INST_R1, // $R1 -INST_R2, // $R2 -INST_R3, // $R3 -INST_R4, // $R4 -INST_R5, // $R5 -INST_R6, // $R6 -INST_R7, // $R7 -INST_R8, // $R8 -INST_R9, // $R9 -INST_CMDLINE, // $CMDLINE -INST_INSTDIR, // $INSTDIR -INST_OUTDIR, // $OUTDIR -INST_EXEDIR, // $EXEDIR -INST_LANG, // $LANGUAGE -__INST_LAST -}; - - -// utility functions (not required but often useful) -static int __stdcall popstring(char *str) -{ - stack_t *th; - if (!g_stacktop || !*g_stacktop) return 1; - th=(*g_stacktop); - lstrcpy(str,th->text); - *g_stacktop = th->next; - GlobalFree((HGLOBAL)th); - return 0; -} - -static void __stdcall pushstring(char *str) -{ - stack_t *th; - if (!g_stacktop) return; - th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize); - lstrcpyn(th->text,str,g_stringsize); - th->next=*g_stacktop; - *g_stacktop=th; -} - -static char * __stdcall getuservariable(int varnum) -{ - if (varnum < 0 || varnum >= __INST_LAST) return NULL; - return g_variables+varnum*g_stringsize; -} - -static void __stdcall setuservariable(int varnum, char *var) -{ - if (var != NULL && varnum >= 0 && varnum < __INST_LAST) - lstrcpy(g_variables + varnum*g_stringsize, var); -} - - - -#endif//_EXDLL_H_
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/qtnsisext/licensefinder.cpp b/util/scripts/win-binary/nsis/qtnsisext/licensefinder.cpp deleted file mode 100644 index 7de1618..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/licensefinder.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "licensefinder.h" - -LicenseFinder::LicenseFinder() -{ - searched = false; - memset(licensee, '\0', sizeof(licensee)*sizeof(char)); - memset(m_key, '\0', sizeof(m_key)*sizeof(char)); - memset(m_oldkey, '\0', sizeof(m_oldkey)*sizeof(char)); - memset(m_customerId, '\0', sizeof(m_customerId)*sizeof(char)); - memset(m_products, '\0', sizeof(m_products)*sizeof(char)); - memset(m_expiryDate, '\0', sizeof(m_expiryDate)*sizeof(char)); -} - -char *LicenseFinder::getLicensee() -{ - if (!searched) - searchLicense(); - - return licensee; -} - -char *LicenseFinder::getLicenseKey() -{ - if (!searched) - searchLicense(); - - return m_key; -} - -char *LicenseFinder::getOldLicenseKey() -{ - if (!searched) - searchLicense(); - - return m_oldkey; -} - -char *LicenseFinder::getCustomerID() -{ - if (!searched) - searchLicense(); - - return m_customerId; -} - -char *LicenseFinder::getProducts() -{ - if (!searched) - searchLicense(); - - return m_products; -} - -char *LicenseFinder::getExpiryDate() -{ - if (!searched) - searchLicense(); - - return m_expiryDate; -} - -void LicenseFinder::searchLicense() -{ - searched = true; - char *path = getenv("HOME"); - if (path && lookInDirectory(path)) - return; - - path = getenv("USERPROFILE"); - if (path && lookInDirectory(path)) - return; - - path = getenv("HOMEDRIVE"); - if (path) { - char *dir = getenv("HOMEPATH"); - if (dir) { - char *combined = (char*)malloc(sizeof(char)*(strlen(path) + strlen(dir) + 1)); - strcpy(combined, path); - strcat(combined, dir); - lookInDirectory(combined); - free(combined); - } - } -} - -bool LicenseFinder::lookInDirectory(const char *dir) -{ - FILE *f; - char file[_MAX_PATH]; - char buf[60000]; - - // reset the buffers again, just to be safe :) - memset(file, '\0', sizeof(file)); - memset(buf, '\0', sizeof(buf)); - memset(licensee, '\0', sizeof(licensee)); - memset(m_key, '\0', sizeof(m_key)); - memset(m_oldkey, '\0', sizeof(m_oldkey)); - memset(m_customerId, '\0', sizeof(m_customerId)); - memset(m_products, '\0', sizeof(m_products)); - memset(m_expiryDate, '\0', sizeof(m_expiryDate)); - - if (((strlen(dir)+strlen("\\.qt-license"))*sizeof(char)) >= _MAX_PATH) - return false; - - strcpy(file, dir); - strcat(file, "\\.qt-license"); - if ((f = fopen(file, "r")) == NULL) - return false; - - size_t r = fread(buf, sizeof(char), 59999, f); - buf[r] = '\0'; - - /* Licensee */ - const char *pat1 = "Licensee=\""; - char *tmp = findPattern(buf, pat1, ulong(r)); - if (tmp && (strlen(tmp) > 1)) { - char *end = strchr(tmp, '\"'); - if (end && ((end-tmp) < MAX_LICENSEE_LENGTH)) - strncpy(licensee, tmp, end-tmp); - } - - /* LicenseKey */ - const char *pat2 = "LicenseKeyExt="; - tmp = findPattern(buf, pat2, ulong(r)); - if (tmp) { - char *end = strchr(tmp, '\r'); - if (!end) - end = strchr(tmp, '\n'); - if (end && ((end-tmp) < MAX_KEY_LENGTH)) - strncpy(m_key, tmp, end-tmp); - else if (strlen(tmp) < MAX_KEY_LENGTH) - strcpy(m_key, tmp); - } - - /* OldLicenseKey */ - const char *pat3 = "LicenseKey="; - tmp = findPattern(buf, pat3, ulong(r)); - if (tmp) { - char *end = strchr(tmp, '\r'); - if (!end) - end = strchr(tmp, '\n'); - if (end && ((end-tmp) < MAX_KEY_LENGTH)) - strncpy(m_oldkey, tmp, end-tmp); - else if (strlen(tmp) < MAX_KEY_LENGTH) - strcpy(m_oldkey, tmp); - } - - /* CustomerID */ - const char *pat4 = "CustomerID=\""; - tmp = findPattern(buf, pat4, ulong(r)); - if (tmp && (strlen(tmp) > 1)) { - char *end = strchr(tmp, '\"'); - if (end && ((end-tmp) < MAX_QT3INFO_LENGTH)) - strncpy(m_customerId, tmp, end-tmp); - } - - /* Products */ - const char *pat5 = "Products=\""; - tmp = findPattern(buf, pat5, ulong(r)); - if (tmp && (strlen(tmp) > 1)) { - char *end = strchr(tmp, '\"'); - if (end && ((end-tmp) < MAX_QT3INFO_LENGTH)) - strncpy(m_products, tmp, end-tmp); - } - - /* ExpiryDate */ - const char *pat6 = "ExpiryDate="; - tmp = findPattern(buf, pat6, ulong(r)); - if (tmp) { - char *end = strchr(tmp, '\r'); - if (!end) - end = strchr(tmp, '\n'); - if (end && ((end-tmp) < MAX_QT3INFO_LENGTH)) - strncpy(m_expiryDate, tmp, end-tmp); - else if (strlen(tmp) < MAX_QT3INFO_LENGTH) - strcpy(m_expiryDate, tmp); - } - - fclose(f); - - return true; -} - -/* copied from binpatch.cpp */ -char *LicenseFinder::findPattern(char *h, const char *n, ulong hlen) -{ - if (!h || !n || hlen == 0) - return 0; - - ulong nlen; - - char nc = *n++; - nlen = ulong(strlen(n)); - char hc; - - do { - do { - hc = *h++; - if (hlen-- < 1) - return 0; - } while (hc != nc); - if (nlen > hlen) - return 0; - } while (strncmp(h, n, nlen) != 0); - return h + nlen; -}
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/qtnsisext/mingw.cpp b/util/scripts/win-binary/nsis/qtnsisext/mingw.cpp deleted file mode 100644 index 15ff3c1..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/mingw.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <windows.h> -#include <io.h> -#include <stdio.h> -#include "mingw.h" - -HANDLE hChildStdoutWr, hChildStdoutRd; - -#define VERSION_SIZE 30 -#define WIN32_VERSION_STRING "__W32API_VERSION 3.2" - -BOOL CreateChildProcess(char *command) -{ - PROCESS_INFORMATION piProcInfo; - STARTUPINFOA siStartInfo; - BOOL bFuncRetn = FALSE; - - ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) ); - - ZeroMemory( &siStartInfo, sizeof(STARTUPINFOA) ); - siStartInfo.cb = sizeof(STARTUPINFOA); - siStartInfo.hStdError = hChildStdoutWr; - siStartInfo.hStdOutput = hChildStdoutWr; - siStartInfo.dwFlags |= STARTF_USESTDHANDLES; - - bFuncRetn = CreateProcessA(NULL, - command, - NULL, // process security attributes - NULL, // thread security attributes - TRUE, // inherit handles - CREATE_NO_WINDOW, - NULL, // use environment - NULL, // use current directory - &siStartInfo, - &piProcInfo); - - if (bFuncRetn == 0) - return 0; - else - { - CloseHandle(piProcInfo.hProcess); - CloseHandle(piProcInfo.hThread); - return bFuncRetn; - } -} - -void getMinGWVersion(char *path, int *major, int *minor, int *patch) -{ - char command[MINGW_BUFFER_SIZE]; - char instr[VERSION_SIZE]; - - strcpy(command, path); - strcat(command, "\\bin\\gcc.exe --version"); - - SECURITY_ATTRIBUTES saAttr; - - saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); - saAttr.bInheritHandle = TRUE; - saAttr.lpSecurityDescriptor = NULL; - - if (!CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0)) - return;; - - if (CreateChildProcess(command) == 0) - return; - - DWORD nBytes = 0; - ReadFile(hChildStdoutRd, instr, VERSION_SIZE, &nBytes, NULL); - instr[VERSION_SIZE-1] = '\0'; - - char *gcc = strstr(instr, "(GCC)"); - if (gcc == NULL) - return; - - sscanf(gcc, "(GCC) %d.%d.%d ", major, minor, patch); -} - -bool hasValidIncludeFiles(char *path) -{ - char filename[MINGW_BUFFER_SIZE]; - char buffer[MINGW_BUFFER_SIZE]; - - strcpy(filename, path); - strcat(filename, "\\include\\w32api.h"); - - FILE *finc; - if ((finc = fopen(filename, "rb")) == NULL) - return false; - - memset(buffer, '\0', sizeof(char)*MINGW_BUFFER_SIZE); - fread(buffer, sizeof(char), MINGW_BUFFER_SIZE-1, finc); - - if (strstr(buffer, WIN32_VERSION_STRING) != NULL) - return true; - - return false; -} - -bool shInEnvironment() -{ - char chpath[_MAX_PATH]; - char *env = getenv("PATH"); - char seps[] = ";"; - char *path; - - path = strtok(env, seps); - while(path != NULL) - { - sprintf(chpath, "%s\\sh.exe", path); - if(_access(chpath, 0) != -1) - return true; - - path = strtok(NULL, seps); - } - - return false; -} diff --git a/util/scripts/win-binary/nsis/qtnsisext/mingw.h b/util/scripts/win-binary/nsis/qtnsisext/mingw.h deleted file mode 100644 index e975a9e..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/mingw.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#define MINGW_BUFFER_SIZE 1024 - -void getMinGWVersion(char *path, int *major, int *minor, int *patch); -bool hasValidIncludeFiles(char *path); -bool shInEnvironment();
\ No newline at end of file diff --git a/util/scripts/win-binary/nsis/qtnsisext/qtlibspatcher.exe b/util/scripts/win-binary/nsis/qtnsisext/qtlibspatcher.exe Binary files differdeleted file mode 100755 index b9ec6d2..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/qtlibspatcher.exe +++ /dev/null diff --git a/util/scripts/win-binary/nsis/qtnsisext/qtlibspatcher.vcproj b/util/scripts/win-binary/nsis/qtnsisext/qtlibspatcher.vcproj deleted file mode 100644 index aeed5ec..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/qtlibspatcher.vcproj +++ /dev/null @@ -1,206 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8,00" - Name="qtlibspatcher" - ProjectGUID="{DC56C66A-5D15-46C8-91E6-AB36FC26F8DA}" - RootNamespace="qtlibspatcher" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="3" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" - RuntimeLibrary="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="false" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\binpatch.cpp" - > - </File> - <File - RelativePath=".\qtlibspatchermain.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\binpatch.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/util/scripts/win-binary/nsis/qtnsisext/qtlibspatchermain.cpp b/util/scripts/win-binary/nsis/qtnsisext/qtlibspatchermain.cpp deleted file mode 100644 index 008cc46..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/qtlibspatchermain.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "binpatch.h" -#include <stdio.h> - -bool patchBinaryWithQtPathes(const char *fileName, const char *baseQtPath) -{ - bool result = true; - - static const struct - { - const char *variable; - const char *subDirectory; - } variables[] = { - {"qt_prfxpath=", ""}, - {"qt_docspath=", "/doc"}, - {"qt_hdrspath=", "/include"}, - {"qt_libspath=", "/lib"}, - {"qt_binspath=", "/bin"}, - {"qt_plugpath=", "/plugins"}, - {"qt_datapath=", ""}, - {"qt_trnspath=", "/translations"}, - {"qt_xmplpath=", "/examples"}, - {"qt_demopath=", "/demos"} - }; - - for (int i = 0; i < sizeof(variables)/sizeof(variables[0]); i++) { - char newStr[256] = ""; - strncpy(newStr, variables[i].variable, sizeof(newStr)); - newStr[sizeof(newStr) - 1] = 0; - strncat(newStr, baseQtPath, sizeof(newStr) - strlen(newStr) - 1); - newStr[sizeof(newStr) - 1] = 0; - strncat(newStr, variables[i].subDirectory, sizeof(newStr) - strlen(newStr) - 1); - newStr[sizeof(newStr) - 1] = 0; - BinPatch binFile(fileName); - if (!binFile.patch(variables[i].variable, newStr)) { - result = false; - break; - } - } - - return result; -} - -bool patchBinariesWithQtPathes(const char *baseQtPath) -{ - bool result = true; - - static const char *filesToPatch[] = { - "/bin/qmake.exe", - "/bin/QtCore4.dll", - "/bin/QtCored4.dll" - }; - - for (int i = 0; i < sizeof(filesToPatch)/sizeof(filesToPatch[0]); i++) { - char fileName[FILENAME_MAX] = ""; - strncpy(fileName, baseQtPath, sizeof(fileName)); - fileName[sizeof(fileName)-1] = '\0'; - strncat(fileName, filesToPatch[i], sizeof(fileName) - strlen(fileName) - 1); - fileName[sizeof(fileName)-1] = '\0'; - if (!patchBinaryWithQtPathes(fileName, baseQtPath)) { - result = false; - break; - } - } - - return result; -} - -bool patchDebugLibrariesWithQtPath(const char *baseQtPath) -{ - bool result = true; - - static const struct - { - const char *fileName; - const char *sourceLocation; - } libraries[] = { - {"/bin/Qt3Supportd4.dll", "/src/qt3support/"}, - {"/bin/QtCored4.dll", "/src/corelib/"}, - {"/bin/QtGuid4.dll", "/src/gui/"}, - {"/bin/QtHelpd4.dll", "/tools/assistant/lib/"}, - {"/bin/QtNetworkd4.dll", "/src/network/"}, - {"/bin/QtOpenGLd4.dll", "/src/opengl/"}, - {"/bin/QtScriptd4.dll", "/src/script/"}, - {"/bin/QtSqld4.dll", "/src/sql/"}, - {"/bin/QtSvgd4.dll", "/src/svg/"}, - {"/bin/QtTestd4.dll", "/src/testlib/"}, - {"/bin/QtWebKitd4.dll", "/src/3rdparty/webkit/WebCore/"}, - {"/bin/QtXmld4.dll", "/src/xml/"}, - {"/bin/QtXmlPatternsd4.dll", "/src/xmlpatterns/"}, - {"/plugins/accessible/qtaccessiblecompatwidgetsd4.dll", "/src/plugins/accessible/compat/"}, - {"/plugins/accessible/qtaccessiblewidgetsd4.dll", "/src/plugins/accessible/widgets/"}, - {"/plugins/codecs/qcncodecsd4.dll", "/src/plugins/codecs/cn/"}, - {"/plugins/codecs/qjpcodecsd4.dll", "/src/plugins/codecs/jp/"}, - {"/plugins/codecs/qkrcodecsd4.dll", "/src/plugins/codecs/kr/"}, - {"/plugins/codecs/qtwcodecsd4.dll", "/src/plugins/codecs/tw/"}, - {"/plugins/iconengines/qsvgicond4.dll", "/src/plugins/iconengines/svgiconengine/"}, - {"/plugins/imageformats/qgifd4.dll", "/src/plugins/imageformats/gif/"}, - {"/plugins/imageformats/qjpegd4.dll", "/src/plugins/imageformats/jpeg/"}, - {"/plugins/imageformats/qmngd4.dll", "/src/plugins/imageformats/mng/"}, - {"/plugins/imageformats/qsvgd4.dll", "/src/plugins/imageformats/svg/"}, - {"/plugins/imageformats/qtiffd4.dll", "/src/plugins/imageformats/tiff/"}, - {"/plugins/sqldrivers/qsqlited4.dll", "/src/plugins/sqldrivers/sqlite/"}, -// {"/plugins/sqldrivers/qsqlodbcd4.dll", "/src/plugins/sqldrivers/odbc/"} - }; - - for (int i = 0; i < sizeof(libraries)/sizeof(libraries[0]); i++) { - char fileName[FILENAME_MAX] = ""; - strncpy(fileName, baseQtPath, sizeof(fileName)); - fileName[sizeof(fileName)-1] = '\0'; - strncat(fileName, libraries[i].fileName, sizeof(fileName) - strlen(fileName) - 1); - fileName[sizeof(fileName)-1] = '\0'; - - char oldSourcePath[FILENAME_MAX] = - "C:/depot/qt-workbench/Trolltech/Code_less_create_more/Trolltech/Code_less_create_more/Trolltech"; - strncat(oldSourcePath, libraries[i].sourceLocation, sizeof(oldSourcePath) - strlen(oldSourcePath) - 1); - oldSourcePath[sizeof(oldSourcePath)-1] = '\0'; - - char newSourcePath[FILENAME_MAX] = ""; - strncpy(newSourcePath, baseQtPath, sizeof(newSourcePath)); - newSourcePath[sizeof(newSourcePath)-1] = '\0'; - strncat(newSourcePath, libraries[i].sourceLocation, sizeof(newSourcePath) - strlen(newSourcePath) - 1); - newSourcePath[sizeof(newSourcePath)-1] = '\0'; - - BinPatch binFile(fileName); - if (!binFile.patch(oldSourcePath, newSourcePath)) { - result = false; - break; - } - } - - return result; -} - -int main(int argc, char *args[]) -{ - if (argc != 2) { - printf("Please provide a QTDIR value as parameter.\n" - "This is also the location where the binaries are expected\n" - "in the \"/bin\" and \"/plugins\" subdirectories.\n"); - return 1; - } - - char baseQtPath[FILENAME_MAX] = ""; - strncpy(baseQtPath, args[1], sizeof(baseQtPath)); - baseQtPath[sizeof(baseQtPath)-1] = '\0'; - - // Convert backslash to slash - for (char *p = baseQtPath; *p != '\0'; p++) - if (*p == '\\') - *p = '/'; - - // Remove trailing slash(es) - for (char *p = baseQtPath + strlen(baseQtPath) - 1; p != baseQtPath; p--) - if (*p == '/') - *p = '\0'; - else - break; - - return patchBinariesWithQtPathes(baseQtPath) && patchDebugLibrariesWithQtPath(baseQtPath)?0:1; -} diff --git a/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.cpp b/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.cpp deleted file mode 100644 index c9deb73..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.cpp +++ /dev/null @@ -1,495 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 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.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <windows.h> -#include "exdll.h" -#include "keydec.h" -#include "licensefinder.h" -#include "binpatch.h" -#include "mingw.h" -#include <stdio.h> -#include <time.h> - -HINSTANCE g_hInstance; -HWND g_hwndParent; - -#define EXPORT_NSIS_FUNCTION(funcName) \ -extern "C" void __declspec(dllexport) funcName(HWND hwndParent, int string_size, \ - char *variables, stack_t **stacktop) - -BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) -{ - g_hInstance=static_cast<HINSTANCE>(hInst); - return TRUE; -} - -EXPORT_NSIS_FUNCTION(IsValidLicense) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char isValid[2]; - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(key); - - KeyDecoder kdec(key); - if (kdec.IsValid() && ( - kdec.getPlatforms() & KeyDecoder::Windows - || kdec.getPlatforms() & KeyDecoder::Embedded - || kdec.getPlatforms() & KeyDecoder::WinCE)) - strcpy(isValid, "1"); - else - strcpy(isValid, "0"); - - LocalFree(key); - pushstring(isValid); -} - -EXPORT_NSIS_FUNCTION(IsValidWinCELicense) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char isValid[2]; - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(key); - - KeyDecoder kdec(key); - if (kdec.IsValid() && (kdec.getPlatforms() & KeyDecoder::WinCE)) - strcpy(isValid, "1"); - else - strcpy(isValid, "0"); - - LocalFree(key); - pushstring(isValid); -} - -EXPORT_NSIS_FUNCTION(HasLicenseProduct) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char retVal[2]; - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *product = (char *)LocalAlloc(LPTR, g_stringsize+1); - uint qtproduct = 0; - - popstring(key); - popstring(product); - - for (int i=0; i<KeyDecoder::NumberOfProducts; ++i) { - if (KeyDecoder::Products[i] != 0 && stricmp(product, KeyDecoder::Products[i]) == 0) { - qtproduct = (1 << i); - break; - } - } - - KeyDecoder kdec(key); - if (kdec.IsValid() - && (qtproduct != 0) - && (kdec.getProducts() & qtproduct)) { - strcpy(retVal, "1"); - } else { - strcpy(retVal, "0"); - } - - LocalFree(product); - LocalFree(key); - pushstring(retVal); -} - -EXPORT_NSIS_FUNCTION(GetLicenseID) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(key); - - char lcnsid[512]; - lcnsid[0] = '\0'; - - KeyDecoder kdec(key); - if (kdec.IsValid()) { - uint qtlcnsid = kdec.getLicenseID(); - sprintf(lcnsid, "%d", qtlcnsid); - } - - LocalFree(key); - pushstring(lcnsid); -} - -EXPORT_NSIS_FUNCTION(GetLicenseProduct) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(key); - - char lcnsprod[512]; - lcnsprod[0] = '\0'; - - KeyDecoder kdec(key); - if (kdec.IsValid()) { - uint qtschema = kdec.getLicenseSchema(); - if(qtschema & KeyDecoder::SupportedEvaluation) - strcpy(lcnsprod, "SupportedEvaluation"); - else if(qtschema & KeyDecoder::UnsupportedEvaluation) - strcpy(lcnsprod, "UnsupportedEvaluation"); - else if(qtschema & KeyDecoder::FullSourceEvaluation) - strcpy(lcnsprod, "FullSourceEvaluation"); - else if(qtschema & KeyDecoder::Academic) - strcpy(lcnsprod, "Academic"); - else if(qtschema & KeyDecoder::Educational) - strcpy(lcnsprod, "Educational"); - else if(qtschema & KeyDecoder::FullCommercial) - { - uint qtproduct = kdec.getProducts(); - if (qtproduct & KeyDecoder::QtUniversal) - strcpy(lcnsprod, "Universal"); - else if(qtproduct & KeyDecoder::QtDesktop) - strcpy(lcnsprod, "Desktop"); - else if(qtproduct & KeyDecoder::QtDesktopLight) - strcpy(lcnsprod, "DesktopLight"); - else if(qtproduct & KeyDecoder::QtConsole) - strcpy(lcnsprod, "Console"); - } - } - - LocalFree(key); - pushstring(lcnsprod); -} - -EXPORT_NSIS_FUNCTION(GetLicensePlatform) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(key); - - char lcnsplat[512]; - lcnsplat[0] = '\0'; - - KeyDecoder kdec(key); - if (kdec.getPlatforms() == KeyDecoder::AllOS) - strcpy(lcnsplat, "AllOS"); - else if (kdec.getPlatforms() & KeyDecoder::Embedded) - strcpy(lcnsplat, "Embedded"); - else if (kdec.getPlatforms() & KeyDecoder::WinCE) - strcpy(lcnsplat, "Embedded"); - else if (kdec.getPlatforms() & KeyDecoder::Windows) - strcpy(lcnsplat, "Windows"); - - LocalFree(key); - pushstring(lcnsplat); -} - -EXPORT_NSIS_FUNCTION(UsesUSLicense) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char isUSCustomer[2]; - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(key); - - KeyDecoder kdec(key); - if (kdec.IsValid() - && (kdec.getLicenseFeatures() & KeyDecoder::USCustomer)) - strcpy(isUSCustomer, "1"); - else - strcpy(isUSCustomer, "0"); - - LocalFree(key); - pushstring(isUSCustomer); -} - -EXPORT_NSIS_FUNCTION(IsValidDate) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - int year = 0; - int month = 0; - int day = 0; - char isValid[2]; - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *pkgDate = (char *)LocalAlloc(LPTR, g_stringsize+1); - - popstring(key); - popstring(pkgDate); - - if (strlen(pkgDate) > 0) - { - sscanf(pkgDate, "%d-%d-%d", &year, &month, &day); - } else { - //use current date - char curDate[9]; - _strdate(curDate); - sscanf(curDate, "%d/%d/%d", &month, &day, &year); - year += 2000; - } - - KeyDecoder kdec(key); - CDate expiryDate = kdec.getExpiryDate(); - if (year == expiryDate.year()) { - if (month == expiryDate.month()) { - if (day <= expiryDate.day()) { - strcpy(isValid, "1"); - } else { - strcpy(isValid, "0"); - } - } else if (month < expiryDate.month()) { - strcpy(isValid, "1"); - } else { - strcpy(isValid, "0"); - } - } else if (year < expiryDate.year()) { - strcpy(isValid, "1"); - } else { - strcpy(isValid, "0"); - } - - LocalFree(pkgDate); - LocalFree(key); - pushstring(isValid); -} - -EXPORT_NSIS_FUNCTION(IsFloatingLicense) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char *key = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(key); - char isFloatingLicense[2]; - - KeyDecoder kdec(key); - if (kdec.IsValid() && - kdec.getLicenseFeatures() & KeyDecoder::FloatingLicense) - strcpy(isFloatingLicense, "1"); - else - strcpy(isFloatingLicense, "0"); - - LocalFree(key); - pushstring(isFloatingLicense); -} - -EXPORT_NSIS_FUNCTION(GetLicenseInfo) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - LicenseFinder f; - pushstring(f.getLicenseKey()); - pushstring(f.getOldLicenseKey()); - pushstring(f.getLicensee()); - pushstring(f.getCustomerID()); - pushstring(f.getProducts()); - pushstring(f.getExpiryDate()); -} - -EXPORT_NSIS_FUNCTION(PatchVC6Binary) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char *fileName = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *oldStr = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *newStr = (char *)LocalAlloc(LPTR, g_stringsize+1); - - popstring(fileName); - popstring(oldStr); - popstring(newStr); - - // remove last separator... - int oldLen = (int)strlen(oldStr); - int newLen = (int)strlen(newStr); - if (oldStr[oldLen-1] == '\\') - oldStr[oldLen-1] = '\0'; - if (newStr[newLen-1] == '\\') - newStr[newLen-1] = '\0'; - - BinPatch binFile(fileName); - binFile.enableInsertReplace(true); - binFile.enableUseLength(true); - binFile.setEndTokens(".cpp;.h;.moc;.pdb"); - binFile.patch(oldStr, newStr); - - //patch also with path sep. the other way since - //vc60 in some cases uses different path separators :| - char *reverse = (char *)malloc(sizeof(char)*(oldLen+1)); - for (int i=0; i<oldLen; ++i) { - if (oldStr[i] == '\\') - reverse[i] = '/'; - else - reverse[i] = oldStr[i]; - } - reverse[oldLen] = '\0'; - binFile.patch(reverse, newStr); - - LocalFree(newStr); - LocalFree(oldStr); - LocalFree(fileName); -} - -EXPORT_NSIS_FUNCTION(PatchVC7Binary) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char *fileName = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *oldStr = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *newStr = (char *)LocalAlloc(LPTR, g_stringsize+1); - - popstring(fileName); - popstring(oldStr); - popstring(newStr); - - BinPatch binFile(fileName); - binFile.enableInsertReplace(true); - binFile.setEndTokens(".cpp;.h;.moc;.pdb"); - binFile.patch(oldStr, newStr); - - LocalFree(newStr); - LocalFree(oldStr); - LocalFree(fileName); -} - -EXPORT_NSIS_FUNCTION(PatchBinary) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char *fileName = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *oldStr = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *newStr = (char *)LocalAlloc(LPTR, g_stringsize+1); - - popstring(fileName); - popstring(oldStr); - popstring(newStr); - - BinPatch binFile(fileName); - binFile.patch(oldStr, newStr); - - LocalFree(newStr); - LocalFree(oldStr); - LocalFree(fileName); -} - -EXPORT_NSIS_FUNCTION(ShowLicenseFile) -{ - char licenseBuffer[60000]; - g_hwndParent = hwndParent; - EXDLL_INIT(); - - void *hCtrl = 0; - char *strCtrl = (char *)LocalAlloc(LPTR, g_stringsize+1); - char *strLicenseFile = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(strCtrl); - popstring(strLicenseFile); - - if (sscanf(strCtrl, "%d", &hCtrl) == 1) { - FILE *fIn = fopen(strLicenseFile, "rb"); - if (fIn) { - size_t r = fread(licenseBuffer, sizeof(char), 59999, fIn); - licenseBuffer[r] = '\0'; - fclose(fIn); - SendMessage((HWND)hCtrl, (UINT)WM_SETTEXT, 0, (LPARAM)licenseBuffer); - } - } - - LocalFree(strLicenseFile); - LocalFree(strCtrl); -} - -EXPORT_NSIS_FUNCTION(HasValidWin32Library) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char isValid[2]; - char *path = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(path); - - if (hasValidIncludeFiles(path)) - strcpy(isValid, "1"); - else - strcpy(isValid, "0"); - - LocalFree(path); - pushstring(isValid); -} - -EXPORT_NSIS_FUNCTION(GetMinGWVersion) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - - char *path = (char *)LocalAlloc(LPTR, g_stringsize+1); - popstring(path); - - int major = 0, minor = 0, patch = 0; - char versionstr[MINGW_BUFFER_SIZE]; - - getMinGWVersion(path, &major, &minor, &patch); - sprintf(versionstr, "%d.%d.%d", major, minor, patch); - - LocalFree(path); - pushstring(versionstr); -} - -EXPORT_NSIS_FUNCTION(ShInPath) -{ - g_hwndParent = hwndParent; - EXDLL_INIT(); - char res[2]; - - if (shInEnvironment()) - res[0] = '1'; - else - res[0] = '0'; - - res[1] = '\0'; - - pushstring(res); -} diff --git a/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.dll b/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.dll Binary files differdeleted file mode 100644 index a75d896..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.dll +++ /dev/null diff --git a/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.vcproj b/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.vcproj deleted file mode 100644 index 3600136..0000000 --- a/util/scripts/win-binary/nsis/qtnsisext/qtnsisext.vcproj +++ /dev/null @@ -1,164 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="qtnsisext" - ProjectGUID="{DC56C66A-5D15-46C8-91E6-AB36FC26F8DA}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="." - IntermediateDirectory="Debug" - ConfigurationType="2" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;QTNSISEXT_EXPORTS" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - OutputFile="$(OutDir)/qtnsisext.dll" - LinkIncremental="2" - GenerateDebugInformation="TRUE" - ProgramDatabaseFile="$(OutDir)/qtnsisext.pdb" - SubSystem="1" - ImportLibrary="$(OutDir)/qtnsisext.lib" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="." - IntermediateDirectory="Release" - ConfigurationType="2" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\..\..\..\qt\util\scripts\mac-binary\package\InstallerPane" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTNSISEXT_EXPORTS" - RuntimeLibrary="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3" - CallingConvention="0" - CompileAs="2"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - OutputFile="$(OutDir)/qtnsisext.dll" - LinkIncremental="1" - GenerateDebugInformation="FALSE" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - ImportLibrary="$(OutDir)/qtnsisext.lib" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - <File - RelativePath=".\binpatch.cpp"> - </File> - <File - RelativePath="..\..\..\..\..\..\qt\util\scripts\mac-binary\package\InstallerPane\keydec.cpp"> - </File> - <File - RelativePath=".\licensefinder.cpp"> - </File> - <File - RelativePath=".\mingw.cpp"> - </File> - <File - RelativePath=".\qtnsisext.cpp"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> - <File - RelativePath=".\binpatch.h"> - </File> - <File - RelativePath=".\exdll.h"> - </File> - <File - RelativePath="..\..\..\..\..\..\qt\util\scripts\mac-binary\package\InstallerPane\keydec.h"> - </File> - <File - RelativePath=".\licensefinder.h"> - </File> - <File - RelativePath=".\mingw.h"> - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 1268b5e..d4e6d9e 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -1,7 +1,24 @@ #!/bin/bash -repository="git://git.dev.troll.no/webkit-mirror" -tag="qtwebkit-merged-into-qt-4-4" +die() { + echo $* + exit 1 +} + +default_tag="origin/qtwebkit-4.5" + +if [ $# -eq 0 ]; then + tag="$default_tag" +elif [ $# -eq 1 ]; then + tag=$1 +else + die "usage: $0 [commit (defaults to $default_tag)]" +fi + +repository=`git config qtwebkit.url` +if [ -z "$repository" ]; then + die "error: cannot locate webkit git repository. please run git config --global qtwebkit.url /path-or-url/to/webkit/repo" +fi excluded_directories="LayoutTests JavaScriptGlue WebKitLibraries WebKitSite WebKitTools WebCore/platform/cf WebCore/platform/gtk WebCore/platform/chromium" excluded_directories="$excluded_directories PageLoadTests" @@ -138,20 +155,6 @@ files_to_remove="$files_to_remove WebCore/WebCoreSources.bkl" files_to_remove="$files_to_remove WebCore/webcore-base.bkl" files_to_remove="$files_to_remove WebCore/webcore-wx.bkl" -if [ $# -eq 1 ]; then - tag=$1 -fi - -if [ $# -eq 2 ]; then - repository=$1 - tag=$2 -fi - -die() { - echo $* - exit 1 -} - require_clean_work_tree() { # test if working tree is dirty git rev-parse --verify HEAD > /dev/null && @@ -251,7 +254,7 @@ echo "generating extra sources" mkdir tmp && cd tmp && mkdir -p ../generated && - qmake -o Makefile QT_CONFIG+=phonon GENERATED_SOURCES_DIR=`pwd`/../generated OUTPUT_DIR=`pwd` ../$proj.pro && + qmake -o Makefile CONFIG-=QTDIR_build QT_CONFIG+=phonon GENERATED_SOURCES_DIR=`pwd`/../generated OUTPUT_DIR=`pwd` ../$proj.pro && make generated_files && perl -pi -e "s,$absSrcDir/,,g" ../generated/*.cpp ../generated/*.h && git add ../generated && |