diff --git a/3rdparty/libmygpo-qt5/src/CMakeLists.txt b/3rdparty/libmygpo-qt5/src/CMakeLists.txt index 47f4ea2c5..c15771c3e 100644 --- a/3rdparty/libmygpo-qt5/src/CMakeLists.txt +++ b/3rdparty/libmygpo-qt5/src/CMakeLists.txt @@ -3,9 +3,8 @@ set( MYGPO_QT_VERSION_MAJOR "1" ) set( MYGPO_QT_VERSION_MINOR "0" ) set( MYGPO_QT_VERSION_PATCH "9" ) configure_file( Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/Version.h ) -include_directories("${QJSON_INCLUDEDIR}/qjson") -include_directories( ${QJSON_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) +include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) set ( LIBMYGPO_QT_SRC Config.cpp @@ -86,4 +85,4 @@ QT_WRAP_CPP(LIBMYGPO_QT_MOC_SRC ${LIBMYGPO_QT_MOC_H} ) add_library( ${MYGPO_QT_TARGET_NAME} STATIC ${LIBMYGPO_QT_SRC} ${LIBMYGPO_QT_MOC_SRC} ) target_link_libraries( ${MYGPO_QT_TARGET_NAME} ${QJSON_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ) -qt5_use_modules( ${MYGPO_QT_TARGET_NAME} Core Network ) +target_link_libraries( ${MYGPO_QT_TARGET_NAME} Qt5::Core Qt5::Network ) diff --git a/3rdparty/qocoa/qbutton_mac.mm b/3rdparty/qocoa/qbutton_mac.mm index 93f7c7c8b..b7e1bc0c5 100644 --- a/3rdparty/qocoa/qbutton_mac.mm +++ b/3rdparty/qocoa/qbutton_mac.mm @@ -37,7 +37,9 @@ public: switch(bezelStyle) { case QButton::Disclosure: case QButton::Circular: +#ifdef __MAC_10_7 case QButton::Inline: +#endif case QButton::RoundedDisclosure: case QButton::HelpButton: [nsButton setTitle:@""]; @@ -55,7 +57,7 @@ public: font = [NSFont fontWithName:@"Lucida Grande Bold" size:12]; break; -#ifdef MAC_OS_X_VERSION_10_7 +#ifdef __MAC_10_7 case QButton::Inline: font = [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; break; @@ -112,7 +114,7 @@ public: qButton->setFixedHeight(22); qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); break; -#ifdef MAC_OS_X_VERSION_10_7 +#ifdef __MAC_10_7 case QButton::Inline: qButton->setMinimumWidth(10); qButton->setFixedHeight(16); @@ -130,7 +132,7 @@ public: [nsButton setButtonType:NSMomentaryPushInButton]; } - [nsButton setBezelStyle:bezelStyle]; + [nsButton setBezelStyle:(__bridge NSBezelStyle)bezelStyle]; } void clicked() diff --git a/3rdparty/qocoa/qocoa_mac.h b/3rdparty/qocoa/qocoa_mac.h index ced431173..f93a56b9d 100644 --- a/3rdparty/qocoa/qocoa_mac.h +++ b/3rdparty/qocoa/qocoa_mac.h @@ -20,9 +20,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include #include #include #include +#include #include static inline NSString* fromQString(const QString &string) @@ -41,11 +43,11 @@ static inline QString toQString(NSString *string) static inline NSImage* fromQPixmap(const QPixmap &pixmap) { - CGImageRef cgImage = pixmap.toMacCGImageRef(); + CGImageRef cgImage = QtMac::toCGImageRef(pixmap); return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize]; } -static inline void setupLayout(void *cocoaView, QWidget *parent) +static inline void setupLayout(NSView *cocoaView, QWidget *parent) { parent->setAttribute(Qt::WA_NativeWindow); QVBoxLayout *layout = new QVBoxLayout(parent); diff --git a/3rdparty/qtiocompressor/qtiocompressor.h b/3rdparty/qtiocompressor/qtiocompressor.h index 61284a5dc..eea9b6dfa 100644 --- a/3rdparty/qtiocompressor/qtiocompressor.h +++ b/3rdparty/qtiocompressor/qtiocompressor.h @@ -49,7 +49,7 @@ #include -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # if !defined(QT_QTIOCOMPRESSOR_EXPORT) && !defined(QT_QTIOCOMPRESSOR_IMPORT) # define QT_QTIOCOMPRESSOR_EXPORT # elif defined(QT_QTIOCOMPRESSOR_IMPORT) diff --git a/3rdparty/qtsingleapplication/qtlocalpeer.cpp b/3rdparty/qtsingleapplication/qtlocalpeer.cpp index 837752b63..4b2fac915 100644 --- a/3rdparty/qtsingleapplication/qtlocalpeer.cpp +++ b/3rdparty/qtsingleapplication/qtlocalpeer.cpp @@ -54,14 +54,12 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0; #include #endif -namespace QtLP_Private { #include "qtlockedfile.cpp" #if defined(Q_OS_WIN) #include "qtlockedfile_win.cpp" #else #include "qtlockedfile_unix.cpp" #endif -} const char* QtLocalPeer::ack = "ack"; @@ -113,7 +111,7 @@ bool QtLocalPeer::isClient() if (lockFile.isLocked()) return false; - if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false)) + if (!lockFile.lock(QtLockedFile::WriteLock, false)) return true; bool res = server->listen(socketName); @@ -149,7 +147,7 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout) Sleep(DWORD(ms)); #else struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; - nanosleep(&ts, NULL); + nanosleep(&ts, nullptr); #endif } if (!connOk) diff --git a/3rdparty/qtsingleapplication/qtlocalpeer.h b/3rdparty/qtsingleapplication/qtlocalpeer.h index 7b3fa8159..bd25f137a 100644 --- a/3rdparty/qtsingleapplication/qtlocalpeer.h +++ b/3rdparty/qtsingleapplication/qtlocalpeer.h @@ -67,7 +67,7 @@ protected: QString id; QString socketName; QLocalServer* server; - QtLP_Private::QtLockedFile lockFile; + QtLockedFile lockFile; private: static const char* ack; diff --git a/3rdparty/qtsingleapplication/qtlockedfile.h b/3rdparty/qtsingleapplication/qtlockedfile.h index 2af3e3ea2..37e013ec1 100644 --- a/3rdparty/qtsingleapplication/qtlockedfile.h +++ b/3rdparty/qtsingleapplication/qtlockedfile.h @@ -45,7 +45,7 @@ #include #endif -#if defined(Q_WS_WIN) || defined(Q_OS_WIN) +#if defined(Q_OS_WIN) # if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT) # define QT_QTLOCKEDFILE_EXPORT # elif defined(QT_QTLOCKEDFILE_IMPORT) @@ -61,8 +61,6 @@ # define QT_QTLOCKEDFILE_EXPORT #endif -namespace QtLP_Private { - class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile { public: @@ -92,5 +90,5 @@ private: #endif LockMode m_lock_mode; }; -} + #endif diff --git a/3rdparty/qtsingleapplication/qtlockedfile_win.cpp b/3rdparty/qtsingleapplication/qtlockedfile_win.cpp index ed2995f3f..737a23f86 100644 --- a/3rdparty/qtsingleapplication/qtlockedfile_win.cpp +++ b/3rdparty/qtsingleapplication/qtlockedfile_win.cpp @@ -59,10 +59,10 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) Qt::HANDLE mutex; if (doCreate) { #if (QT_VERSION < 0x050000) - QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); }, - { mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } ); + QT_WA( { mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16()); }, + { mutex = CreateMutexA(nullptr, FALSE, mname.toLocal8Bit().constData()); } ); #else - mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); + mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16()); #endif if (!mutex) { qErrnoWarning("QtLockedFile::lock(): CreateMutex failed"); @@ -71,10 +71,10 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) } else { #if (QT_VERSION < 0x050000) - QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); }, + QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); }, { mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } ); #else - mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); + mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); #endif if (!mutex) { if (GetLastError() != ERROR_FILE_NOT_FOUND) diff --git a/3rdparty/qtsingleapplication/qtsingleapplication.cpp b/3rdparty/qtsingleapplication/qtsingleapplication.cpp index 48c2e45f2..a28074a93 100644 --- a/3rdparty/qtsingleapplication/qtsingleapplication.cpp +++ b/3rdparty/qtsingleapplication/qtsingleapplication.cpp @@ -169,47 +169,6 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char * } -#if defined(Q_WS_X11) -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be QCoreApplication::applicationFilePath(). \a dpy, \a visual, - and \a cmap are passed on to the QApplication constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, visual, cmap) -{ - sysInit(); -} - -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be QCoreApplication::applicationFilePath(). \a dpy, \a argc, \a - argv, \a visual, and \a cmap are passed on to the QApplication - constructor. -*/ -QtSingleApplication::QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, argc, argv, visual, cmap) -{ - sysInit(); -} - -/*! - Special constructor for X11, ref. the documentation of - QApplication's corresponding constructor. The application identifier - will be \a appId. \a dpy, \a argc, \a - argv, \a visual, and \a cmap are passed on to the QApplication - constructor. -*/ -QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) - : QApplication(dpy, argc, argv, visual, cmap) -{ - sysInit(appId); -} -#endif - - /*! Returns true if another instance of this application is running; otherwise false. diff --git a/3rdparty/qtsingleapplication/qtsingleapplication.h b/3rdparty/qtsingleapplication/qtsingleapplication.h index 42e977281..5d2ae46f3 100644 --- a/3rdparty/qtsingleapplication/qtsingleapplication.h +++ b/3rdparty/qtsingleapplication/qtsingleapplication.h @@ -44,7 +44,7 @@ class QtLocalPeer; -#if defined(Q_WS_WIN) || defined(Q_OS_WIN32) +#if defined(Q_OS_WIN) || defined(Q_OS_WIN32) # if !defined(QT_QTSINGLEAPPLICATION_EXPORT) && !defined(QT_QTSINGLEAPPLICATION_IMPORT) # define QT_QTSINGLEAPPLICATION_EXPORT # elif defined(QT_QTSINGLEAPPLICATION_IMPORT) @@ -67,11 +67,6 @@ class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication public: QtSingleApplication(int &argc, char **argv, bool GUIenabled = true); QtSingleApplication(const QString &id, int &argc, char **argv); -#if defined(Q_WS_X11) - QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); - QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); - QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); -#endif bool isRunning(); QString id() const; diff --git a/3rdparty/qtwin/CMakeLists.txt b/3rdparty/qtwin/CMakeLists.txt deleted file mode 100644 index 9122be354..000000000 --- a/3rdparty/qtwin/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) - -set(QTWIN-SOURCES - qtwin.cpp -) - -ADD_LIBRARY(qtwin STATIC - ${QTWIN-SOURCES} -) - -target_link_libraries(qtwin - Qt5::Widgets -) diff --git a/3rdparty/qtwin/qtwin.cpp b/3rdparty/qtwin/qtwin.cpp deleted file mode 100644 index 69a24a9d5..000000000 --- a/3rdparty/qtwin/qtwin.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#include "qtwin.h" -#include -#include -#include -#include -#include - -#ifdef Q_WS_WIN - -#include - -// Blur behind data structures -#define DWM_BB_ENABLE 0x00000001 // fEnable has been specified -#define DWM_BB_BLURREGION 0x00000002 // hRgnBlur has been specified -#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004 // fTransitionOnMaximized has been specified -#define WM_DWMCOMPOSITIONCHANGED 0x031E // Composition changed window message - -typedef struct _DWM_BLURBEHIND -{ - DWORD dwFlags; - BOOL fEnable; - HRGN hRgnBlur; - BOOL fTransitionOnMaximized; -} DWM_BLURBEHIND, *PDWM_BLURBEHIND; - -typedef struct _MARGINS -{ - int cxLeftWidth; - int cxRightWidth; - int cyTopHeight; - int cyBottomHeight; -} MARGINS, *PMARGINS; - -typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled); -typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset); -typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind); -typedef HRESULT (WINAPI *PtrDwmGetColorizationColor)(DWORD *pcrColorization, BOOL *pfOpaqueBlend); - -static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled= 0; -static PtrDwmEnableBlurBehindWindow pDwmEnableBlurBehindWindow = 0; -static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = 0; -static PtrDwmGetColorizationColor pDwmGetColorizationColor = 0; - - -/* - * Internal helper class that notifies windows if the - * DWM compositing state changes and updates the widget - * flags correspondingly. - */ -class WindowNotifier : public QWidget -{ -public: - WindowNotifier() { winId(); } - void addWidget(QWidget *widget) { widgets.append(widget); } - void removeWidget(QWidget *widget) { widgets.removeAll(widget); } - bool winEvent(MSG *message, long *result); - -private: - QWidgetList widgets; -}; - -static bool resolveLibs() -{ - if (!pDwmIsCompositionEnabled) { - QLibrary dwmLib(QString::fromAscii("dwmapi")); - pDwmIsCompositionEnabled =(PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled"); - pDwmExtendFrameIntoClientArea = (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea"); - pDwmEnableBlurBehindWindow = (PtrDwmEnableBlurBehindWindow)dwmLib.resolve("DwmEnableBlurBehindWindow"); - pDwmGetColorizationColor = (PtrDwmGetColorizationColor)dwmLib.resolve("DwmGetColorizationColor"); - } - return pDwmIsCompositionEnabled != 0; -} - -#endif - -/*! - * Chekcs and returns true if Windows DWM composition - * is currently enabled on the system. - * - * To get live notification on the availability of - * this feature, you will currently have to - * reimplement winEvent() on your widget and listen - * for the WM_DWMCOMPOSITIONCHANGED event to occur. - * - */ -bool QtWin::isCompositionEnabled() -{ -#ifdef Q_WS_WIN - if (resolveLibs()) { - HRESULT hr = S_OK; - BOOL isEnabled = false; - hr = pDwmIsCompositionEnabled(&isEnabled); - if (SUCCEEDED(hr)) - return isEnabled; - } -#endif - return false; -} - -/*! - * Enables Blur behind on a Widget. - * - * \a enable tells if the blur should be enabled or not - */ -bool QtWin::enableBlurBehindWindow(QWidget *widget, bool enable, - const QRegion ®ion) -{ - Q_ASSERT(widget); - bool result = false; -#ifdef Q_WS_WIN - if (resolveLibs()) { - DWM_BLURBEHIND bb = {0}; - HRESULT hr = S_OK; - bb.fEnable = enable; - bb.dwFlags = DWM_BB_ENABLE; - bb.hRgnBlur = NULL; - - if (!region.isEmpty()) { - bb.dwFlags |= DWM_BB_BLURREGION; - bb.hRgnBlur = region.handle(); - } - - widget->setAttribute(Qt::WA_TranslucentBackground, enable); - widget->setAttribute(Qt::WA_NoSystemBackground, enable); - hr = pDwmEnableBlurBehindWindow(widget->winId(), &bb); - if (SUCCEEDED(hr)) { - result = true; - windowNotifier()->addWidget(widget); - } - } -#endif - return result; -} - -/*! - * ExtendFrameIntoClientArea. - * - * This controls the rendering of the frame inside the window. - * Note that passing margins of -1 (the default value) will completely - * remove the frame from the window. - * - * \note you should not call enableBlurBehindWindow before calling - * this functions - * - * \a enable tells if the blur should be enabled or not - */ -bool QtWin::extendFrameIntoClientArea(QWidget *widget, int left, int top, int right, int bottom) -{ - - Q_ASSERT(widget); - Q_UNUSED(left); - Q_UNUSED(top); - Q_UNUSED(right); - Q_UNUSED(bottom); - - bool result = false; -#ifdef Q_WS_WIN - if (resolveLibs()) { - QLibrary dwmLib(QString::fromAscii("dwmapi")); - HRESULT hr = S_OK; - MARGINS m = {left, top, right, bottom}; - hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m); - if (SUCCEEDED(hr)) { - result = true; - windowNotifier()->addWidget(widget); - } - widget->setAttribute(Qt::WA_TranslucentBackground, result); - } -#endif - return result; -} - -/*! - * Returns the current colorizationColor for the window. - * - * \a enable tells if the blur should be enabled or not - */ -QColor QtWin::colorizatinColor() -{ - QColor resultColor = QApplication::palette().window().color(); - -#ifdef Q_WS_WIN - if (resolveLibs()) { - DWORD color = 0; - BOOL opaque = FALSE; - QLibrary dwmLib(QString::fromAscii("dwmapi")); - HRESULT hr = S_OK; - hr = pDwmGetColorizationColor(&color, &opaque); - if (SUCCEEDED(hr)) - resultColor = QColor(color); - } -#endif - return resultColor; -} - -#ifdef Q_WS_WIN -WindowNotifier *QtWin::windowNotifier() -{ - static WindowNotifier *windowNotifierInstance = 0; - if (!windowNotifierInstance) - windowNotifierInstance = new WindowNotifier; - return windowNotifierInstance; -} - - -/* Notify all enabled windows that the DWM state changed */ -bool WindowNotifier::winEvent(MSG *message, long *result) -{ - if (message && message->message == WM_DWMCOMPOSITIONCHANGED) { - bool compositionEnabled = QtWin::isCompositionEnabled(); - foreach(QWidget * widget, widgets) { - if (widget) { - widget->setAttribute(Qt::WA_NoSystemBackground, compositionEnabled); - } - widget->update(); - } - } - return QWidget::winEvent(message, result); -} -#endif diff --git a/3rdparty/qtwin/qtwin.h b/3rdparty/qtwin/qtwin.h deleted file mode 100644 index a40185853..000000000 --- a/3rdparty/qtwin/qtwin.h +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#ifndef QTWIN_H -#define QTWIN_H - -#include -#include -/** - * This is a helper class for using the Desktop Window Manager - * functionality on Windows 7 and Windows Vista. On other platforms - * these functions will simply not do anything. - */ - -class WindowNotifier; - -class QtWin -{ -public: - static bool enableBlurBehindWindow(QWidget *widget, bool enable = true, - const QRegion& region = QRegion()); - static bool extendFrameIntoClientArea(QWidget *widget, - int left = -1, int top = -1, - int right = -1, int bottom = -1); - static bool isCompositionEnabled(); - static QColor colorizatinColor(); - -private: - static WindowNotifier *windowNotifier(); -}; - -#endif // QTWIN_H diff --git a/3rdparty/qxt/qxtglobalshortcut.cpp b/3rdparty/qxt/qxtglobalshortcut.cpp index 6ea380ca7..db483060e 100644 --- a/3rdparty/qxt/qxtglobalshortcut.cpp +++ b/3rdparty/qxt/qxtglobalshortcut.cpp @@ -34,36 +34,36 @@ #include bool QxtGlobalShortcutPrivate::error = false; -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC int QxtGlobalShortcutPrivate::ref = 0; #if QT_VERSION < QT_VERSION_CHECK(5,0,0) QAbstractEventDispatcher::EventFilter QxtGlobalShortcutPrivate::prevEventFilter = 0; #endif -#endif // Q_WS_MAC +#endif // Q_OS_MAC QHash, QxtGlobalShortcut*> QxtGlobalShortcutPrivate::shortcuts; QxtGlobalShortcutPrivate::QxtGlobalShortcutPrivate() : enabled(true), key(Qt::Key(0)), mods(Qt::NoModifier) { -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC if (!ref++) #if QT_VERSION < QT_VERSION_CHECK(5,0,0) prevEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(eventFilter); #else QAbstractEventDispatcher::instance()->installNativeEventFilter(this); #endif -#endif // Q_WS_MAC +#endif // Q_OS_MAC } QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate() { -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC if (!--ref) #if QT_VERSION < QT_VERSION_CHECK(5,0,0) QAbstractEventDispatcher::instance()->setEventFilter(prevEventFilter); #else QAbstractEventDispatcher::instance()->removeNativeEventFilter(this); #endif -#endif // Q_WS_MAC +#endif // Q_OS_MAC } bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut) diff --git a/3rdparty/qxt/qxtglobalshortcut_p.h b/3rdparty/qxt/qxtglobalshortcut_p.h index 1a788852e..14088c457 100644 --- a/3rdparty/qxt/qxtglobalshortcut_p.h +++ b/3rdparty/qxt/qxtglobalshortcut_p.h @@ -59,7 +59,7 @@ public: bool unsetShortcut(); static bool error; -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC static int ref; #if QT_VERSION < QT_VERSION_CHECK(5,0,0) static QAbstractEventDispatcher::EventFilter prevEventFilter; @@ -67,7 +67,7 @@ public: #else virtual bool nativeEventFilter(const QByteArray & eventType, void * message, long * result); #endif // QT_VERSION < QT_VERSION_CHECK(5,0,0) -#endif // Q_WS_MAC +#endif // Q_OS_MAC static void activateShortcut(quint32 nativeKey, quint32 nativeMods); diff --git a/3rdparty/tinysvcmdns/CMakeLists.txt b/3rdparty/tinysvcmdns/CMakeLists.txt index 1c16a138a..50dd1f573 100644 --- a/3rdparty/tinysvcmdns/CMakeLists.txt +++ b/3rdparty/tinysvcmdns/CMakeLists.txt @@ -7,7 +7,7 @@ set(TINYSVCMDNS-SOURCES ) find_library(PTHREAD - pthreadGC2 + pthread ) add_library(tinysvcmdns STATIC diff --git a/CMakeLists.txt b/CMakeLists.txt index c1de26e3e..acd25175a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,20 +28,12 @@ if (CCACHE_EXECUTABLE) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE}) endif () -if (UNIX AND NOT APPLE) - set(LINUX 1) -endif (UNIX AND NOT APPLE) - -set(QT_MIN_VERSION 5.6.0) - -find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core OpenGL Sql Network Xml Widgets Concurrent Test) -find_package(X11) -if(X11_FOUND) - find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(LINUX ON) +endif() +if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(FREEBSD ON) endif() - -find_package(Qt5LinguistTools CONFIG REQUIRED) -set(QT_LCONVERT_EXECUTABLE Qt5::lconvert) if(APPLE) if(NOT QT_MAC_USE_COCOA) @@ -56,10 +48,22 @@ find_package(Gettext REQUIRED) find_package(PkgConfig REQUIRED) find_package(Protobuf REQUIRED) find_package(FFTW3) -find_package(ALSA) +if(LINUX) + find_package(ALSA REQUIRED) + pkg_check_modules(DBUS REQUIRED dbus-1) +else(LINUX) + find_package(ALSA) + pkg_check_modules(DBUS dbus-1) +endif(LINUX) if(ALSA_FOUND) set(HAVE_ALSA ON) endif() +if (NOT APPLE) + find_package(X11) +endif() +if(X11_FOUND) + set(HAVE_X11 ON) +endif() find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf) @@ -80,7 +84,7 @@ pkg_check_modules(LIBMTP libmtp>=1.0) pkg_check_modules(LIBMYGPO_QT5 libmygpo-qt5>=1.0.9) pkg_check_modules(LIBPULSE libpulse) pkg_check_modules(LIBXML libxml-2.0) -pkg_check_modules(SPOTIFY libspotify>=12.1.45) +pkg_check_modules(LIBSPOTIFY libspotify>=12.1.45) pkg_check_modules(TAGLIB taglib) if (WIN32) @@ -94,6 +98,44 @@ find_path(LASTFM51_INCLUDE_DIRS lastfm5/Track.h) find_path(SPARSEHASH_INCLUDE_DIRS google/sparsetable) +# QT +set(QT_MIN_VERSION 5.6.0) +find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Concurrent Widgets Network Sql Xml OpenGL Test) +if(X11_FOUND) + find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) +endif() +if(DBUS_FOUND) + find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus) + get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION) +endif() +if(APPLE) + find_package(Qt5 REQUIRED COMPONENTS MacExtras) +endif() +if(WIN32) + find_package(Qt5 REQUIRED COMPONENTS WinExtras) +endif() + +set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::Xml Qt5::OpenGL Qt5::Test) + +if(DBUS_FOUND) + set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::DBus) +endif() +if(X11_FOUND) + set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::X11Extras) +endif() +if(APPLE) + set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::MacExtras) +endif() +if(WIN32) + set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::WinExtras) +endif() + +find_package(Qt5LinguistTools CONFIG) +if (Qt5LinguistTools_FOUND) + set(QT_LCONVERT_EXECUTABLE Qt5::lconvert) +endif() + + # Only use system taglib if it's greater than 1.11.1 # There is a bug in version 1.11.1 corrupting Ogg files, see: https://github.com/taglib/taglib/issues/864 # If you decide to use the systems taglib, make sure it has been patched with the following commit: @@ -136,13 +178,11 @@ endif() if (APPLE) find_library(SPARKLE Sparkle) - - find_library(SPOTIFY libspotify) - if (SPOTIFY) - set (SPOTIFY_FOUND ON) - set (SPOTIFY_INCLUDE_DIRS ${SPOTIFY}) - set (SPOTIFY_LIBRARIES ${SPOTIFY}) - endif (SPOTIFY) + find_library(LIBSPOTIFY libspotify) + if(LIBSPOTIFY_FOUND) + set(LIBSPOTIFY_INCLUDE_DIRS ${LIBSPOTIFY}) + set(LIBSPOTIFY_LIBRARIES ${LIBSPOTIFY}) + endif(LIBSPOTIFY_FOUND) add_subdirectory(3rdparty/SPMediaKeyTap) set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap) @@ -251,22 +291,31 @@ optional_component(LIBLASTFM ON "Last.fm support" ) optional_component(DBUS ON "D-Bus support" - DEPENDS "Linux" LINUX + DEPENDS "D-Bus" DBUS_FOUND ) optional_component(WIIMOTEDEV ON "Wiimote support" - DEPENDS "D-Bus support" HAVE_DBUS + DEPENDS "D-Bus support" DBUS_FOUND ) optional_component(DEVICEKIT ON "Devices: DeviceKit backend" - DEPENDS "D-Bus support" HAVE_DBUS + DEPENDS "D-Bus support" DBUS_FOUND ) optional_component(UDISKS2 ON "Devices: UDisks2 backend" - DEPENDS "D-Bus support" HAVE_DBUS + DEPENDS "D-Bus support" DBUS_FOUND +) + +if (CRYPTOPP_FOUND OR HAVE_SPOTIFY_BLOB) + set(CRYPTOPP_OR_HAVE_SPOTIFY_BLOB ON) +endif() + +optional_component(SPOTIFY ON "Spotify support" + DEPENDS "cryptopp or spotify blob" CRYPTOPP_OR_HAVE_SPOTIFY_BLOB ) optional_component(SPOTIFY_BLOB ON "Spotify support: non-GPL binary helper" + DEPENDS "spotify support" HAVE_SPOTIFY DEPENDS "protobuf" PROTOBUF_FOUND PROTOBUF_PROTOC_EXECUTABLE DEPENDS "libspotify" SPOTIFY_FOUND ) @@ -286,26 +335,22 @@ optional_component(LIBPULSE ON "Pulse audio integration" optional_component(VISUALISATIONS ON "Visualisations") -if(NOT HAVE_SPOTIFY_BLOB AND NOT CRYPTOPP_FOUND) - message(FATAL_ERROR "Either crypto++ must be available or the non-GPL Spotify " - "code must be compiled in") -elseif(CRYPTOPP_FOUND) - set(HAVE_CRYPTOPP ON) - set(HAVE_SPOTIFY_DOWNLOADER ON) +optional_component(TRANSLATIONS ON "Translations" + DEPENDS "gettext" GETTEXT_XGETTEXT_EXECUTABLE + DEPENDS "Qt5LinguistTools" Qt5LinguistTools_FOUND +) + +option(USE_BUNDLE "Bundle macos/windows dependencies" ON) +if (APPLE AND USE_BUNDLE AND NOT USE_BUNDLE_DIR) + set(USE_BUNDLE_DIR "../PlugIns") endif() -# Find DBus if it's enabled -if (HAVE_DBUS) - find_package(Qt5 COMPONENTS DBus) - get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION) -endif () - -# We can include the Qt definitions now -if(WIN32) - set(QT_LIBRARIES Qt5::Core Qt5::OpenGL Qt5::Sql Qt5::Network Qt5::Xml Qt5::Widgets Qt5::Concurrent) -else(WIN32) - set(QT_LIBRARIES Qt5::Core Qt5::OpenGL Qt5::Sql Qt5::Network Qt5::Xml Qt5::Widgets Qt5::Concurrent Qt5::X11Extras Qt5::DBus) -endif(WIN32) +if(CRYPTOPP_FOUND) + set(HAVE_CRYPTOPP ON) + if(HAVE_SPOTIFY) + set(HAVE_SPOTIFY_DOWNLOADER ON) + endif(HAVE_SPOTIFY) +endif(CRYPTOPP_FOUND) # Remove GLU and GL from the link line - they're not really required # and don't exist on my mingw toolchain @@ -420,7 +465,6 @@ add_subdirectory(3rdparty/qocoa) # Subdirectories add_subdirectory(src) if (WIN32) - add_subdirectory(3rdparty/qtwin) add_subdirectory(3rdparty/tinysvcmdns) endif (WIN32) add_subdirectory(tests) @@ -430,7 +474,9 @@ add_subdirectory(ext/libclementine-common) add_subdirectory(ext/libclementine-tagreader) add_subdirectory(ext/clementine-tagreader) add_subdirectory(ext/libclementine-remote) -add_subdirectory(ext/libclementine-spotifyblob) +if(HAVE_SPOTIFY) + add_subdirectory(ext/libclementine-spotifyblob) +endif(HAVE_SPOTIFY) option(WITH_DEBIAN OFF) if(WITH_DEBIAN) diff --git a/debian/compat b/debian/compat index 7f8f011eb..ec635144f 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index d8900cce4..1885e75aa 100644 --- a/debian/control +++ b/debian/control @@ -3,41 +3,42 @@ Section: sound Priority: optional Maintainer: David Sansome Build-Depends: debhelper (>= 7), - liblastfm-dev, - libtag1-dev, - libboost1.38-dev | - libboost1.40-dev | - libboost1.42-dev | - libboost-dev, - libboost-serialization1.38-dev | - libboost-serialization1.40-dev | - libboost-serialization1.42-dev | - libboost-serialization-dev, - libcdio-cdda1, - libchromaprint-dev, - libcrypto++-dev, - libechonest-dev, - libglew1.5-dev | - libglew-dev, - libqt4-dev, - qt4-dev-tools, - libqt4-opengl-dev, + make, cmake, + gcc, + protobuf-compiler, + libglib2.0-dev, + libdbus-1-dev, + libprotobuf-dev, + libboost-dev, + libsqlite3-dev, + libasound2-dev, + libpulse-dev, + libtag1-dev, + libqt5-dev, + qt5-dev-tools, + qtbase5-dev, + qtbase5-dev-tools, + qtbase5-private-dev, + libqt5x11extras5-dev, + libqt5opengl5-dev, libgstreamer1.0-dev, libgstreamer-plugins-base1.0-dev, + libcdio-dev, libgpod-dev, + libimobiledevice-dev, + libmtp-dev, libplist-dev, libusbmuxd-dev, - libmtp-dev, - libqjson-dev, - protobuf-compiler, - libprotobuf-dev, + libchromaprint-dev, + liblastfm5-dev, + libcrypto++-dev, + libglew-dev, libfftw3-dev, libsparsehash-dev, - libsqlite3-dev, - libpulse-dev, - libmygpo-qt-dev (>= 1.0.7) -Standards-Version: 3.8.1 + libmygpo-qt-dev (>= 1.0.7), + libprojectm-dev (>= 2.0.1+dfsg-6) +Standards-Version: 3.9.8 Homepage: http://www.clementine-player.org/ Package: clementine @@ -47,6 +48,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, gstreamer1.0-plugins-base, gstreamer1.0-plugins-good, gstreamer1.0-plugins-ugly, + gstreamer1.0-alsa, gstreamer1.0-pulseaudio, libprojectm-data | projectm-data Description: Modern music player and library organiser inspired by Amarok 1.4 diff --git a/debian/copyright b/debian/copyright index 499978c1e..d2292b471 100644 --- a/debian/copyright +++ b/debian/copyright @@ -93,12 +93,6 @@ Files: 3rdparty/qtsingleapplication/* Copyright: 2009, Nokia Corporation License: Qt Commercial or LGPL-2.1 or GPL-3 -Files: 3rdparty/qtwin/* -Copyright: 2009, Nokia Corporation -License: other - Use, modification and distribution is allowed without limitation, - warranty, liability or support of any kind. - Files: 3rdparty/qxt/* Copyright: 2007, Qxt Foundation License: CPL 1.0 and/or LGPL-2.1 diff --git a/dist/clementine.spec.in b/dist/clementine.spec.in index 6e9f5434e..119608270 100644 --- a/dist/clementine.spec.in +++ b/dist/clementine.spec.in @@ -9,15 +9,52 @@ URL: http://www.clementine-player.org/ Source0: %{name}-@CLEMENTINE_VERSION_SPARKLE@.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: desktop-file-utils liblastfm-devel taglib-devel gettext -BuildRequires: qt5-devel boost-devel gcc-c++ glew-devel libgpod-devel -BuildRequires: cmake gstreamer1-devel gstreamer1-plugins-base-devel -BuildRequires: libmtp-devel protobuf-devel protobuf-compiler libcdio-devel -BuildRequires: qjson-devel cryptopp-devel fftw-devel sparsehash-devel -BuildRequires: sqlite-devel pulseaudio-libs-devel libechonest-devel -BuildRequires: libchromaprint-devel - -Requires: libgpod protobuf-lite libcdio qjson sqlite +BuildRequires: cmake +BuildRequires: make +BuildRequires: git +BuildRequires: gettext +BuildRequires: gcc-c++ +BuildRequires: boost-devel +BuildRequires: sparsehash-devel +BuildRequires: liblastfm-qt5-devel +BuildRequires: desktop-file-utils +BuildRequires: hicolor-icon-theme +BuildRequires: libappstream-glib +BuildRequires: pkgconfig +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(gio-unix-2.0) +BuildRequires: pkgconfig(gthread-2.0) +BuildRequires: pkgconfig(dbus-1) +BuildRequires: pkgconfig(alsa) +BuildRequires: pkgconfig(protobuf) +BuildRequires: pkgconfig(sqlite3) >= 3.7 +BuildRequires: pkgconfig(taglib) >= 1.11 +BuildRequires: pkgconfig(glew) +BuildRequires: pkgconfig(cryptopp) +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Gui) +BuildRequires: pkgconfig(Qt5Widgets) +BuildRequires: pkgconfig(Qt5Concurrent) +BuildRequires: pkgconfig(Qt5Sql) +BuildRequires: pkgconfig(Qt5Network) +BuildRequires: pkgconfig(Qt5Xml) +BuildRequires: pkgconfig(Qt5X11Extras) +BuildRequires: pkgconfig(Qt5OpenGL) +BuildRequires: pkgconfig(Qt5DBus) +BuildRequires: pkgconfig(Qt5Test) +BuildRequires: pkgconfig(gstreamer-1.0) +BuildRequires: pkgconfig(gstreamer-app-1.0) +BuildRequires: pkgconfig(gstreamer-audio-1.0) +BuildRequires: pkgconfig(gstreamer-base-1.0) +BuildRequires: pkgconfig(gstreamer-tag-1.0) +BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(libcdio) +BuildRequires: pkgconfig(libchromaprint) +BuildRequires: pkgconfig(libgpod-1.0) +BuildRequires: pkgconfig(libmtp) +BuildRequires: pkgconfig(libnotify) +BuildRequires: pkgconfig(libudf) # GStreamer codec dependencies Requires: gstreamer1-plugins-ugly @@ -80,7 +117,8 @@ make clean %doc %{_bindir}/clementine %{_bindir}/clementine-tagreader -%{_datadir}/appdata/clementine.appdata.xml +%dir %{_datadir}/metainfo/ +%{_datadir}/metainfo/clementine.appdata.xml %{_datadir}/applications/clementine.desktop %{_datadir}/clementine/projectm-presets %{_datadir}/kservices5/clementine-itms.protocol diff --git a/ext/libclementine-common/core/workerpool.h b/ext/libclementine-common/core/workerpool.h index 49fe099c0..ed3965e4c 100644 --- a/ext/libclementine-common/core/workerpool.h +++ b/ext/libclementine-common/core/workerpool.h @@ -229,8 +229,8 @@ void WorkerPool::DoStart() { QStringList search_path; search_path << qApp->applicationDirPath(); -#ifdef Q_OS_MAC - search_path << qApp->applicationDirPath() + "/../PlugIns"; +#if defined(Q_OS_MACOS) && defined(USE_BUNDLE) + search_path << qApp->applicationDirPath() + "/" + USE_BUNDLE_DIR; #endif for (const QString& path_prefix : search_path) { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 120f09949..9d0df7a78 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,9 +12,6 @@ endif(BUILD_WERROR) include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(../3rdparty/gmock/gtest/include) -if(WIN32) - include_directories(../3rdparty/qtwin) -endif(WIN32) # Activate fast QString concatenation add_definitions(-DQT_USE_QSTRINGBUILDER) @@ -33,7 +30,7 @@ include_directories(${SHA2_INCLUDE_DIRS}) include_directories(${CHROMAPRINT_INCLUDE_DIRS}) include_directories(${MYGPOQT5_INCLUDE_DIRS}) -find_package(OpenGL) +find_package(OpenGL REQUIRED) include_directories(${OPENGL_INCLUDE_DIR}) if(HAVE_LIBLASTFM) @@ -49,12 +46,17 @@ include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-tagreader) include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-tagreader) include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-remote) include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-remote) -include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-spotifyblob) -include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-spotifyblob) +if(HAVE_SPOTIFY) + include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-spotifyblob) + include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-spotifyblob) +endif(HAVE_SPOTIFY) cmake_policy(SET CMP0011 NEW) include(../cmake/ParseArguments.cmake) -include(../cmake/Translations.cmake) + +if(HAVE_TRANSLATIONS) + include(../cmake/Translations.cmake) +endif(HAVE_TRANSLATIONS) set(SOURCES analyzers/analyzerbase.cpp @@ -148,7 +150,6 @@ set(SOURCES globalsearch/simplesearchprovider.cpp globalsearch/somafmsearchprovider.cpp globalsearch/intergalacticfmsearchprovider.cpp - globalsearch/spotifysearchprovider.cpp globalsearch/suggestionwidget.cpp globalsearch/urlsearchprovider.cpp @@ -185,9 +186,6 @@ set(SOURCES internet/somafm/somafmurlhandler.cpp internet/intergalacticfm/intergalacticfmservice.cpp internet/intergalacticfm/intergalacticfmurlhandler.cpp - internet/spotify/spotifyserver.cpp - internet/spotify/spotifyservice.cpp - internet/spotify/spotifysettingspage.cpp internet/subsonic/subsonicservice.cpp internet/subsonic/subsonicsettingspage.cpp internet/subsonic/subsonicurlhandler.cpp @@ -303,7 +301,6 @@ set(SOURCES songinfo/songkickconcerts.cpp songinfo/songkickconcertwidget.cpp songinfo/songplaystats.cpp - songinfo/spotifyimages.cpp songinfo/streamdiscoverer.cpp songinfo/taglyricsinfoprovider.cpp songinfo/ultimatelyricslyric.cpp @@ -459,7 +456,6 @@ set(HEADERS globalsearch/globalsearchview.h globalsearch/searchprovider.h globalsearch/simplesearchprovider.h - globalsearch/spotifysearchprovider.h globalsearch/suggestionwidget.h internet/core/cloudfileservice.h @@ -492,9 +488,6 @@ set(HEADERS internet/somafm/somafmurlhandler.h internet/intergalacticfm/intergalacticfmservice.h internet/intergalacticfm/intergalacticfmurlhandler.h - internet/spotify/spotifyserver.h - internet/spotify/spotifyservice.h - internet/spotify/spotifysettingspage.h internet/subsonic/subsonicservice.h internet/subsonic/subsonicsettingspage.h internet/subsonic/subsonicurlhandler.h @@ -596,7 +589,6 @@ set(HEADERS songinfo/songkickconcerts.h songinfo/songkickconcertwidget.h songinfo/songplaystats.h - songinfo/spotifyimages.h songinfo/streamdiscoverer.h songinfo/taglyricsinfoprovider.h songinfo/ultimatelyricslyric.h @@ -693,7 +685,6 @@ set(UI internet/magnatune/magnatunedownloaddialog.ui internet/magnatune/magnatunesettingspage.ui internet/core/searchboxwidget.ui - internet/spotify/spotifysettingspage.ui internet/subsonic/subsonicsettingspage.ui library/groupbydialog.ui @@ -780,22 +771,24 @@ set(RESOURCES set(OTHER_SOURCES) -set(LINGUAS "All" CACHE STRING "A space-seperated list of translations to compile in to Clementine, or \"None\".") -if (LINGUAS STREQUAL "All") - # build LANGUAGES from all existing .po files - file(GLOB pofiles translations/*.po) - foreach(pofile ${pofiles}) - get_filename_component(lang ${pofile} NAME_WE) - list(APPEND LANGUAGES ${lang}) - endforeach(pofile) -else (LINGUAS STREQUAL "All") - if (NOT LINGUAS OR LINGUAS STREQUAL "None") - set (LANGUAGES "") - else (NOT LINGUAS OR LINGUAS STREQUAL "None") - string(REGEX MATCHALL [a-zA-Z_@]+ +if (HAVE_TRANSLATIONS) + set(LINGUAS "All" CACHE STRING "A space-seperated list of translations to compile in to Clementine, or \"None\".") + if (LINGUAS STREQUAL "All") + # build LANGUAGES from all existing .po files + file(GLOB pofiles translations/*.po) + foreach(pofile ${pofiles}) + get_filename_component(lang ${pofile} NAME_WE) + list(APPEND LANGUAGES ${lang}) + endforeach(pofile) + else (LINGUAS STREQUAL "All") + if (NOT LINGUAS OR LINGUAS STREQUAL "None") + set (LANGUAGES "") + else (NOT LINGUAS OR LINGUAS STREQUAL "None") + string(REGEX MATCHALL [a-zA-Z_@]+ LANGUAGES ${LINGUAS}) - endif (NOT LINGUAS OR LINGUAS STREQUAL "None") -endif (LINGUAS STREQUAL "All") + endif (NOT LINGUAS OR LINGUAS STREQUAL "None") + endif (LINGUAS STREQUAL "All") +endif(HAVE_TRANSLATIONS) option(USE_INSTALL_PREFIX "Look for data in CMAKE_INSTALL_PREFIX" ON) @@ -838,16 +831,35 @@ optional_source(HAVE_LIBLASTFM internet/lastfm/lastfmsettingspage.ui ) - -optional_source(HAVE_SPOTIFY_DOWNLOADER +# Spotify support +optional_source(HAVE_SPOTIFY SOURCES - internet/spotify/spotifyblobdownloader.cpp + internet/spotify/spotifyserver.cpp + internet/spotify/spotifyservice.cpp + internet/spotify/spotifysettingspage.cpp + globalsearch/spotifysearchprovider.cpp + songinfo/spotifyimages.cpp HEADERS - internet/spotify/spotifyblobdownloader.h - INCLUDE_DIRECTORIES - ${CRYPTOPP_INCLUDE_DIRS} + globalsearch/spotifysearchprovider.h + internet/spotify/spotifyserver.h + internet/spotify/spotifyservice.h + internet/spotify/spotifysettingspage.h + songinfo/spotifyimages.h + UI + internet/spotify/spotifysettingspage.ui ) +if(HAVE_SPOTIFY) + optional_source(HAVE_SPOTIFY_DOWNLOADER + SOURCES + internet/spotify/spotifyblobdownloader.cpp + HEADERS + internet/spotify/spotifyblobdownloader.h + INCLUDE_DIRECTORIES + ${CRYPTOPP_INCLUDE_DIRS} + ) +endif(HAVE_SPOTIFY) + # Platform specific - OS X optional_source(APPLE INCLUDE_DIRECTORIES @@ -889,10 +901,10 @@ optional_source(WIN32 ) # Platform specific - X11 -optional_source(LINUX SOURCES widgets/osd_x11.cpp) +optional_source(HAVE_X11 SOURCES widgets/osd_x11.cpp) -# DBUS and MPRIS - Linux specific -if(HAVE_DBUS) +# DBUS and MPRIS - Unix specific +if(UNIX AND HAVE_DBUS) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus) # MPRIS 2.0 DBUS interfaces @@ -997,7 +1009,7 @@ if(HAVE_DBUS) dbus/org.wiimotedev.deviceEvents.xml dbus/wiimotedev) endif(ENABLE_WIIMOTEDEV) -endif(HAVE_DBUS) +endif(UNIX AND HAVE_DBUS) optional_source(HAVE_DBUS SOURCES @@ -1201,16 +1213,18 @@ qt5_wrap_cpp(MOC ${HEADERS}) qt5_wrap_ui(UIC ${UI}) qt5_add_resources(QRC ${RESOURCES}) -add_pot(POT - ${CMAKE_CURRENT_SOURCE_DIR}/translations/header - ${CMAKE_CURRENT_SOURCE_DIR}/translations/translations.pot - ${SOURCES} ${MOC} ${UIC} ${OTHER_SOURCES} - ../data/oauthsuccess.html -) -add_po(PO clementine_ - LANGUAGES ${LANGUAGES} - DIRECTORY translations -) +if(HAVE_TRANSLATIONS) + add_pot(POT + ${CMAKE_CURRENT_SOURCE_DIR}/translations/header + ${CMAKE_CURRENT_SOURCE_DIR}/translations/translations.pot + ${SOURCES} ${MOC} ${UIC} ${OTHER_SOURCES} + ../data/oauthsuccess.html + ) + add_po(PO clementine_ + LANGUAGES ${LANGUAGES} + DIRECTORY translations + ) +endif(HAVE_TRANSLATIONS) add_library(clementine_lib STATIC ${SOURCES} @@ -1223,7 +1237,6 @@ add_library(clementine_lib STATIC ) target_link_libraries(clementine_lib - clementine-spotifyblob-messages libclementine-common libclementine-tagreader libclementine-remote @@ -1288,6 +1301,10 @@ if(HAVE_BREAKPAD) endif (LINUX) endif(HAVE_BREAKPAD) +if(HAVE_SPOTIFY) + target_link_libraries(clementine_lib clementine-spotifyblob-messages) +endif(HAVE_SPOTIFY) + if(HAVE_SPOTIFY_DOWNLOADER) target_link_libraries(clementine_lib ${CRYPTOPP_LIBRARIES} @@ -1327,10 +1344,10 @@ target_link_libraries(clementine_lib qsqlite) if (WIN32) target_link_libraries(clementine_lib + protobuf ${ZLIB_LIBRARIES} ${QTSPARKLE_LIBRARIES} tinysvcmdns - qtwin dsound ${QT_QTGUI_LIBRARY} ) @@ -1343,7 +1360,7 @@ if (UNIX AND NOT APPLE) # they end up getting ignored. This appends them to the very end of the link # line, ensuring they're always used. find_package(X11) - if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + if (FREEBSD) target_link_libraries(clementine_lib ${X11_X11_LIB}) else () target_link_libraries(clementine_lib ${X11_X11_LIB} ${CMAKE_DL_LIBS}) @@ -1376,9 +1393,9 @@ add_executable(clementine main.cpp ) -if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") +if (FREEBSD) target_link_libraries(clementine execinfo) -endif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") +endif (FREEBSD) target_link_libraries(clementine clementine_lib @@ -1420,12 +1437,14 @@ if (APPLE) WORLD_READ WORLD_EXECUTE) endif (HAVE_BREAKPAD) - add_custom_command(TARGET clementine - POST_BUILD - COMMAND - ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macdeploy.py ${PROJECT_BINARY_DIR}/clementine.app -f - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - ) + if (USE_BUNDLE) + add_custom_command(TARGET clementine + POST_BUILD + COMMAND + ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macdeploy.py ${PROJECT_BINARY_DIR}/clementine.app -f + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) + endif(USE_BUNDLE) add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/clementine.breakpad COMMAND diff --git a/src/analyzers/analyzerbase.h b/src/analyzers/analyzerbase.h index 8074bfaef..d65e6c110 100644 --- a/src/analyzers/analyzerbase.h +++ b/src/analyzers/analyzerbase.h @@ -39,7 +39,7 @@ #include #include -#ifdef Q_WS_MACX +#ifdef Q_OS_MACX #include #include #else diff --git a/src/config.h.in b/src/config.h.in index 4475e28dc..c21c2ec4b 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -27,6 +27,7 @@ #cmakedefine HAVE_BREAKPAD #cmakedefine HAVE_CRYPTOPP #cmakedefine HAVE_DBUS +#cmakedefine HAVE_X11 #cmakedefine HAVE_DEVICEKIT #cmakedefine HAVE_DROPBOX #cmakedefine HAVE_GIO @@ -44,9 +45,14 @@ #cmakedefine HAVE_SPOTIFY_DOWNLOADER #cmakedefine HAVE_UDISKS2 #cmakedefine HAVE_WIIMOTEDEV +#cmakedefine HAVE_TRANSLATIONS +#cmakedefine HAVE_SPOTIFY #cmakedefine TAGLIB_HAS_OPUS #cmakedefine USE_INSTALL_PREFIX #cmakedefine USE_SYSTEM_PROJECTM #cmakedefine USE_SYSTEM_SHA2 +#cmakedefine USE_BUNDLE + +#define USE_BUNDLE_DIR "${USE_BUNDLE_DIR}" #endif // CONFIG_H_IN diff --git a/src/core/globalshortcuts.cpp b/src/core/globalshortcuts.cpp index 0f0749443..8aa7860dc 100644 --- a/src/core/globalshortcuts.cpp +++ b/src/core/globalshortcuts.cpp @@ -19,6 +19,7 @@ along with Clementine. If not, see . */ +#include "config.h" #include "globalshortcuts.h" #include "gnomeglobalshortcutbackend.h" #include "macglobalshortcutbackend.h" @@ -31,7 +32,7 @@ #include #include -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS #include #endif @@ -147,10 +148,10 @@ GlobalShortcuts::Shortcut GlobalShortcuts::AddShortcut( } bool GlobalShortcuts::IsGsdAvailable() const { -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS return QDBusConnection::sessionBus().interface()->isServiceRegistered( GnomeGlobalShortcutBackend::kGsdService); -#else // QT_DBUS_LIB +#else // HAVE_DBUS return false; #endif } diff --git a/src/core/gnomeglobalshortcutbackend.cpp b/src/core/gnomeglobalshortcutbackend.cpp index 8a0f58760..2d151dae4 100644 --- a/src/core/gnomeglobalshortcutbackend.cpp +++ b/src/core/gnomeglobalshortcutbackend.cpp @@ -17,13 +17,14 @@ along with Clementine. If not, see . */ +#include "config.h" #include "gnomeglobalshortcutbackend.h" #include "globalshortcuts.h" #include "core/closure.h" #include "core/logging.h" -#ifdef QT_DBUS_LIB -#include "dbus/gnomesettingsdaemon.h" +#ifdef HAVE_DBUS +#include #endif #include @@ -31,7 +32,7 @@ #include #include -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS #include #endif @@ -48,7 +49,7 @@ GnomeGlobalShortcutBackend::GnomeGlobalShortcutBackend(GlobalShortcuts* parent) is_connected_(false) {} bool GnomeGlobalShortcutBackend::DoRegister() { -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS qLog(Debug) << "registering"; // Check if the GSD service is available if (!QDBusConnection::sessionBus().interface()->isServiceRegistered( @@ -71,7 +72,7 @@ bool GnomeGlobalShortcutBackend::DoRegister() { SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher); return true; -#else // QT_DBUS_LIB +#else // HAVE_DBUS qLog(Warning) << "dbus not available"; return false; #endif @@ -79,7 +80,7 @@ bool GnomeGlobalShortcutBackend::DoRegister() { void GnomeGlobalShortcutBackend::RegisterFinished( QDBusPendingCallWatcher* watcher) { -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS QDBusMessage reply = watcher->reply(); watcher->deleteLater(); @@ -94,12 +95,12 @@ void GnomeGlobalShortcutBackend::RegisterFinished( is_connected_ = true; qLog(Debug) << "registered"; -#endif // QT_DBUS_LIB +#endif // HAVE_DBUS } void GnomeGlobalShortcutBackend::DoUnregister() { qLog(Debug) << "unregister"; -#ifdef QT_DBUS_LIB +#ifdef HAVE_DBUS // Check if the GSD service is available if (!QDBusConnection::sessionBus().interface()->isServiceRegistered( kGsdService)) diff --git a/src/core/metatypes.cpp b/src/core/metatypes.cpp index b0086cf9e..e6584568a 100644 --- a/src/core/metatypes.cpp +++ b/src/core/metatypes.cpp @@ -114,7 +114,6 @@ void RegisterMetaTypes() { qRegisterMetaType("QFileInfo"); #ifdef HAVE_DBUS - qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType>(); @@ -124,5 +123,8 @@ void RegisterMetaTypes() { qDBusRegisterMetaType(); qDBusRegisterMetaType(); +#ifdef HAVE_X11 + qDBusRegisterMetaType(); +#endif #endif } diff --git a/src/covers/albumcoverloader.cpp b/src/covers/albumcoverloader.cpp index a1a4582ef..214fc8243 100644 --- a/src/covers/albumcoverloader.cpp +++ b/src/covers/albumcoverloader.cpp @@ -34,7 +34,9 @@ #include "core/tagreaderclient.h" #include "core/utilities.h" #include "internet/core/internetmodel.h" -#include "internet/spotify/spotifyservice.h" +#ifdef HAVE_SPOTIFY +# include "internet/spotify/spotifyservice.h" +#endif AlbumCoverLoader::AlbumCoverLoader(QObject* parent) : QObject(parent), @@ -176,7 +178,9 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage( remote_tasks_.insert(reply, task); return TryLoadResult(true, false, QImage()); - } else if (filename.toLower().startsWith("spotify://image/")) { + } +#ifdef HAVE_SPOTIFY + else if (filename.toLower().startsWith("spotify://image/")) { // HACK: we should add generic image URL handlers SpotifyService* spotify = InternetModel::Service(); @@ -196,7 +200,9 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage( QMetaObject::invokeMethod(spotify, "LoadImage", Qt::QueuedConnection, Q_ARG(QString, id)); return TryLoadResult(true, false, QImage()); - } else if (filename.isEmpty()) { + } +#endif + else if (filename.isEmpty()) { // Avoid "QFSFileEngine::open: No file name specified" messages if we know that the filename is empty return TryLoadResult(false, false, task.options.default_output_image_); } @@ -207,6 +213,7 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage( image.isNull() ? task.options.default_output_image_ : image); } +#ifdef HAVE_SPOTIFY void AlbumCoverLoader::SpotifyImageLoaded(const QString& id, const QImage& image) { if (!remote_spotify_tasks_.contains(id)) return; @@ -216,6 +223,7 @@ void AlbumCoverLoader::SpotifyImageLoaded(const QString& id, emit ImageLoaded(task.id, scaled); emit ImageLoaded(task.id, scaled, image); } +#endif void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply* reply) { reply->deleteLater(); diff --git a/src/covers/albumcoverloader.h b/src/covers/albumcoverloader.h index 4d3e4d571..e2b44cde4 100644 --- a/src/covers/albumcoverloader.h +++ b/src/covers/albumcoverloader.h @@ -21,6 +21,7 @@ #ifndef COVERS_ALBUMCOVERLOADER_H_ #define COVERS_ALBUMCOVERLOADER_H_ +#include "config.h" #include "albumcoverloaderoptions.h" #include "core/song.h" @@ -66,7 +67,9 @@ class AlbumCoverLoader : public QObject { protected slots: void ProcessTasks(); void RemoteFetchFinished(QNetworkReply* reply); +#ifdef HAVE_SPOTIFY void SpotifyImageLoaded(const QString& url, const QImage& image); +#endif protected: enum State { State_TryingManual, State_TryingAuto, }; diff --git a/src/devices/deviceview.cpp b/src/devices/deviceview.cpp index 7d62571aa..35300dd6b 100644 --- a/src/devices/deviceview.cpp +++ b/src/devices/deviceview.cpp @@ -56,9 +56,7 @@ void DeviceItemDelegate::paint(QPainter* p, const QStyleOptionViewItem& opt, } // Draw the background - const QStyleOptionViewItemV3* vopt = - qstyleoption_cast(&opt); - const QWidget* widget = vopt->widget; + const QWidget* widget = opt.widget; QStyle* style = widget->style() ? widget->style() : QApplication::style(); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, p, widget); diff --git a/src/devices/macdevicelister.mm b/src/devices/macdevicelister.mm index e4d8934a8..2ac240776 100644 --- a/src/devices/macdevicelister.mm +++ b/src/devices/macdevicelister.mm @@ -42,11 +42,12 @@ #include -#include - -#include #include #include +#include +#include +#include +#include #ifndef kUSBSerialNumberString #define kUSBSerialNumberString "USB Serial Number" @@ -118,9 +119,9 @@ void MacDeviceLister::Init() { for (int i = 0; i < num; ++i) { LIBMTP_device_entry_t device = devices[i]; MTPDevice d; - d.vendor = QString::fromAscii(device.vendor); + d.vendor = QString::fromLatin1(device.vendor); d.vendor_id = device.vendor_id; - d.product = QString::fromAscii(device.product); + d.product = QString::fromLatin1(device.product); d.product_id = device.product_id; d.quirks = device.device_flags; sMTPDeviceList << d; @@ -305,7 +306,7 @@ QString GetSerialForMTPDevice(io_object_t device) { QString FindDeviceProperty(const QString& bsd_name, CFStringRef property) { ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); + kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); ScopedIOObject device(DADiskCopyIOMedia(disk.get())); QString ret = GetUSBRegistryEntryString(device.get(), property); @@ -358,7 +359,7 @@ void MacDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) { #ifdef HAVE_AUDIOCD if (kind && strcmp([kind UTF8String], kIOCDMediaClass) == 0) { // CD inserted. - QString bsd_name = QString::fromAscii(DADiskGetBSDName(disk)); + QString bsd_name = QString::fromLatin1(DADiskGetBSDName(disk)); me->cd_devices_ << bsd_name; emit me->DeviceAdded(bsd_name); return; @@ -402,7 +403,7 @@ void MacDeviceLister::DiskRemovedCallback(DADiskRef disk, void* context) { // We cannot access the USB tree when the disk is removed but we still get // the BSD disk name. - QString bsd_name = QString::fromAscii(DADiskGetBSDName(disk)); + QString bsd_name = QString::fromLatin1(DADiskGetBSDName(disk)); if (me->cd_devices_.remove(bsd_name)) { emit me->DeviceRemoved(bsd_name); return; @@ -579,7 +580,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { 4, 256, &data); if (!ret || data.at(0) != 0x28) continue; - if (QString::fromAscii(data.data() + 0x12, 3) != "MTP") { + if (QString::fromLatin1(data.data() + 0x12, 3) != "MTP") { // Not quite. continue; } @@ -590,7 +591,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { continue; } - if (QString::fromAscii(data.data() + 0x12, 3) != "MTP") { + if (QString::fromLatin1(data.data() + 0x12, 3) != "MTP") { // Not quite. continue; } @@ -671,7 +672,7 @@ QString MacDeviceLister::MakeFriendlyName(const QString& serial) { IsCDDevice(serial) ? *cd_devices_.find(serial) : current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); + kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); if (IsCDDevice(serial)) { scoped_nsobject properties( @@ -700,12 +701,14 @@ QList MacDeviceLister::MakeDeviceUrls(const QString& serial) { const MTPDevice& device = mtp_devices_[serial]; QString str; str.sprintf("gphoto2://usb-%d-%d/", device.bus, device.address); + QUrlQuery url_query; + url_query.addQueryItem("vendor", device.vendor); + url_query.addQueryItem("vendor_id", QString::number(device.vendor_id)); + url_query.addQueryItem("product", device.product); + url_query.addQueryItem("product_id", QString::number(device.product_id)); + url_query.addQueryItem("quirks", QString::number(device.quirks)); QUrl url(str); - url.addQueryItem("vendor", device.vendor); - url.addQueryItem("vendor_id", QString::number(device.vendor_id)); - url.addQueryItem("product", device.product); - url.addQueryItem("product_id", QString::number(device.product_id)); - url.addQueryItem("quirks", QString::number(device.quirks)); + url.setQuery(url_query); return QList() << url; } @@ -716,7 +719,7 @@ QList MacDeviceLister::MakeDeviceUrls(const QString& serial) { QString bsd_name = current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); + kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); scoped_nsobject properties( (NSDictionary*)DADiskCopyDescription(disk.get())); @@ -745,7 +748,7 @@ QVariantList MacDeviceLister::DeviceIcons(const QString& serial) { QString bsd_name = current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); + kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); ScopedIOObject device(DADiskCopyIOMedia(disk.get())); QString icon = GetIconForDevice(device.get()); @@ -788,7 +791,7 @@ quint64 MacDeviceLister::DeviceCapacity(const QString& serial) { QString bsd_name = current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); + kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); io_object_t device = DADiskCopyIOMedia(disk); @@ -809,7 +812,7 @@ quint64 MacDeviceLister::DeviceFreeSpace(const QString& serial) { QString bsd_name = current_devices_[serial]; ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); + kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); scoped_nsobject properties( (NSDictionary*)DADiskCopyDescription(disk)); @@ -840,7 +843,7 @@ void MacDeviceLister::UnmountDevice(const QString& serial) { QString bsd_name = current_devices_[serial]; ScopedCFTypeRef disk(DADiskCreateFromBSDName( - kCFAllocatorDefault, loop_session_, bsd_name.toAscii().constData())); + kCFAllocatorDefault, loop_session_, bsd_name.toLatin1().constData())); DADiskUnmount(disk, kDADiskUnmountOptionDefault, &DiskUnmountCallback, this); } diff --git a/src/engines/gstenginepipeline.cpp b/src/engines/gstenginepipeline.cpp index 0bafeb8c1..f6094c41f 100644 --- a/src/engines/gstenginepipeline.cpp +++ b/src/engines/gstenginepipeline.cpp @@ -15,6 +15,8 @@ along with Clementine. If not, see . */ +#include "config.h" + #include #include @@ -33,8 +35,10 @@ #include "core/signalchecker.h" #include "core/utilities.h" #include "internet/core/internetmodel.h" -#include "internet/spotify/spotifyserver.h" -#include "internet/spotify/spotifyservice.h" +#ifdef HAVE_SPOTIFY +# include "internet/spotify/spotifyserver.h" +# include "internet/spotify/spotifyservice.h" +#endif const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000; const int GstEnginePipeline::kFaderFudgeMsec = 2000; @@ -151,6 +155,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(GstElement* new_bin) { bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { GstElement* new_bin = nullptr; +#ifdef HAVE_SPOTIFY if (url.scheme() == "spotify") { new_bin = gst_bin_new("spotify_bin"); @@ -181,6 +186,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { spotify_server, "StartPlayback", Qt::QueuedConnection, Q_ARG(QString, url.toString()), Q_ARG(quint16, port)); } else { +#endif QByteArray uri; if (url.scheme() == "cdda") { QString str = url.toString(); @@ -197,7 +203,9 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { CHECKED_GCONNECT(G_OBJECT(new_bin), "pad-added", &NewPadCallback, this); CHECKED_GCONNECT(G_OBJECT(new_bin), "notify::source", &SourceSetupCallback, this); +#ifdef HAVE_SPOTIFY } +#endif return ReplaceDecodeBin(new_bin); } @@ -1050,6 +1058,7 @@ GstState GstEnginePipeline::state() const { } QFuture GstEnginePipeline::SetState(GstState state) { +#ifdef HAVE_SPOTIFY if (url_.scheme() == "spotify" && !buffering_) { const GstState current_state = this->state(); @@ -1068,6 +1077,7 @@ QFuture GstEnginePipeline::SetState(GstState state) { Q_ARG(bool, false)); } } +#endif return ConcurrentRun::Run( &set_state_threadpool_, &gst_element_set_state, pipeline_, state); } diff --git a/src/internet/core/internetmodel.cpp b/src/internet/core/internetmodel.cpp index d7db2975b..756d48073 100644 --- a/src/internet/core/internetmodel.cpp +++ b/src/internet/core/internetmodel.cpp @@ -41,7 +41,6 @@ #include "internet/magnatune/magnatuneservice.h" #include "internet/podcasts/podcastservice.h" #include "internet/somafm/somafmservice.h" -#include "internet/spotify/spotifyservice.h" #include "internet/subsonic/subsonicservice.h" #include "smartplaylists/generatormimedata.h" @@ -60,6 +59,9 @@ #ifdef HAVE_SEAFILE #include "internet/seafile/seafileservice.h" #endif +#ifdef HAVE_SPOTIFY +#include "internet/spotify/spotifyservice.h" +#endif using smart_playlists::Generator; using smart_playlists::GeneratorMimeData; @@ -92,7 +94,9 @@ InternetModel::InternetModel(Application* app, QObject* parent) AddService(new RadioTunesService(app, this)); AddService(new SomaFMService(app, this)); AddService(new IntergalacticFMService(app, this)); +#ifdef HAVE_SPOTIFY AddService(new SpotifyService(app, this)); +#endif AddService(new SubsonicService(app, this)); #ifdef HAVE_BOX AddService(new BoxService(app, this)); diff --git a/src/internet/spotify/spotifyservice.cpp b/src/internet/spotify/spotifyservice.cpp index 9d9045266..e05aeb1b7 100644 --- a/src/internet/spotify/spotifyservice.cpp +++ b/src/internet/spotify/spotifyservice.cpp @@ -90,9 +90,9 @@ SpotifyService::SpotifyService(Application* app, InternetModel* parent) // Build the search path for the binary blob. // Look for one distributed alongside clementine first, then check in the // user's home directory for any that have been downloaded. -#ifdef Q_OS_MAC +#if defined(Q_OS_MACOS) && defined(USE_BUNDLE) system_blob_path_ = QCoreApplication::applicationDirPath() + - "/../PlugIns/clementine-spotifyblob"; + "/" + USE_BUNDLE_DIR + "/clementine-spotifyblob"; #else system_blob_path_ = QCoreApplication::applicationDirPath() + "/clementine-spotifyblob" CMAKE_EXECUTABLE_SUFFIX; diff --git a/src/main.cpp b/src/main.cpp index 48acf367c..0ee7a8fa7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,9 +20,11 @@ #include #ifdef Q_OS_WIN32 -#define _WIN32_WINNT 0x0600 -#include -#include +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 +# endif +# include +# include #endif // Q_OS_WIN32 #ifdef Q_OS_UNIX @@ -95,7 +97,7 @@ const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image); #endif #ifdef Q_OS_WIN32 -#include +#include #endif // Load sqlite plugin on windows and mac. @@ -151,14 +153,16 @@ void SetGstreamerEnvironment() { QString registry_filename; // On windows and mac we bundle the gstreamer plugins with clementine +#ifdef USE_BUNDLE #if defined(Q_OS_DARWIN) scanner_path = - QCoreApplication::applicationDirPath() + "/../PlugIns/gst-plugin-scanner"; + QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gst-plugin-scanner"; plugin_path = - QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer"; + QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gstreamer"; #elif defined(Q_OS_WIN32) plugin_path = QCoreApplication::applicationDirPath() + "/gstreamer-plugins"; #endif +#endif #if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) registry_filename = @@ -177,9 +181,9 @@ void SetGstreamerEnvironment() { SetEnv("GST_REGISTRY", registry_filename); } -#ifdef Q_OS_DARWIN +#if defined(Q_OS_DARWIN) && defined(USE_BUNDLE) SetEnv("GIO_EXTRA_MODULES", - QCoreApplication::applicationDirPath() + "/../PlugIns/gio-modules"); + QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gio-modules"); #endif SetEnv("PULSE_PROP_media.role", "music"); @@ -339,9 +343,10 @@ int main(int argc, char* argv[]) { .toInt()); } -#ifdef Q_OS_DARWIN +#if defined(Q_OS_DARWIN) && defined(USE_BUNDLE) + qLog(Debug) << "Looking for resources in" + QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR; QCoreApplication::setLibraryPaths( - QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns"); + QStringList() << QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR); #endif a.setQuitOnLastWindowClosed(false); @@ -381,7 +386,9 @@ int main(int argc, char* argv[]) { // Resources Q_INIT_RESOURCE(data); +#ifdef HAVE_TRANSLATIONS Q_INIT_RESOURCE(translations); +#endif // Add root CA cert for SoundCloud, whose certificate is missing on OS X. QSslSocket::addDefaultCaCertificates( diff --git a/src/musicbrainz/chromaprinter.cpp b/src/musicbrainz/chromaprinter.cpp index 6d1c00c35..aad146b0e 100644 --- a/src/musicbrainz/chromaprinter.cpp +++ b/src/musicbrainz/chromaprinter.cpp @@ -29,6 +29,10 @@ #include "core/logging.h" #include "core/signalchecker.h" +#ifndef u_int32_t +typedef unsigned int u_int32_t; +#endif + static const int kDecodeRate = 11025; static const int kDecodeChannels = 1; static const int kPlayLengthSecs = 30; diff --git a/src/playlist/playlistdelegates.cpp b/src/playlist/playlistdelegates.cpp index 8d4b24bda..daf896e73 100644 --- a/src/playlist/playlistdelegates.cpp +++ b/src/playlist/playlistdelegates.cpp @@ -182,7 +182,7 @@ void PlaylistDelegateBase::paint(QPainter* painter, } } -QStyleOptionViewItemV4 PlaylistDelegateBase::Adjusted( +QStyleOptionViewItem PlaylistDelegateBase::Adjusted( const QStyleOptionViewItem& option, const QModelIndex& index) const { if (!view_) return option; @@ -192,7 +192,7 @@ QStyleOptionViewItemV4 PlaylistDelegateBase::Adjusted( if (view_->header()->logicalIndexAt(top_left) != index.column()) return option; - QStyleOptionViewItemV4 ret(option); + QStyleOptionViewItem ret(option); if (index.data(Playlist::Role_IsCurrent).toBool()) { // Move the text in a bit on the first column for the song that's currently @@ -320,10 +320,8 @@ void RatingItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { // Draw the background - const QStyleOptionViewItemV3* vopt = - qstyleoption_cast(&option); - vopt->widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, vopt, - painter, vopt->widget); + option.widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, + painter, option.widget); // Don't draw anything else if the user can't set the rating of this item if (!index.data(Playlist::Role_CanSetRating).toBool()) return; diff --git a/src/playlist/playlistdelegates.h b/src/playlist/playlistdelegates.h index 35008c81f..df6436d15 100644 --- a/src/playlist/playlistdelegates.h +++ b/src/playlist/playlistdelegates.h @@ -63,7 +63,7 @@ class PlaylistDelegateBase : public QueuedItemDelegate { QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; - QStyleOptionViewItemV4 Adjusted(const QStyleOptionViewItem& option, + QStyleOptionViewItem Adjusted(const QStyleOptionViewItem& option, const QModelIndex& index) const; static const int kMinHeight; diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 572715187..9966cb997 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -466,7 +466,7 @@ void PlaylistView::drawTree(QPainter* painter, const QRegion& region) const { void PlaylistView::drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { - QStyleOptionViewItemV4 opt(option); + QStyleOptionViewItem opt(option); bool is_current = index.data(Playlist::Role_IsCurrent).toBool(); bool is_paused = index.data(Playlist::Role_IsPaused).toBool(); @@ -545,7 +545,7 @@ void PlaylistView::drawRow(QPainter* painter, } } -void PlaylistView::UpdateCachedCurrentRowPixmap(QStyleOptionViewItemV4 option, +void PlaylistView::UpdateCachedCurrentRowPixmap(QStyleOptionViewItem option, const QModelIndex& index) { cached_current_row_rect_ = option.rect; cached_current_row_row_ = index.row(); diff --git a/src/playlist/playlistview.h b/src/playlist/playlistview.h index 4e97f6347..aa4b144a1 100644 --- a/src/playlist/playlistview.h +++ b/src/playlist/playlistview.h @@ -164,7 +164,7 @@ signals: private: void ReloadBarPixmaps(); QList LoadBarPixmap(const QString& filename); - void UpdateCachedCurrentRowPixmap(QStyleOptionViewItemV4 option, + void UpdateCachedCurrentRowPixmap(QStyleOptionViewItem option, const QModelIndex& index); void set_background_image_type(BackgroundImageType bg) { diff --git a/src/songinfo/artistinfoview.cpp b/src/songinfo/artistinfoview.cpp index 8a1f77582..735a2b460 100644 --- a/src/songinfo/artistinfoview.cpp +++ b/src/songinfo/artistinfoview.cpp @@ -20,12 +20,16 @@ #include "songinfo/artistbiography.h" #include "songinfo/songinfofetcher.h" #include "songinfo/songkickconcerts.h" -#include "songinfo/spotifyimages.h" #include "widgets/prettyimageview.h" +#ifdef HAVE_SPOTIFY +#include "songinfo/spotifyimages.h" +#endif ArtistInfoView::ArtistInfoView(QWidget* parent) : SongInfoBase(parent) { fetcher_->AddProvider(new SongkickConcerts); +#ifdef HAVE_SPOTIFY fetcher_->AddProvider(new SpotifyImages); +#endif fetcher_->AddProvider(new ArtistBiography); } diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 9df0c2ca1..26a0163e9 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -39,7 +39,7 @@ #include #ifdef Q_OS_WIN32 -#include +#include #endif #include "core/appearance.h" diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index 7549446e1..354187ade 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -34,7 +34,6 @@ #include "internet/digitally/digitallyimportedsettingspage.h" #include "internet/magnatune/magnatunesettingspage.h" #include "internet/podcasts/podcastsettingspage.h" -#include "internet/spotify/spotifysettingspage.h" #include "internet/subsonic/subsonicsettingspage.h" #include "library/librarysettingspage.h" #include "mainwindow.h" @@ -78,6 +77,10 @@ #include "internet/seafile/seafilesettingspage.h" #endif +#ifdef HAVE_SPOTIFY +#include "internet/spotify/spotifysettingspage.h" +#endif + #include #include #include @@ -174,7 +177,9 @@ SettingsDialog::SettingsDialog(Application* app, BackgroundStreams* streams, AddPage(Page_Skydrive, new SkydriveSettingsPage(this), providers); #endif +#ifdef HAVE_SPOTIFY AddPage(Page_Spotify, new SpotifySettingsPage(this), providers); +#endif #ifdef HAVE_SEAFILE AddPage(Page_Seafile, new SeafileSettingsPage(this), providers); diff --git a/src/ui/windows7thumbbar.cpp b/src/ui/windows7thumbbar.cpp index b8fbdecb6..50b2254d5 100644 --- a/src/ui/windows7thumbbar.cpp +++ b/src/ui/windows7thumbbar.cpp @@ -22,10 +22,12 @@ #include #ifdef Q_OS_WIN32 -#define _WIN32_WINNT 0x0600 -#include -#include -#include +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 +# endif +# include +# include +# include #endif // Q_OS_WIN32 const int Windows7ThumbBar::kIconSize = 16; diff --git a/src/widgets/groupediconview.cpp b/src/widgets/groupediconview.cpp index 113516fc9..77801acb1 100644 --- a/src/widgets/groupediconview.cpp +++ b/src/widgets/groupediconview.cpp @@ -214,8 +214,8 @@ void GroupedIconView::paintEvent(QPaintEvent* e) { // This code was adapted from QListView::paintEvent(), changed to use the // visualRect() of items, and to draw headers. - QStyleOptionViewItemV4 option(viewOptions()); - if (isWrapping()) option.features = QStyleOptionViewItemV2::WrapText; + QStyleOptionViewItem option(viewOptions()); + if (isWrapping()) option.features = QStyleOptionViewItem::WrapText; option.locale = locale(); option.locale.setNumberOptions(QLocale::OmitGroupSeparator); option.widget = this; diff --git a/src/widgets/osd.cpp b/src/widgets/osd.cpp index 2d81eb12f..77178a145 100644 --- a/src/widgets/osd.cpp +++ b/src/widgets/osd.cpp @@ -233,12 +233,10 @@ void OSD::ShowMessage(const QString& summary, const QString& message, } } -#ifndef HAVE_DBUS +#if !defined(HAVE_X11) && defined(HAVE_DBUS) void OSD::CallFinished(QDBusPendingCallWatcher*) {} #endif -#ifdef HAVE_WIIMOTEDEV - void OSD::WiiremoteActived(int id) { ShowMessage(QString(tr("%1: Wiimotedev module")) .arg(QCoreApplication::applicationName()), @@ -277,8 +275,6 @@ void OSD::WiiremoteCriticalBattery(int id, int live) { .arg(QString::number(id), QString::number(live))); } -#endif - void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) { if (show_on_play_mode_change_) { QString current_mode = QString(); diff --git a/src/widgets/osd.h b/src/widgets/osd.h index 201481a1f..fc2e0575c 100644 --- a/src/widgets/osd.h +++ b/src/widgets/osd.h @@ -38,6 +38,7 @@ class QDBusPendingCallWatcher; #ifdef HAVE_DBUS #include +#include QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image); const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image); @@ -81,14 +82,12 @@ class OSD : public QObject { void ReshowCurrentSong(); -#ifdef HAVE_WIIMOTEDEV void WiiremoteActived(int id); void WiiremoteDeactived(int id); void WiiremoteConnected(int id); void WiiremoteDisconnected(int id); void WiiremoteLowBattery(int id, int live); void WiiremoteCriticalBattery(int id, int live); -#endif void ShowPreview(const Behaviour type, const QString& line1, const QString& line2, const Song& song); @@ -106,7 +105,9 @@ class OSD : public QObject { QString ReplaceVariable(const QString& variable, const Song& song); private slots: +#if defined(HAVE_DBUS) void CallFinished(QDBusPendingCallWatcher* watcher); +#endif void AlbumArtLoaded(const Song& song, const QString& uri, const QImage& image); diff --git a/src/widgets/osdpretty.cpp b/src/widgets/osdpretty.cpp index 6c2241cac..9d95716d8 100644 --- a/src/widgets/osdpretty.cpp +++ b/src/widgets/osdpretty.cpp @@ -15,6 +15,7 @@ along with Clementine. If not, see . */ +#include "config.h" #include "osdpretty.h" #include "ui_osdpretty.h" @@ -31,12 +32,14 @@ #include -#ifdef Q_WS_X11 +#ifdef HAVE_X11 #include #endif +#ifdef Q_OS_WIN32 +# include +#endif #ifdef Q_OS_WIN32 -#include "qtwin.h" #include #endif @@ -137,7 +140,7 @@ OSDPretty::OSDPretty(Mode mode, QWidget* parent) OSDPretty::~OSDPretty() { delete ui_; } bool OSDPretty::IsTransparencyAvailable() { -#ifdef Q_WS_X11 +#if defined(HAVE_X11) && (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) return QX11Info::isCompositingManagerRunning(); #endif return true; @@ -346,7 +349,7 @@ void OSDPretty::Reposition() { #ifdef Q_OS_WIN32 // On windows, enable blurbehind on the masked area - QtWin::enableBlurBehindWindow(this, true, QRegion(mask)); + QtWin::enableBlurBehindWindow(this, QRegion(mask)); #endif } diff --git a/tests/main.cpp b/tests/main.cpp index 036e02111..85e42b93f 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -23,7 +23,7 @@ #include "metatypes_env.h" #include "resources_env.h" -#ifndef Q_WS_X11 +#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) # include Q_IMPORT_PLUGIN(QSQLiteDriverPlugin) #endif