summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs/qwizard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/dialogs/qwizard.cpp')
-rw-r--r--src/gui/dialogs/qwizard.cpp114
1 files changed, 35 insertions, 79 deletions
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index b2ed983..3fdea54 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -34,7 +34,7 @@
** 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.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -377,7 +377,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
/*
There is no widthForHeight() function, so we simulate it with a loop.
*/
- int candidateSubTitleWidth = qMin(512, 2 * qApp->desktop()->width() / 3);
+ int candidateSubTitleWidth = qMin(512, 2 * QApplication::desktop()->width() / 3);
int delta = candidateSubTitleWidth >> 1;
while (delta > 0) {
if (subTitleLabel->heightForWidth(candidateSubTitleWidth - delta)
@@ -560,6 +560,7 @@ public:
void enableUpdates();
void _q_emitCustomButtonClicked();
void _q_updateButtonStates();
+ void _q_handleFieldObjectDestroyed(QObject *);
void setStyle(QStyle *style);
#ifdef Q_WS_MAC
static QPixmap findDefaultBackgroundPixmap();
@@ -731,6 +732,8 @@ void QWizardPrivate::cleanupPagesNotInHistory()
void QWizardPrivate::addField(const QWizardField &field)
{
+ Q_Q(QWizard);
+
QWizardField myField = field;
myField.resolve(defaultPropertyTable);
@@ -744,15 +747,23 @@ void QWizardPrivate::addField(const QWizardField &field)
if (myField.mandatory && !myField.changedSignal.isEmpty())
QObject::connect(myField.object, myField.changedSignal,
myField.page, SLOT(_q_maybeEmitCompleteChanged()));
+ QObject::connect(
+ myField.object, SIGNAL(destroyed(QObject *)), q,
+ SLOT(_q_handleFieldObjectDestroyed(QObject *)));
}
void QWizardPrivate::removeFieldAt(int index)
{
+ Q_Q(QWizard);
+
const QWizardField &field = fields.at(index);
fieldIndexMap.remove(field.name);
if (field.mandatory && !field.changedSignal.isEmpty())
QObject::disconnect(field.object, field.changedSignal,
field.page, SLOT(_q_maybeEmitCompleteChanged()));
+ QObject::disconnect(
+ field.object, SIGNAL(destroyed(QObject *)), q,
+ SLOT(_q_handleFieldObjectDestroyed(QObject *)));
fields.remove(index);
}
@@ -1595,6 +1606,20 @@ void QWizardPrivate::_q_updateButtonStates()
enableUpdates();
}
+void QWizardPrivate::_q_handleFieldObjectDestroyed(QObject *object)
+{
+ QVector<QWizardField>::iterator it = fields.begin();
+ while (it != fields.end()) {
+ const QWizardField &field = *it;
+ if (field.object == object) {
+ fieldIndexMap.remove(field.name);
+ it = fields.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
void QWizardPrivate::setStyle(QStyle *style)
{
for (int i = 0; i < QWizard::NButtons; i++)
@@ -1607,66 +1632,6 @@ void QWizardPrivate::setStyle(QStyle *style)
#ifdef Q_WS_MAC
-#ifdef Q_WS_MAC32
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <QuickTime/QuickTime.h>
-QT_END_INCLUDE_NAMESPACE
-typedef OSErr (*PtrQTNewDataReferenceFromCFURL)(CFURLRef, UInt32, Handle*, OSType*);
-typedef OSErr (*PtrGetGraphicsImporterForDataRefWithFlags)(Handle, OSType, ComponentInstance*, long);
-typedef ComponentResult (*PtrGraphicsImportSetFlags)(GraphicsImportComponent, long);
-typedef ComponentResult (*PtrGraphicsImportCreateCGImage)(GraphicsImportComponent, CGImageRef*, UInt32);
-
-static PtrQTNewDataReferenceFromCFURL ptrQTNewDataReferenceFromCFURL = 0;
-static PtrGetGraphicsImporterForDataRefWithFlags ptrGetGraphicsImporterForDataRefWithFlags = 0;
-static PtrGraphicsImportSetFlags ptrGraphicsImportSetFlags = 0;
-static PtrGraphicsImportCreateCGImage ptrGraphicsImportCreateCGImage = 0;
-
-static bool resolveQuickTimeSymbols()
-{
- if (ptrQTNewDataReferenceFromCFURL == 0) {
- QLibrary library(QLatin1String("/System/Library/Frameworks/QuickTime.framework/QuickTime"));
- ptrQTNewDataReferenceFromCFURL = reinterpret_cast<PtrQTNewDataReferenceFromCFURL>(library.resolve("QTNewDataReferenceFromCFURL"));
- ptrGetGraphicsImporterForDataRefWithFlags = reinterpret_cast<PtrGetGraphicsImporterForDataRefWithFlags>(library.resolve("GetGraphicsImporterForDataRefWithFlags"));
- ptrGraphicsImportSetFlags = reinterpret_cast<PtrGraphicsImportSetFlags>(library.resolve("GraphicsImportSetFlags"));
- ptrGraphicsImportCreateCGImage = reinterpret_cast<PtrGraphicsImportCreateCGImage>(library.resolve("GraphicsImportCreateCGImage"));
- }
-
- return ptrQTNewDataReferenceFromCFURL != 0 && ptrGetGraphicsImporterForDataRefWithFlags != 0
- && ptrGraphicsImportSetFlags != 0 && ptrGraphicsImportCreateCGImage != 0;
-}
-
-
-static QPixmap quicktimeTiff(const CFURLRef url)
-{
- if (!resolveQuickTimeSymbols())
- return QPixmap();
-
- QCFType <CGImageRef> imageRef = 0;
- Handle dataRef;
- OSType dataRefType;
- GraphicsImportComponent gi;
- ComponentResult result;
- result = ptrQTNewDataReferenceFromCFURL(url, 0, &dataRef, &dataRefType);
- if (dataRef != 0) {
- OSStatus err = ptrGetGraphicsImporterForDataRefWithFlags(dataRef, dataRefType, &gi, 0);
- if (err == noErr && gi) {
- result = ptrGraphicsImportSetFlags(gi, (kGraphicsImporterDontDoGammaCorrection
- + kGraphicsImporterDontUseColorMatching));
- if (!result)
- result = ptrGraphicsImportCreateCGImage(gi, &imageRef, 0);
- if (result)
- qWarning("Qt: Problem reading TIFF image %ld(%s:%d)", result, __FILE__, __LINE__);
- DisposeHandle(dataRef);
- CloseComponent(gi);
- }
- }
-
- if (imageRef)
- return QPixmap::fromMacCGImageRef(imageRef);
- return QPixmap();
-}
-#endif // Q_WS_MAC32
-
QPixmap QWizardPrivate::findDefaultBackgroundPixmap()
{
QCFType<CFURLRef> url;
@@ -1678,22 +1643,13 @@ QPixmap QWizardPrivate::findDefaultBackgroundPixmap()
if (bundle) {
url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("tif"), 0);
if (url) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
- QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
- if (image) {
- int width = CGImageGetWidth(image);
- int height = CGImageGetHeight(image);
- if (width == ExpectedImageWidth && height == ExpectedImageHeight)
- return QPixmap::fromMacCGImageRef(image);
- }
- } else
-#endif
- {
-#ifdef Q_WS_MAC32
- return quicktimeTiff(url);
-#endif
+ QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
+ QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
+ if (image) {
+ int width = CGImageGetWidth(image);
+ int height = CGImageGetHeight(image);
+ if (width == ExpectedImageWidth && height == ExpectedImageHeight)
+ return QPixmap::fromMacCGImageRef(image);
}
}
}