OSDN Git Service

minor cleanups
authorIvailo Monev <xakepa10@laimg.moc>
Mon, 12 Feb 2018 00:13:44 +0000 (00:13 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Mon, 12 Feb 2018 00:13:44 +0000 (00:13 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/io/qfilesystemengine_unix.cpp
src/core/kernel/qvariant.cpp
src/core/kernel/qvariant_p.h
src/gui/kernel/qgesture.h
src/gui/kernel/qwidget.h

index bb4a263..e6e4edd 100644 (file)
 #include <stdio.h>
 #include <errno.h>
 
-#if defined(Q_OS_MAC)
-# include <qcore_mac_p.h>
-#endif
-
-#if defined(Q_OS_MAC)
-# include <CoreFoundation/CFBundle.h>
-#endif
-
 QT_BEGIN_NAMESPACE
 
-#if defined(Q_OS_MAC)
-static inline bool _q_isMacHidden(const char *nativePath)
-{
-    OSErr err;
-
-    FSRef fsRef;
-    err = FSPathMakeRefWithOptions(reinterpret_cast<const UInt8 *>(nativePath),
-            kFSPathMakeRefDoNotFollowLeafSymlink, &fsRef, 0);
-    if (err != noErr)
-        return false;
-
-    FSCatalogInfo catInfo;
-    err = FSGetCatalogInfo(&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL);
-    if (err != noErr)
-        return false;
-
-    FileInfo * const fileInfo = reinterpret_cast<FileInfo*>(&catInfo.finderInfo);
-    return (fileInfo->finderFlags & kIsInvisible);
-}
-
-static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &entry)
-{
-    if (!data.isDirectory())
-        return false;
-
-    QFileInfo info(entry.filePath());
-    QString suffix = info.suffix();
-
-    if (suffix.length() > 0) {
-        // First step: is the extension known ?
-        CFStringRef extensionRef = QCFString::toCFStringRef(suffix);
-        CFStringRef uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
-        if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
-            return true;
-
-        // Second step: check if an application knows the package type
-        CFStringRef path = QCFString::toCFStringRef(entry.filePath());
-        QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true);
-
-        UInt32 type, creator;
-        // Well created packages have the PkgInfo file
-        if (CFBundleGetPackageInfoInDirectory(url, &type, &creator))
-            return true;
-
-        // Find if an application other than Finder claims to know how to handle the package
-        QCFType<CFURLRef> application;
-        LSGetApplicationForURL(url,
-                               kLSRolesEditor|kLSRolesViewer|kLSRolesViewer,
-                               NULL,
-                               &application);
-
-        if (application) {
-            QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, application);
-            CFStringRef identifier = CFBundleGetIdentifier(bundle);
-            QString applicationId = QCFString::toQString(identifier);
-            if (applicationId != QLatin1String("com.apple.finder"))
-                return true;
-        }
-    }
-
-    // Third step: check if the directory has the package bit set
-    FSRef packageRef;
-    FSPathMakeRef((UInt8 *)entry.nativeFilePath().constData(), &packageRef, NULL);
-
-    FSCatalogInfo catalogInfo;
-    FSGetCatalogInfo(&packageRef,
-                     kFSCatInfoFinderInfo,
-                     &catalogInfo,
-                     NULL,
-                     NULL,
-                     NULL);
-
-    FolderInfo *folderInfo = reinterpret_cast<FolderInfo *>(catalogInfo.finderInfo);
-    return folderInfo->finderFlags & kHasBundle;
-}
-
-#else
-static inline bool _q_isMacHidden(const char *nativePath)
-{
-    Q_UNUSED(nativePath);
-    // no-op
-    return false;
-}
-#endif
-
 bool QFileSystemEngine::isCaseSensitive()
 {
     return true;
@@ -426,8 +333,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
     if (what & QFileSystemMetaData::HiddenAttribute
             && !data.isHidden()) {
         QString fileName = entry.fileName();
-        if ((fileName.size() > 0 && fileName.at(0) == QLatin1Char('.'))
-                || (entryExists && _q_isMacHidden(nativeFilePath)))
+        if (fileName.size() > 0 && fileName.at(0) == QLatin1Char('.'))
             data.entryFlags |= QFileSystemMetaData::HiddenAttribute;
         data.knownFlagsMask |= QFileSystemMetaData::HiddenAttribute;
     }
index b85687c..b16a24a 100644 (file)
@@ -1984,7 +1984,7 @@ void QVariant::clear()
 const char *QVariant::typeToName(Type typ)
 {
     if (typ == Invalid)
-        return 0;
+        return Q_NULLPTR;
     if (typ == UserType)
         return "UserType";
 
@@ -2134,7 +2134,7 @@ QDataStream& operator<<(QDataStream &s, const QVariant::Type p)
 
 template <typename T>
 inline T qVariantToHelper(const QVariant::Private &d, QVariant::Type t,
-                          const QVariant::Handler *handler, T * = 0)
+                          const QVariant::Handler *handler, T * = Q_NULLPTR)
 {
     if (d.type == t)
         return *v_cast<T>(&d);
index fbba27c..1db249f 100644 (file)
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
 #ifdef Q_CC_SUN // Sun CC picks the wrong overload, so introduce awful hack
 
 template <typename T>
-inline T *v_cast(const QVariant::Private *nd, T * = 0)
+inline T *v_cast(const QVariant::Private *nd, T * = Q_NULLPTR)
 {
     QVariant::Private *d = const_cast<QVariant::Private *>(nd);
     return ((sizeof(T) > sizeof(QVariant::Private::Data))
@@ -74,7 +74,7 @@ inline T *v_cast(const QVariant::Private *nd, T * = 0)
 #else // every other compiler in this world
 
 template <typename T>
-inline const T *v_cast(const QVariant::Private *d, T * = 0)
+inline const T *v_cast(const QVariant::Private *d, T * = Q_NULLPTR)
 {
     return ((sizeof(T) > sizeof(QVariant::Private::Data))
             ? static_cast<const T *>(d->data.shared->ptr)
@@ -82,7 +82,7 @@ inline const T *v_cast(const QVariant::Private *d, T * = 0)
 }
 
 template <typename T>
-inline T *v_cast(QVariant::Private *d, T * = 0)
+inline T *v_cast(QVariant::Private *d, T * = Q_NULLPTR)
 {
     return ((sizeof(T) > sizeof(QVariant::Private::Data))
             ? static_cast<T *>(d->data.shared->ptr)
@@ -105,7 +105,7 @@ private:
 
 // constructs a new variant if copy is 0, otherwise copy-constructs
 template <class T>
-inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
+inline void v_construct(QVariant::Private *x, const void *copy, T * = Q_NULLPTR)
 {
     if (sizeof(T) > sizeof(QVariant::Private::Data)) {
         x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy))
@@ -132,9 +132,8 @@ inline void v_construct(QVariant::Private *x, const T &t)
 
 // deletes the internal structures
 template <class T>
-inline void v_clear(QVariant::Private *d, T* = 0)
+inline void v_clear(QVariant::Private *d, T* = Q_NULLPTR)
 {
-    
     if (sizeof(T) > sizeof(QVariant::Private::Data)) {
         //now we need to cast
         //because QVariant::PrivateShared doesn't have a virtual destructor
index 0c3ee68..a8af85c 100644 (file)
@@ -128,7 +128,6 @@ public:
     void setAcceleration(qreal value);
 
     friend class QPanGestureRecognizer;
-    friend class QWinNativePanGestureRecognizer;
 };
 
 class QPinchGesturePrivate;
index 66f4992..751778c 100644 (file)
@@ -660,7 +660,6 @@ private:
     friend struct QWidgetExceptionCleaner;
 #ifndef QT_NO_GESTURES
     friend class QGestureManager;
-    friend class QWinNativePanGestureRecognizer;
 #endif // QT_NO_GESTURES
     friend class QWidgetEffectSourcePrivate;