Make QKeySequence work on Mac.
authorMorten Sorvig <morten.sorvig@nokia.com>
Wed, 7 Sep 2011 11:58:39 +0000 (13:58 +0200)
committerLiang Qi <liang.qi@nokia.com>
Thu, 8 Sep 2011 14:32:00 +0000 (16:32 +0200)
Replace WS_MAC with OS_MAC.

Change-Id: I28a7f7cb65b61f00a3a12f3b257a553b511f85af
Reviewed-on: http://codereview.qt-project.org/4353
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Liang Qi <liang.qi@nokia.com>
src/gui/kernel/qguiapplication.cpp
src/gui/kernel/qkeysequence.cpp

index e9edeb9..212afdf 100644 (file)
@@ -1213,7 +1213,7 @@ QInputPanel *QGuiApplication::inputPanel() const
 uint QGuiApplicationPrivate::currentKeyPlatform()
 {
     uint platform = KB_Win;
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     platform = KB_Mac;
 #elif defined Q_WS_X11
     platform = KB_X11;
index 7ce0a42..58ac03e 100644 (file)
 #endif
 #include "qvariant.h"
 
-#ifdef Q_WS_MAC
-# include <private/qt_mac_p.h>
-
+#ifdef Q_OS_MAC
+#include <QtCore/private/qcore_mac_p.h>
+#include <Carbon/Carbon.h>
 #endif
 
 QT_BEGIN_NAMESPACE
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 static bool qt_sequence_no_mnemonics = true;
 struct MacSpecialKey {
     int key;
@@ -967,7 +967,7 @@ QKeySequence::QKeySequence(const QKeySequence& keysequence)
     d->ref.ref();
 }
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 static inline int maybeSwapShortcut(int shortcut)
 {
     if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
@@ -999,7 +999,7 @@ QList<QKeySequence> QKeySequence::keyBindings(StandardKey key)
         QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i];
         if (keyBinding.standardKey == key && (keyBinding.platform & platform)) {
             uint shortcut =
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
                     maybeSwapShortcut(QKeySequencePrivate::keyBindings[i].shortcut);
 #else
                     QKeySequencePrivate::keyBindings[i].shortcut;
@@ -1201,7 +1201,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
     if (nativeText) {
         gmodifs = globalModifs();
         if (gmodifs->isEmpty()) {
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
             const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
             if (dontSwap)
                 *gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode));
@@ -1241,7 +1241,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
     modifs += *gmodifs; // Test non-translated ones last
 
     QString sl = accel;
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     for (int i = 0; i < modifs.size(); ++i) {
         const QModifKeyName &mkf = modifs.at(i);
         if (sl.contains(mkf.name)) {
@@ -1277,7 +1277,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
 
     int fnum = 0;
     if (accel.length() == 1) {
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
         int qtKey = qtkeyForMacSymbol(accel[0]);
         if (qtKey != -1) {
             ret |= qtKey;
@@ -1335,7 +1335,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
 {
     bool nativeText = (format == QKeySequence::NativeText);
     QString s;
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_MAC)
     if (nativeText) {
         // On Mac OS X the order (by default) is Meta, Alt, Shift, Control.
         // If the AA_MacDontSwapCtrlAndMeta is enabled, then the order
@@ -1391,7 +1391,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
                            : QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1);
     } else if (key) {
         int i=0;
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_MAC)
         if (nativeText) {
             QChar ch = qt_macSymbolForQtKey(key);
             if (!ch.isNull())
@@ -1401,7 +1401,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
         } else
 #endif
         {
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
 NonSymbol:
 #endif
             while (keyname[i].name) {
@@ -1427,7 +1427,7 @@ NonSymbol:
         }
     }
 
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
     if (nativeText)
         s += p;
     else