Fix formatting

This commit is contained in:
Jonas Kvinge 2018-11-17 15:49:29 +01:00 committed by John Maguire
parent 8c198a99a5
commit 1d5783b846
9 changed files with 37 additions and 28 deletions

View File

@ -22,10 +22,10 @@ THE SOFTWARE.
#include <AppKit/NSImage.h> #include <AppKit/NSImage.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include <QMacCocoaViewContainer>
#include <QString> #include <QString>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QtMacExtras> #include <QtMacExtras>
#include <QMacCocoaViewContainer>
static inline NSString* fromQString(const QString &string) static inline NSString* fromQString(const QString &string)
{ {
@ -43,14 +43,13 @@ static inline QString toQString(NSString *string)
static inline NSImage* fromQPixmap(const QPixmap &pixmap) static inline NSImage* fromQPixmap(const QPixmap &pixmap)
{ {
CGImageRef cgImage = QtMac::toCGImageRef(pixmap); CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize]; return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
} }
static inline void setupLayout(NSView *cocoaView, QWidget *parent) static inline void setupLayout(NSView* cocoaView, QWidget* parent) {
{ parent->setAttribute(Qt::WA_NativeWindow);
parent->setAttribute(Qt::WA_NativeWindow); QVBoxLayout* layout = new QVBoxLayout(parent);
QVBoxLayout *layout = new QVBoxLayout(parent); layout->setMargin(0);
layout->setMargin(0); layout->addWidget(new QMacCocoaViewContainer(cocoaView, parent));
layout->addWidget(new QMacCocoaViewContainer(cocoaView, parent));
} }

View File

@ -111,8 +111,7 @@ bool QtLocalPeer::isClient()
if (lockFile.isLocked()) if (lockFile.isLocked())
return false; return false;
if (!lockFile.lock(QtLockedFile::WriteLock, false)) if (!lockFile.lock(QtLockedFile::WriteLock, false)) return true;
return true;
bool res = server->listen(socketName); bool res = server->listen(socketName);
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) #if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0))

View File

@ -69,7 +69,7 @@ protected:
QLocalServer* server; QLocalServer* server;
QtLockedFile lockFile; QtLockedFile lockFile;
private: private:
static const char* ack; static const char* ack;
}; };

View File

@ -59,10 +59,13 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
Qt::HANDLE mutex; Qt::HANDLE mutex;
if (doCreate) { if (doCreate) {
#if (QT_VERSION < 0x050000) #if (QT_VERSION < 0x050000)
QT_WA( { mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16()); }, QT_WA({ mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16()); },
{ mutex = CreateMutexA(nullptr, FALSE, mname.toLocal8Bit().constData()); } ); {
mutex =
CreateMutexA(nullptr, FALSE, mname.toLocal8Bit().constData());
});
#else #else
mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16()); mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16());
#endif #endif
if (!mutex) { if (!mutex) {
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed"); qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
@ -71,10 +74,18 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
} }
else { else {
#if (QT_VERSION < 0x050000) #if (QT_VERSION < 0x050000)
QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); }, QT_WA(
{ mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } ); {
mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE,
(WCHAR*)mname.utf16());
},
{
mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE,
mname.toLocal8Bit().constData());
});
#else #else
mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE,
(WCHAR*)mname.utf16());
#endif #endif
if (!mutex) { if (!mutex) {
if (GetLastError() != ERROR_FILE_NOT_FOUND) if (GetLastError() != ERROR_FILE_NOT_FOUND)

View File

@ -39,31 +39,31 @@ int QxtGlobalShortcutPrivate::ref = 0;
#if QT_VERSION < QT_VERSION_CHECK(5,0,0) #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QAbstractEventDispatcher::EventFilter QxtGlobalShortcutPrivate::prevEventFilter = 0; QAbstractEventDispatcher::EventFilter QxtGlobalShortcutPrivate::prevEventFilter = 0;
#endif #endif
#endif // Q_OS_MAC #endif // Q_OS_MAC
QHash<QPair<quint32, quint32>, QxtGlobalShortcut*> QxtGlobalShortcutPrivate::shortcuts; QHash<QPair<quint32, quint32>, QxtGlobalShortcut*> QxtGlobalShortcutPrivate::shortcuts;
QxtGlobalShortcutPrivate::QxtGlobalShortcutPrivate() : enabled(true), key(Qt::Key(0)), mods(Qt::NoModifier) QxtGlobalShortcutPrivate::QxtGlobalShortcutPrivate() : enabled(true), key(Qt::Key(0)), mods(Qt::NoModifier)
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
if (!ref++) if (!ref++)
#if QT_VERSION < QT_VERSION_CHECK(5,0,0) #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
prevEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(eventFilter); prevEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(eventFilter);
#else #else
QAbstractEventDispatcher::instance()->installNativeEventFilter(this); QAbstractEventDispatcher::instance()->installNativeEventFilter(this);
#endif #endif
#endif // Q_OS_MAC #endif // Q_OS_MAC
} }
QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate() QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate()
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
if (!--ref) if (!--ref)
#if QT_VERSION < QT_VERSION_CHECK(5,0,0) #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QAbstractEventDispatcher::instance()->setEventFilter(prevEventFilter); QAbstractEventDispatcher::instance()->setEventFilter(prevEventFilter);
#else #else
QAbstractEventDispatcher::instance()->removeNativeEventFilter(this); QAbstractEventDispatcher::instance()->removeNativeEventFilter(this);
#endif #endif
#endif // Q_OS_MAC #endif // Q_OS_MAC
} }
bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut) bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut)

View File

@ -67,7 +67,7 @@ public:
#else #else
virtual bool nativeEventFilter(const QByteArray & eventType, void * message, long * result); virtual bool nativeEventFilter(const QByteArray & eventType, void * message, long * result);
#endif // QT_VERSION < QT_VERSION_CHECK(5,0,0) #endif // QT_VERSION < QT_VERSION_CHECK(5,0,0)
#endif // Q_OS_MAC #endif // Q_OS_MAC
static void activateShortcut(quint32 nativeKey, quint32 nativeMods); static void activateShortcut(quint32 nativeKey, quint32 nativeMods);

View File

@ -18,10 +18,10 @@
*/ */
#include "config.h" #include "config.h"
#include "gnomeglobalshortcutbackend.h"
#include "globalshortcuts.h"
#include "core/closure.h" #include "core/closure.h"
#include "core/logging.h" #include "core/logging.h"
#include "globalshortcuts.h"
#include "gnomeglobalshortcutbackend.h"
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
#include <dbus/gnomesettingsdaemon.h> #include <dbus/gnomesettingsdaemon.h>

View File

@ -35,7 +35,7 @@
#include "core/utilities.h" #include "core/utilities.h"
#include "internet/core/internetmodel.h" #include "internet/core/internetmodel.h"
#ifdef HAVE_SPOTIFY #ifdef HAVE_SPOTIFY
# include "internet/spotify/spotifyservice.h" #include "internet/spotify/spotifyservice.h"
#endif #endif
AlbumCoverLoader::AlbumCoverLoader(QObject* parent) AlbumCoverLoader::AlbumCoverLoader(QObject* parent)

View File

@ -21,8 +21,8 @@
#ifndef COVERS_ALBUMCOVERLOADER_H_ #ifndef COVERS_ALBUMCOVERLOADER_H_
#define COVERS_ALBUMCOVERLOADER_H_ #define COVERS_ALBUMCOVERLOADER_H_
#include "config.h"
#include "albumcoverloaderoptions.h" #include "albumcoverloaderoptions.h"
#include "config.h"
#include "core/song.h" #include "core/song.h"
#include <QImage> #include <QImage>