Cocoa: clean up compiler warnings.
authorMorten Sorvig <morten.sorvig@nokia.com>
Wed, 19 Oct 2011 12:23:45 +0000 (14:23 +0200)
committerQt by Nokia <qt-info@nokia.com>
Sun, 23 Oct 2011 08:23:23 +0000 (10:23 +0200)
Change-Id: I2cb65bb455b79b218a317b21e5a3b0d9792e0e22
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/plugins/platforms/cocoa/qcocoaapplication.mm
src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
src/plugins/platforms/cocoa/qcocoaintegration.mm
src/plugins/platforms/cocoa/qcocoawindow.h
src/plugins/platforms/cocoa/qcocoawindow.mm
src/plugins/platforms/cocoa/qmenu_mac.mm

index 22c5624..388e56d 100644 (file)
@@ -112,6 +112,7 @@ QT_USE_NAMESPACE
 
 - (void)qt_sendPostedMessage:(NSEvent *)event
 {
+    Q_UNUSED(event);
 /*
     // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5!
     // That is why we need to split the address in two parts:
@@ -140,6 +141,7 @@ QT_USE_NAMESPACE
 
 - (BOOL)qt_filterEvent:(NSEvent *)event
 {
+    Q_UNUSED(event);
 /*
     if (qApp->macEventFilter(0, reinterpret_cast<EventRef>(event)))
         return true;
index 6a25083..debda91 100644 (file)
@@ -215,6 +215,8 @@ static void cleanupCocoaApplicationDelegate()
 
 - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
 {
+    Q_UNUSED(filenames);
+    Q_UNUSED(sender);
 /*
     for (NSString *fileName in filenames) {
         QString qtFileName = qt_mac_NSStringToQString(fileName);
@@ -249,6 +251,7 @@ static void cleanupCocoaApplicationDelegate()
 
 - (void)applicationDidBecomeActive:(NSNotification *)notification
 {
+    Q_UNUSED(notification);
 /*
     if (reflectionDelegate
         && [reflectionDelegate respondsToSelector:@selector(applicationDidBecomeActive:)])
@@ -272,6 +275,7 @@ static void cleanupCocoaApplicationDelegate()
 
 - (void)applicationDidResignActive:(NSNotification *)notification
 {
+    Q_UNUSED(notification);
 /*
     if (reflectionDelegate
         && [reflectionDelegate respondsToSelector:@selector(applicationDidResignActive:)])
@@ -328,6 +332,7 @@ static void cleanupCocoaApplicationDelegate()
 
 - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
 {
+    Q_UNUSED(event);
     Q_UNUSED(replyEvent);
 /*
     NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
@@ -348,6 +353,7 @@ static void cleanupCocoaApplicationDelegate()
 
 - (void)qtDispatcherToQAction:(id)sender
 {
+    Q_UNUSED(sender);
     //[[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
 }
 
index 9525b47..84ee475 100644 (file)
@@ -789,6 +789,9 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession()
 
 static void setChildrenWorksWhenModal(QWindow *window, bool worksWhenModal)
 {
+    Q_UNUSED(window)
+    Q_UNUSED(worksWhenModal)
+
     // For NSPanels (but not NSWindows, sadly), we can set the flag
     // worksWhenModal, so that they are active even when they are not modal. 
 /*
index e4d3bb0..0700629 100644 (file)
@@ -86,7 +86,7 @@ QCocoaIntegration::QCocoaIntegration()
 
     qApp->setAttribute(Qt::AA_DontUseNativeMenuBar, false);
 
-    QNSApplication *cocoaApplication = [QNSApplication sharedApplication];
+    NSApplication *cocoaApplication = [NSApplication sharedApplication];
 
     if (qgetenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM").isEmpty()) {
         // Applications launched from plain executables (without an app
index ce79d39..dde64a1 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-@interface QNSWindow : NSWindow {
-
-}
-
-@end
-
 class QCocoaWindow : public QPlatformWindow
 {
 public:
@@ -82,14 +76,14 @@ public:
 
 protected:
     void determineWindowClass();
-    QNSWindow *createWindow();
+    NSWindow *createWindow();
     NSRect globalGeometry(const QRect localWindowGeometry) const;
     QRect windowGeometry() const;
     QCocoaWindow *parentCocoaWindow() const;
 
 private:
     friend class QCocoaBackingStore;
-    QNSWindow *m_nsWindow;
+    NSWindow *m_nsWindow;
     QNSView *m_contentView;
     quint32 m_windowAttributes;
     quint32 m_windowClass;
index ffbce40..840d4d9 100644 (file)
 
 #include <QDebug>
 
-@implementation QNSWindow
-
-- (BOOL)canBecomeKeyWindow
-{
-    return YES;
-}
-
-- (BOOL)canBecomeMainWindow
-{
-    return YES;
-}
-
-@end
-
 QCocoaWindow::QCocoaWindow(QWindow *tlw)
     : QPlatformWindow(tlw)
     , m_windowAttributes(0)
@@ -285,7 +271,7 @@ void QCocoaWindow::determineWindowClass()
 /*
 
 */
-QNSWindow * QCocoaWindow::createWindow()
+NSWindow * QCocoaWindow::createWindow()
 {
     // Determine if we need to add in our "custom window" attribute. Cocoa is rather clever
     // in deciding if we need the maximize button or not (i.e., it's resizable, so you
@@ -306,7 +292,7 @@ QNSWindow * QCocoaWindow::createWindow()
 */
     NSRect frame = globalGeometry(window()->geometry());
     QCocoaAutoReleasePool pool;
-    QNSWindow *window;
+    NSWindow *window;
 
     switch (m_windowClass) {
     case kMovableModalWindowClass:
@@ -318,7 +304,7 @@ QNSWindow * QCocoaWindow::createWindow()
         NSPanel *panel;
 
         BOOL needFloating = NO;
-        BOOL worksWhenModal = (this->window()->windowType() == Qt::Popup);
+        //BOOL worksWhenModal = (this->window()->windowType() == Qt::Popup);
 
         // Add in the extra flags if necessary.
         switch (m_windowClass) {
@@ -345,7 +331,7 @@ QNSWindow * QCocoaWindow::createWindow()
         break;
     }
     default:
-        window  = [[QNSWindow alloc] initWithContentRect:frame
+        window  = [[NSWindow alloc] initWithContentRect:frame
                                             styleMask:(NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask)
                                             backing:NSBackingStoreBuffered
                                             defer:NO]; // Deferring window creation breaks OpenGL (the GL context is set up
index f62e4a9..dde6464 100644 (file)
@@ -105,14 +105,6 @@ bool qt_mac_watchingAboutToShow(QMenu *menu)
     return menu; /* && menu->receivers(SIGNAL(aboutToShow()));*/
 }
 
-static int qt_mac_CountMenuItems(OSMenuRef menu)
-{
-    if (menu) {
-        return [menu numberOfItems];
-    }
-    return 0;
-}
-
 void qt_mac_menu_collapseSeparators(NSMenu * theMenu, bool collapse)
 {
     QCocoaAutoReleasePool pool;
@@ -201,6 +193,7 @@ static void cancelAllMenuTracking()
 static bool actualMenuItemVisibility(const QCocoaMenuBar *mbp,
                                      const QCocoaMenuAction *action)
 {
+    Q_UNUSED(mbp);
     bool visible = action->action->isVisible();
     if (visible && action->action->text() == QString(QChar(0x14)))
         return false;