summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm12
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm4
-rw-r--r--src/gui/dialogs/qmessagebox.cpp3
-rw-r--r--src/gui/dialogs/qwizard.cpp108
-rw-r--r--src/gui/dialogs/qwizard.h1
5 files changed, 46 insertions, 82 deletions
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 9c7a09b..1936de5 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -54,11 +54,19 @@
typedef float CGFloat; // Should only not be defined on 32-bit platforms
#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
+@protocol NSWindowDelegate <NSObject>
+- (void)windowDidResize:(NSNotification *)notification;
+- (BOOL)windowShouldClose:(id)window;
+@end
+#endif
+
QT_USE_NAMESPACE
@class QCocoaColorPanelDelegate;
-@interface QCocoaColorPanelDelegate : NSObject {
+@interface QCocoaColorPanelDelegate : NSObject<NSWindowDelegate> {
NSColorPanel *mColorPanel;
NSView *mStolenContentView;
NSButton *mOkButton;
@@ -74,8 +82,6 @@ QT_USE_NAMESPACE
okButton:(NSButton *)okButton
cancelButton:(NSButton *)cancelButton
priv:(QColorDialogPrivate *)priv;
-- (BOOL)windowShouldClose:(id)window;
-- (void)windowDidResize:(NSNotification *)notification;
- (void)colorChanged:(NSNotification *)notification;
- (void)relayout;
- (void)onOkClicked;
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index e7d2f43..3dc3c00 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -78,7 +78,9 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
-@protocol NSWindowDelegate <NSObject> @end
+@protocol NSWindowDelegate <NSObject>
+- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize;
+@end
#endif
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index b3fb0fd..b7fa420 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -45,6 +45,7 @@
#include <QtGui/qdialogbuttonbox.h>
#include "private/qlabel_p.h"
+#include "private/qapplication_p.h"
#include <QtCore/qlist.h>
#include <QtCore/qdebug.h>
#include <QtGui/qstyle.h>
@@ -73,8 +74,6 @@ extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wince.cpp
QT_BEGIN_NAMESPACE
-extern QHash<QByteArray, QFont> *qt_app_fonts_hash();
-
enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5, Old_Retry = 6,
Old_Ignore = 7, Old_YesAll = 8, Old_NoAll = 9, Old_ButtonMask = 0xFF,
NewButtonMask = 0xFFFFFC00 };
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index 2c1c2e3..3fdea54 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -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);
}
}
}
diff --git a/src/gui/dialogs/qwizard.h b/src/gui/dialogs/qwizard.h
index 1d1a9b5..d1f9cf7 100644
--- a/src/gui/dialogs/qwizard.h
+++ b/src/gui/dialogs/qwizard.h
@@ -197,6 +197,7 @@ private:
Q_DECLARE_PRIVATE(QWizard)
Q_PRIVATE_SLOT(d_func(), void _q_emitCustomButtonClicked())
Q_PRIVATE_SLOT(d_func(), void _q_updateButtonStates())
+ Q_PRIVATE_SLOT(d_func(), void _q_handleFieldObjectDestroyed(QObject *))
friend class QWizardPage;
};