Qt 5 fixes

This commit is contained in:
Jonas Kvinge 2018-11-17 15:08:37 +01:00 committed by John Maguire
parent b8eea8ccc1
commit 8c198a99a5
50 changed files with 429 additions and 601 deletions

View File

@ -3,9 +3,8 @@ set( MYGPO_QT_VERSION_MAJOR "1" )
set( MYGPO_QT_VERSION_MINOR "0" ) set( MYGPO_QT_VERSION_MINOR "0" )
set( MYGPO_QT_VERSION_PATCH "9" ) set( MYGPO_QT_VERSION_PATCH "9" )
configure_file( Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/Version.h ) 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 set ( LIBMYGPO_QT_SRC
Config.cpp 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} ) 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} ) 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 )

View File

@ -37,7 +37,9 @@ public:
switch(bezelStyle) { switch(bezelStyle) {
case QButton::Disclosure: case QButton::Disclosure:
case QButton::Circular: case QButton::Circular:
#ifdef __MAC_10_7
case QButton::Inline: case QButton::Inline:
#endif
case QButton::RoundedDisclosure: case QButton::RoundedDisclosure:
case QButton::HelpButton: case QButton::HelpButton:
[nsButton setTitle:@""]; [nsButton setTitle:@""];
@ -55,7 +57,7 @@ public:
font = [NSFont fontWithName:@"Lucida Grande Bold" size:12]; font = [NSFont fontWithName:@"Lucida Grande Bold" size:12];
break; break;
#ifdef MAC_OS_X_VERSION_10_7 #ifdef __MAC_10_7
case QButton::Inline: case QButton::Inline:
font = [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; font = [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
break; break;
@ -112,7 +114,7 @@ public:
qButton->setFixedHeight(22); qButton->setFixedHeight(22);
qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
break; break;
#ifdef MAC_OS_X_VERSION_10_7 #ifdef __MAC_10_7
case QButton::Inline: case QButton::Inline:
qButton->setMinimumWidth(10); qButton->setMinimumWidth(10);
qButton->setFixedHeight(16); qButton->setFixedHeight(16);
@ -130,7 +132,7 @@ public:
[nsButton setButtonType:NSMomentaryPushInButton]; [nsButton setButtonType:NSMomentaryPushInButton];
} }
[nsButton setBezelStyle:bezelStyle]; [nsButton setBezelStyle:(__bridge NSBezelStyle)bezelStyle];
} }
void clicked() void clicked()

View File

@ -20,9 +20,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <AppKit/NSImage.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include <QString> #include <QString>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QtMacExtras>
#include <QMacCocoaViewContainer> #include <QMacCocoaViewContainer>
static inline NSString* fromQString(const QString &string) static inline NSString* fromQString(const QString &string)
@ -41,11 +43,11 @@ static inline QString toQString(NSString *string)
static inline NSImage* fromQPixmap(const QPixmap &pixmap) static inline NSImage* fromQPixmap(const QPixmap &pixmap)
{ {
CGImageRef cgImage = pixmap.toMacCGImageRef(); CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize]; 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); parent->setAttribute(Qt::WA_NativeWindow);
QVBoxLayout *layout = new QVBoxLayout(parent); QVBoxLayout *layout = new QVBoxLayout(parent);

View File

@ -49,7 +49,7 @@
#include <QtCore/QIODevice> #include <QtCore/QIODevice>
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
# if !defined(QT_QTIOCOMPRESSOR_EXPORT) && !defined(QT_QTIOCOMPRESSOR_IMPORT) # if !defined(QT_QTIOCOMPRESSOR_EXPORT) && !defined(QT_QTIOCOMPRESSOR_IMPORT)
# define QT_QTIOCOMPRESSOR_EXPORT # define QT_QTIOCOMPRESSOR_EXPORT
# elif defined(QT_QTIOCOMPRESSOR_IMPORT) # elif defined(QT_QTIOCOMPRESSOR_IMPORT)

View File

@ -54,14 +54,12 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0;
#include <time.h> #include <time.h>
#endif #endif
namespace QtLP_Private {
#include "qtlockedfile.cpp" #include "qtlockedfile.cpp"
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#include "qtlockedfile_win.cpp" #include "qtlockedfile_win.cpp"
#else #else
#include "qtlockedfile_unix.cpp" #include "qtlockedfile_unix.cpp"
#endif #endif
}
const char* QtLocalPeer::ack = "ack"; const char* QtLocalPeer::ack = "ack";
@ -113,7 +111,7 @@ bool QtLocalPeer::isClient()
if (lockFile.isLocked()) if (lockFile.isLocked())
return false; return false;
if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false)) if (!lockFile.lock(QtLockedFile::WriteLock, false))
return true; return true;
bool res = server->listen(socketName); bool res = server->listen(socketName);
@ -149,7 +147,7 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
Sleep(DWORD(ms)); Sleep(DWORD(ms));
#else #else
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL); nanosleep(&ts, nullptr);
#endif #endif
} }
if (!connOk) if (!connOk)

View File

@ -67,7 +67,7 @@ protected:
QString id; QString id;
QString socketName; QString socketName;
QLocalServer* server; QLocalServer* server;
QtLP_Private::QtLockedFile lockFile; QtLockedFile lockFile;
private: private:
static const char* ack; static const char* ack;

View File

@ -45,7 +45,7 @@
#include <QtCore/QVector> #include <QtCore/QVector>
#endif #endif
#if defined(Q_WS_WIN) || defined(Q_OS_WIN) #if defined(Q_OS_WIN)
# if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT) # if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT)
# define QT_QTLOCKEDFILE_EXPORT # define QT_QTLOCKEDFILE_EXPORT
# elif defined(QT_QTLOCKEDFILE_IMPORT) # elif defined(QT_QTLOCKEDFILE_IMPORT)
@ -61,8 +61,6 @@
# define QT_QTLOCKEDFILE_EXPORT # define QT_QTLOCKEDFILE_EXPORT
#endif #endif
namespace QtLP_Private {
class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile
{ {
public: public:
@ -92,5 +90,5 @@ private:
#endif #endif
LockMode m_lock_mode; LockMode m_lock_mode;
}; };
}
#endif #endif

View File

@ -59,10 +59,10 @@ 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(NULL, FALSE, (TCHAR*)mname.utf16()); }, QT_WA( { mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16()); },
{ mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } ); { mutex = CreateMutexA(nullptr, FALSE, mname.toLocal8Bit().constData()); } );
#else #else
mutex = CreateMutexW(NULL, FALSE, (TCHAR*)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 +71,10 @@ 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, (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()); } ); { mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
#else #else
mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)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

@ -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; Returns true if another instance of this application is running;
otherwise false. otherwise false.

View File

@ -44,7 +44,7 @@
class QtLocalPeer; 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) # if !defined(QT_QTSINGLEAPPLICATION_EXPORT) && !defined(QT_QTSINGLEAPPLICATION_IMPORT)
# define QT_QTSINGLEAPPLICATION_EXPORT # define QT_QTSINGLEAPPLICATION_EXPORT
# elif defined(QT_QTSINGLEAPPLICATION_IMPORT) # elif defined(QT_QTSINGLEAPPLICATION_IMPORT)
@ -67,11 +67,6 @@ class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication
public: public:
QtSingleApplication(int &argc, char **argv, bool GUIenabled = true); QtSingleApplication(int &argc, char **argv, bool GUIenabled = true);
QtSingleApplication(const QString &id, int &argc, char **argv); 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(); bool isRunning();
QString id() const; QString id() const;

View File

@ -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
)

View File

@ -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 <QLibrary>
#include <QApplication>
#include <QWidget>
#include <QList>
#include <QPointer>
#ifdef Q_WS_WIN
#include <qt_windows.h>
// 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 &region)
{
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

View File

@ -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 <QColor>
#include <QWidget>
/**
* 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

View File

@ -34,36 +34,36 @@
#include <QtDebug> #include <QtDebug>
bool QxtGlobalShortcutPrivate::error = false; bool QxtGlobalShortcutPrivate::error = false;
#ifndef Q_WS_MAC #ifndef Q_OS_MAC
int QxtGlobalShortcutPrivate::ref = 0; 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_WS_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_WS_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_WS_MAC #endif // Q_OS_MAC
} }
QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate() QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate()
{ {
#ifndef Q_WS_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_WS_MAC #endif // Q_OS_MAC
} }
bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut) bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut)

View File

@ -59,7 +59,7 @@ public:
bool unsetShortcut(); bool unsetShortcut();
static bool error; static bool error;
#ifndef Q_WS_MAC #ifndef Q_OS_MAC
static int ref; static int ref;
#if QT_VERSION < QT_VERSION_CHECK(5,0,0) #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
static QAbstractEventDispatcher::EventFilter prevEventFilter; static QAbstractEventDispatcher::EventFilter prevEventFilter;
@ -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_WS_MAC #endif // Q_OS_MAC
static void activateShortcut(quint32 nativeKey, quint32 nativeMods); static void activateShortcut(quint32 nativeKey, quint32 nativeMods);

View File

@ -7,7 +7,7 @@ set(TINYSVCMDNS-SOURCES
) )
find_library(PTHREAD find_library(PTHREAD
pthreadGC2 pthread
) )
add_library(tinysvcmdns STATIC add_library(tinysvcmdns STATIC

View File

@ -28,20 +28,12 @@ if (CCACHE_EXECUTABLE)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE}) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE})
endif () endif ()
if (UNIX AND NOT APPLE) if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LINUX 1) set(LINUX ON)
endif (UNIX AND NOT APPLE) endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(QT_MIN_VERSION 5.6.0) set(FREEBSD ON)
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)
endif() endif()
find_package(Qt5LinguistTools CONFIG REQUIRED)
set(QT_LCONVERT_EXECUTABLE Qt5::lconvert)
if(APPLE) if(APPLE)
if(NOT QT_MAC_USE_COCOA) if(NOT QT_MAC_USE_COCOA)
@ -56,10 +48,22 @@ find_package(Gettext REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(Protobuf REQUIRED) find_package(Protobuf REQUIRED)
find_package(FFTW3) find_package(FFTW3)
if(LINUX)
find_package(ALSA REQUIRED)
pkg_check_modules(DBUS REQUIRED dbus-1)
else(LINUX)
find_package(ALSA) find_package(ALSA)
pkg_check_modules(DBUS dbus-1)
endif(LINUX)
if(ALSA_FOUND) if(ALSA_FOUND)
set(HAVE_ALSA ON) set(HAVE_ALSA ON)
endif() endif()
if (NOT APPLE)
find_package(X11)
endif()
if(X11_FOUND)
set(HAVE_X11 ON)
endif()
find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf) 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(LIBMYGPO_QT5 libmygpo-qt5>=1.0.9)
pkg_check_modules(LIBPULSE libpulse) pkg_check_modules(LIBPULSE libpulse)
pkg_check_modules(LIBXML libxml-2.0) 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) pkg_check_modules(TAGLIB taglib)
if (WIN32) if (WIN32)
@ -94,6 +98,44 @@ find_path(LASTFM51_INCLUDE_DIRS lastfm5/Track.h)
find_path(SPARSEHASH_INCLUDE_DIRS google/sparsetable) 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 # 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 # 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: # 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) if (APPLE)
find_library(SPARKLE Sparkle) find_library(SPARKLE Sparkle)
find_library(LIBSPOTIFY libspotify)
find_library(SPOTIFY libspotify) if(LIBSPOTIFY_FOUND)
if (SPOTIFY) set(LIBSPOTIFY_INCLUDE_DIRS ${LIBSPOTIFY})
set (SPOTIFY_FOUND ON) set(LIBSPOTIFY_LIBRARIES ${LIBSPOTIFY})
set (SPOTIFY_INCLUDE_DIRS ${SPOTIFY}) endif(LIBSPOTIFY_FOUND)
set (SPOTIFY_LIBRARIES ${SPOTIFY})
endif (SPOTIFY)
add_subdirectory(3rdparty/SPMediaKeyTap) add_subdirectory(3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/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" optional_component(DBUS ON "D-Bus support"
DEPENDS "Linux" LINUX DEPENDS "D-Bus" DBUS_FOUND
) )
optional_component(WIIMOTEDEV ON "Wiimote support" 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" 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" 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" optional_component(SPOTIFY_BLOB ON "Spotify support: non-GPL binary helper"
DEPENDS "spotify support" HAVE_SPOTIFY
DEPENDS "protobuf" PROTOBUF_FOUND PROTOBUF_PROTOC_EXECUTABLE DEPENDS "protobuf" PROTOBUF_FOUND PROTOBUF_PROTOC_EXECUTABLE
DEPENDS "libspotify" SPOTIFY_FOUND DEPENDS "libspotify" SPOTIFY_FOUND
) )
@ -286,26 +335,22 @@ optional_component(LIBPULSE ON "Pulse audio integration"
optional_component(VISUALISATIONS ON "Visualisations") optional_component(VISUALISATIONS ON "Visualisations")
if(NOT HAVE_SPOTIFY_BLOB AND NOT CRYPTOPP_FOUND) optional_component(TRANSLATIONS ON "Translations"
message(FATAL_ERROR "Either crypto++ must be available or the non-GPL Spotify " DEPENDS "gettext" GETTEXT_XGETTEXT_EXECUTABLE
"code must be compiled in") DEPENDS "Qt5LinguistTools" Qt5LinguistTools_FOUND
elseif(CRYPTOPP_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()
if(CRYPTOPP_FOUND)
set(HAVE_CRYPTOPP ON) set(HAVE_CRYPTOPP ON)
if(HAVE_SPOTIFY)
set(HAVE_SPOTIFY_DOWNLOADER ON) set(HAVE_SPOTIFY_DOWNLOADER ON)
endif() endif(HAVE_SPOTIFY)
endif(CRYPTOPP_FOUND)
# 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)
# Remove GLU and GL from the link line - they're not really required # Remove GLU and GL from the link line - they're not really required
# and don't exist on my mingw toolchain # and don't exist on my mingw toolchain
@ -420,7 +465,6 @@ add_subdirectory(3rdparty/qocoa)
# Subdirectories # Subdirectories
add_subdirectory(src) add_subdirectory(src)
if (WIN32) if (WIN32)
add_subdirectory(3rdparty/qtwin)
add_subdirectory(3rdparty/tinysvcmdns) add_subdirectory(3rdparty/tinysvcmdns)
endif (WIN32) endif (WIN32)
add_subdirectory(tests) add_subdirectory(tests)
@ -430,7 +474,9 @@ add_subdirectory(ext/libclementine-common)
add_subdirectory(ext/libclementine-tagreader) add_subdirectory(ext/libclementine-tagreader)
add_subdirectory(ext/clementine-tagreader) add_subdirectory(ext/clementine-tagreader)
add_subdirectory(ext/libclementine-remote) add_subdirectory(ext/libclementine-remote)
if(HAVE_SPOTIFY)
add_subdirectory(ext/libclementine-spotifyblob) add_subdirectory(ext/libclementine-spotifyblob)
endif(HAVE_SPOTIFY)
option(WITH_DEBIAN OFF) option(WITH_DEBIAN OFF)
if(WITH_DEBIAN) if(WITH_DEBIAN)

2
debian/compat vendored
View File

@ -1 +1 @@
7 9

56
debian/control vendored
View File

@ -3,41 +3,42 @@ Section: sound
Priority: optional Priority: optional
Maintainer: David Sansome <me@davidsansome.com> Maintainer: David Sansome <me@davidsansome.com>
Build-Depends: debhelper (>= 7), Build-Depends: debhelper (>= 7),
liblastfm-dev, make,
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,
cmake, 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, libgstreamer1.0-dev,
libgstreamer-plugins-base1.0-dev, libgstreamer-plugins-base1.0-dev,
libcdio-dev,
libgpod-dev, libgpod-dev,
libimobiledevice-dev,
libmtp-dev,
libplist-dev, libplist-dev,
libusbmuxd-dev, libusbmuxd-dev,
libmtp-dev, libchromaprint-dev,
libqjson-dev, liblastfm5-dev,
protobuf-compiler, libcrypto++-dev,
libprotobuf-dev, libglew-dev,
libfftw3-dev, libfftw3-dev,
libsparsehash-dev, libsparsehash-dev,
libsqlite3-dev, libmygpo-qt-dev (>= 1.0.7),
libpulse-dev, libprojectm-dev (>= 2.0.1+dfsg-6)
libmygpo-qt-dev (>= 1.0.7) Standards-Version: 3.9.8
Standards-Version: 3.8.1
Homepage: http://www.clementine-player.org/ Homepage: http://www.clementine-player.org/
Package: clementine Package: clementine
@ -47,6 +48,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends},
gstreamer1.0-plugins-base, gstreamer1.0-plugins-base,
gstreamer1.0-plugins-good, gstreamer1.0-plugins-good,
gstreamer1.0-plugins-ugly, gstreamer1.0-plugins-ugly,
gstreamer1.0-alsa,
gstreamer1.0-pulseaudio, gstreamer1.0-pulseaudio,
libprojectm-data | projectm-data libprojectm-data | projectm-data
Description: Modern music player and library organiser inspired by Amarok 1.4 Description: Modern music player and library organiser inspired by Amarok 1.4

6
debian/copyright vendored
View File

@ -93,12 +93,6 @@ Files: 3rdparty/qtsingleapplication/*
Copyright: 2009, Nokia Corporation Copyright: 2009, Nokia Corporation
License: Qt Commercial or LGPL-2.1 or GPL-3 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/* Files: 3rdparty/qxt/*
Copyright: 2007, Qxt Foundation Copyright: 2007, Qxt Foundation
License: CPL 1.0 and/or LGPL-2.1 License: CPL 1.0 and/or LGPL-2.1

View File

@ -9,15 +9,52 @@ URL: http://www.clementine-player.org/
Source0: %{name}-@CLEMENTINE_VERSION_SPARKLE@.tar.xz Source0: %{name}-@CLEMENTINE_VERSION_SPARKLE@.tar.xz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: desktop-file-utils liblastfm-devel taglib-devel gettext BuildRequires: cmake
BuildRequires: qt5-devel boost-devel gcc-c++ glew-devel libgpod-devel BuildRequires: make
BuildRequires: cmake gstreamer1-devel gstreamer1-plugins-base-devel BuildRequires: git
BuildRequires: libmtp-devel protobuf-devel protobuf-compiler libcdio-devel BuildRequires: gettext
BuildRequires: qjson-devel cryptopp-devel fftw-devel sparsehash-devel BuildRequires: gcc-c++
BuildRequires: sqlite-devel pulseaudio-libs-devel libechonest-devel BuildRequires: boost-devel
BuildRequires: libchromaprint-devel BuildRequires: sparsehash-devel
BuildRequires: liblastfm-qt5-devel
Requires: libgpod protobuf-lite libcdio qjson sqlite 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 # GStreamer codec dependencies
Requires: gstreamer1-plugins-ugly Requires: gstreamer1-plugins-ugly
@ -80,7 +117,8 @@ make clean
%doc %doc
%{_bindir}/clementine %{_bindir}/clementine
%{_bindir}/clementine-tagreader %{_bindir}/clementine-tagreader
%{_datadir}/appdata/clementine.appdata.xml %dir %{_datadir}/metainfo/
%{_datadir}/metainfo/clementine.appdata.xml
%{_datadir}/applications/clementine.desktop %{_datadir}/applications/clementine.desktop
%{_datadir}/clementine/projectm-presets %{_datadir}/clementine/projectm-presets
%{_datadir}/kservices5/clementine-itms.protocol %{_datadir}/kservices5/clementine-itms.protocol

View File

@ -229,8 +229,8 @@ void WorkerPool<HandlerType>::DoStart() {
QStringList search_path; QStringList search_path;
search_path << qApp->applicationDirPath(); search_path << qApp->applicationDirPath();
#ifdef Q_OS_MAC #if defined(Q_OS_MACOS) && defined(USE_BUNDLE)
search_path << qApp->applicationDirPath() + "/../PlugIns"; search_path << qApp->applicationDirPath() + "/" + USE_BUNDLE_DIR;
#endif #endif
for (const QString& path_prefix : search_path) { for (const QString& path_prefix : search_path) {

View File

@ -12,9 +12,6 @@ endif(BUILD_WERROR)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(../3rdparty/gmock/gtest/include) include_directories(../3rdparty/gmock/gtest/include)
if(WIN32)
include_directories(../3rdparty/qtwin)
endif(WIN32)
# Activate fast QString concatenation # Activate fast QString concatenation
add_definitions(-DQT_USE_QSTRINGBUILDER) add_definitions(-DQT_USE_QSTRINGBUILDER)
@ -33,7 +30,7 @@ include_directories(${SHA2_INCLUDE_DIRS})
include_directories(${CHROMAPRINT_INCLUDE_DIRS}) include_directories(${CHROMAPRINT_INCLUDE_DIRS})
include_directories(${MYGPOQT5_INCLUDE_DIRS}) include_directories(${MYGPOQT5_INCLUDE_DIRS})
find_package(OpenGL) find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR}) include_directories(${OPENGL_INCLUDE_DIR})
if(HAVE_LIBLASTFM) 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_BINARY_DIR}/ext/libclementine-tagreader)
include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-remote) include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-remote)
include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-remote) include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-remote)
if(HAVE_SPOTIFY)
include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-spotifyblob) include_directories(${CMAKE_SOURCE_DIR}/ext/libclementine-spotifyblob)
include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-spotifyblob) include_directories(${CMAKE_BINARY_DIR}/ext/libclementine-spotifyblob)
endif(HAVE_SPOTIFY)
cmake_policy(SET CMP0011 NEW) cmake_policy(SET CMP0011 NEW)
include(../cmake/ParseArguments.cmake) include(../cmake/ParseArguments.cmake)
if(HAVE_TRANSLATIONS)
include(../cmake/Translations.cmake) include(../cmake/Translations.cmake)
endif(HAVE_TRANSLATIONS)
set(SOURCES set(SOURCES
analyzers/analyzerbase.cpp analyzers/analyzerbase.cpp
@ -148,7 +150,6 @@ set(SOURCES
globalsearch/simplesearchprovider.cpp globalsearch/simplesearchprovider.cpp
globalsearch/somafmsearchprovider.cpp globalsearch/somafmsearchprovider.cpp
globalsearch/intergalacticfmsearchprovider.cpp globalsearch/intergalacticfmsearchprovider.cpp
globalsearch/spotifysearchprovider.cpp
globalsearch/suggestionwidget.cpp globalsearch/suggestionwidget.cpp
globalsearch/urlsearchprovider.cpp globalsearch/urlsearchprovider.cpp
@ -185,9 +186,6 @@ set(SOURCES
internet/somafm/somafmurlhandler.cpp internet/somafm/somafmurlhandler.cpp
internet/intergalacticfm/intergalacticfmservice.cpp internet/intergalacticfm/intergalacticfmservice.cpp
internet/intergalacticfm/intergalacticfmurlhandler.cpp internet/intergalacticfm/intergalacticfmurlhandler.cpp
internet/spotify/spotifyserver.cpp
internet/spotify/spotifyservice.cpp
internet/spotify/spotifysettingspage.cpp
internet/subsonic/subsonicservice.cpp internet/subsonic/subsonicservice.cpp
internet/subsonic/subsonicsettingspage.cpp internet/subsonic/subsonicsettingspage.cpp
internet/subsonic/subsonicurlhandler.cpp internet/subsonic/subsonicurlhandler.cpp
@ -303,7 +301,6 @@ set(SOURCES
songinfo/songkickconcerts.cpp songinfo/songkickconcerts.cpp
songinfo/songkickconcertwidget.cpp songinfo/songkickconcertwidget.cpp
songinfo/songplaystats.cpp songinfo/songplaystats.cpp
songinfo/spotifyimages.cpp
songinfo/streamdiscoverer.cpp songinfo/streamdiscoverer.cpp
songinfo/taglyricsinfoprovider.cpp songinfo/taglyricsinfoprovider.cpp
songinfo/ultimatelyricslyric.cpp songinfo/ultimatelyricslyric.cpp
@ -459,7 +456,6 @@ set(HEADERS
globalsearch/globalsearchview.h globalsearch/globalsearchview.h
globalsearch/searchprovider.h globalsearch/searchprovider.h
globalsearch/simplesearchprovider.h globalsearch/simplesearchprovider.h
globalsearch/spotifysearchprovider.h
globalsearch/suggestionwidget.h globalsearch/suggestionwidget.h
internet/core/cloudfileservice.h internet/core/cloudfileservice.h
@ -492,9 +488,6 @@ set(HEADERS
internet/somafm/somafmurlhandler.h internet/somafm/somafmurlhandler.h
internet/intergalacticfm/intergalacticfmservice.h internet/intergalacticfm/intergalacticfmservice.h
internet/intergalacticfm/intergalacticfmurlhandler.h internet/intergalacticfm/intergalacticfmurlhandler.h
internet/spotify/spotifyserver.h
internet/spotify/spotifyservice.h
internet/spotify/spotifysettingspage.h
internet/subsonic/subsonicservice.h internet/subsonic/subsonicservice.h
internet/subsonic/subsonicsettingspage.h internet/subsonic/subsonicsettingspage.h
internet/subsonic/subsonicurlhandler.h internet/subsonic/subsonicurlhandler.h
@ -596,7 +589,6 @@ set(HEADERS
songinfo/songkickconcerts.h songinfo/songkickconcerts.h
songinfo/songkickconcertwidget.h songinfo/songkickconcertwidget.h
songinfo/songplaystats.h songinfo/songplaystats.h
songinfo/spotifyimages.h
songinfo/streamdiscoverer.h songinfo/streamdiscoverer.h
songinfo/taglyricsinfoprovider.h songinfo/taglyricsinfoprovider.h
songinfo/ultimatelyricslyric.h songinfo/ultimatelyricslyric.h
@ -693,7 +685,6 @@ set(UI
internet/magnatune/magnatunedownloaddialog.ui internet/magnatune/magnatunedownloaddialog.ui
internet/magnatune/magnatunesettingspage.ui internet/magnatune/magnatunesettingspage.ui
internet/core/searchboxwidget.ui internet/core/searchboxwidget.ui
internet/spotify/spotifysettingspage.ui
internet/subsonic/subsonicsettingspage.ui internet/subsonic/subsonicsettingspage.ui
library/groupbydialog.ui library/groupbydialog.ui
@ -780,6 +771,7 @@ set(RESOURCES
set(OTHER_SOURCES) set(OTHER_SOURCES)
if (HAVE_TRANSLATIONS)
set(LINGUAS "All" CACHE STRING "A space-seperated list of translations to compile in to Clementine, or \"None\".") set(LINGUAS "All" CACHE STRING "A space-seperated list of translations to compile in to Clementine, or \"None\".")
if (LINGUAS STREQUAL "All") if (LINGUAS STREQUAL "All")
# build LANGUAGES from all existing .po files # build LANGUAGES from all existing .po files
@ -796,6 +788,7 @@ else (LINGUAS STREQUAL "All")
LANGUAGES ${LINGUAS}) LANGUAGES ${LINGUAS})
endif (NOT LINGUAS OR LINGUAS STREQUAL "None") endif (NOT LINGUAS OR LINGUAS STREQUAL "None")
endif (LINGUAS STREQUAL "All") endif (LINGUAS STREQUAL "All")
endif(HAVE_TRANSLATIONS)
option(USE_INSTALL_PREFIX "Look for data in CMAKE_INSTALL_PREFIX" ON) option(USE_INSTALL_PREFIX "Look for data in CMAKE_INSTALL_PREFIX" ON)
@ -838,7 +831,25 @@ optional_source(HAVE_LIBLASTFM
internet/lastfm/lastfmsettingspage.ui internet/lastfm/lastfmsettingspage.ui
) )
# Spotify support
optional_source(HAVE_SPOTIFY
SOURCES
internet/spotify/spotifyserver.cpp
internet/spotify/spotifyservice.cpp
internet/spotify/spotifysettingspage.cpp
globalsearch/spotifysearchprovider.cpp
songinfo/spotifyimages.cpp
HEADERS
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 optional_source(HAVE_SPOTIFY_DOWNLOADER
SOURCES SOURCES
internet/spotify/spotifyblobdownloader.cpp internet/spotify/spotifyblobdownloader.cpp
@ -847,6 +858,7 @@ optional_source(HAVE_SPOTIFY_DOWNLOADER
INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES
${CRYPTOPP_INCLUDE_DIRS} ${CRYPTOPP_INCLUDE_DIRS}
) )
endif(HAVE_SPOTIFY)
# Platform specific - OS X # Platform specific - OS X
optional_source(APPLE optional_source(APPLE
@ -889,10 +901,10 @@ optional_source(WIN32
) )
# Platform specific - X11 # 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 # DBUS and MPRIS - Unix specific
if(HAVE_DBUS) if(UNIX AND HAVE_DBUS)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus)
# MPRIS 2.0 DBUS interfaces # MPRIS 2.0 DBUS interfaces
@ -997,7 +1009,7 @@ if(HAVE_DBUS)
dbus/org.wiimotedev.deviceEvents.xml dbus/org.wiimotedev.deviceEvents.xml
dbus/wiimotedev) dbus/wiimotedev)
endif(ENABLE_WIIMOTEDEV) endif(ENABLE_WIIMOTEDEV)
endif(HAVE_DBUS) endif(UNIX AND HAVE_DBUS)
optional_source(HAVE_DBUS optional_source(HAVE_DBUS
SOURCES SOURCES
@ -1201,6 +1213,7 @@ qt5_wrap_cpp(MOC ${HEADERS})
qt5_wrap_ui(UIC ${UI}) qt5_wrap_ui(UIC ${UI})
qt5_add_resources(QRC ${RESOURCES}) qt5_add_resources(QRC ${RESOURCES})
if(HAVE_TRANSLATIONS)
add_pot(POT add_pot(POT
${CMAKE_CURRENT_SOURCE_DIR}/translations/header ${CMAKE_CURRENT_SOURCE_DIR}/translations/header
${CMAKE_CURRENT_SOURCE_DIR}/translations/translations.pot ${CMAKE_CURRENT_SOURCE_DIR}/translations/translations.pot
@ -1211,6 +1224,7 @@ add_po(PO clementine_
LANGUAGES ${LANGUAGES} LANGUAGES ${LANGUAGES}
DIRECTORY translations DIRECTORY translations
) )
endif(HAVE_TRANSLATIONS)
add_library(clementine_lib STATIC add_library(clementine_lib STATIC
${SOURCES} ${SOURCES}
@ -1223,7 +1237,6 @@ add_library(clementine_lib STATIC
) )
target_link_libraries(clementine_lib target_link_libraries(clementine_lib
clementine-spotifyblob-messages
libclementine-common libclementine-common
libclementine-tagreader libclementine-tagreader
libclementine-remote libclementine-remote
@ -1288,6 +1301,10 @@ if(HAVE_BREAKPAD)
endif (LINUX) endif (LINUX)
endif(HAVE_BREAKPAD) endif(HAVE_BREAKPAD)
if(HAVE_SPOTIFY)
target_link_libraries(clementine_lib clementine-spotifyblob-messages)
endif(HAVE_SPOTIFY)
if(HAVE_SPOTIFY_DOWNLOADER) if(HAVE_SPOTIFY_DOWNLOADER)
target_link_libraries(clementine_lib target_link_libraries(clementine_lib
${CRYPTOPP_LIBRARIES} ${CRYPTOPP_LIBRARIES}
@ -1327,10 +1344,10 @@ target_link_libraries(clementine_lib qsqlite)
if (WIN32) if (WIN32)
target_link_libraries(clementine_lib target_link_libraries(clementine_lib
protobuf
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${QTSPARKLE_LIBRARIES} ${QTSPARKLE_LIBRARIES}
tinysvcmdns tinysvcmdns
qtwin
dsound dsound
${QT_QTGUI_LIBRARY} ${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 # they end up getting ignored. This appends them to the very end of the link
# line, ensuring they're always used. # line, ensuring they're always used.
find_package(X11) find_package(X11)
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if (FREEBSD)
target_link_libraries(clementine_lib ${X11_X11_LIB}) target_link_libraries(clementine_lib ${X11_X11_LIB})
else () else ()
target_link_libraries(clementine_lib ${X11_X11_LIB} ${CMAKE_DL_LIBS}) target_link_libraries(clementine_lib ${X11_X11_LIB} ${CMAKE_DL_LIBS})
@ -1376,9 +1393,9 @@ add_executable(clementine
main.cpp main.cpp
) )
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if (FREEBSD)
target_link_libraries(clementine execinfo) target_link_libraries(clementine execinfo)
endif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") endif (FREEBSD)
target_link_libraries(clementine target_link_libraries(clementine
clementine_lib clementine_lib
@ -1420,12 +1437,14 @@ if (APPLE)
WORLD_READ WORLD_EXECUTE) WORLD_READ WORLD_EXECUTE)
endif (HAVE_BREAKPAD) endif (HAVE_BREAKPAD)
if (USE_BUNDLE)
add_custom_command(TARGET clementine add_custom_command(TARGET clementine
POST_BUILD POST_BUILD
COMMAND COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/../dist/macdeploy.py ${PROJECT_BINARY_DIR}/clementine.app -f ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macdeploy.py ${PROJECT_BINARY_DIR}/clementine.app -f
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
) )
endif(USE_BUNDLE)
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/clementine.breakpad add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/clementine.breakpad
COMMAND COMMAND

View File

@ -39,7 +39,7 @@
#include <vector> #include <vector>
#include <QGLWidget> #include <QGLWidget>
#ifdef Q_WS_MACX #ifdef Q_OS_MACX
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#include <OpenGL/glu.h> #include <OpenGL/glu.h>
#else #else

View File

@ -27,6 +27,7 @@
#cmakedefine HAVE_BREAKPAD #cmakedefine HAVE_BREAKPAD
#cmakedefine HAVE_CRYPTOPP #cmakedefine HAVE_CRYPTOPP
#cmakedefine HAVE_DBUS #cmakedefine HAVE_DBUS
#cmakedefine HAVE_X11
#cmakedefine HAVE_DEVICEKIT #cmakedefine HAVE_DEVICEKIT
#cmakedefine HAVE_DROPBOX #cmakedefine HAVE_DROPBOX
#cmakedefine HAVE_GIO #cmakedefine HAVE_GIO
@ -44,9 +45,14 @@
#cmakedefine HAVE_SPOTIFY_DOWNLOADER #cmakedefine HAVE_SPOTIFY_DOWNLOADER
#cmakedefine HAVE_UDISKS2 #cmakedefine HAVE_UDISKS2
#cmakedefine HAVE_WIIMOTEDEV #cmakedefine HAVE_WIIMOTEDEV
#cmakedefine HAVE_TRANSLATIONS
#cmakedefine HAVE_SPOTIFY
#cmakedefine TAGLIB_HAS_OPUS #cmakedefine TAGLIB_HAS_OPUS
#cmakedefine USE_INSTALL_PREFIX #cmakedefine USE_INSTALL_PREFIX
#cmakedefine USE_SYSTEM_PROJECTM #cmakedefine USE_SYSTEM_PROJECTM
#cmakedefine USE_SYSTEM_SHA2 #cmakedefine USE_SYSTEM_SHA2
#cmakedefine USE_BUNDLE
#define USE_BUNDLE_DIR "${USE_BUNDLE_DIR}"
#endif // CONFIG_H_IN #endif // CONFIG_H_IN

View File

@ -19,6 +19,7 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include "globalshortcuts.h" #include "globalshortcuts.h"
#include "gnomeglobalshortcutbackend.h" #include "gnomeglobalshortcutbackend.h"
#include "macglobalshortcutbackend.h" #include "macglobalshortcutbackend.h"
@ -31,7 +32,7 @@
#include <QSignalMapper> #include <QSignalMapper>
#include <QtDebug> #include <QtDebug>
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
#include <QtDBus> #include <QtDBus>
#endif #endif
@ -147,10 +148,10 @@ GlobalShortcuts::Shortcut GlobalShortcuts::AddShortcut(
} }
bool GlobalShortcuts::IsGsdAvailable() const { bool GlobalShortcuts::IsGsdAvailable() const {
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
return QDBusConnection::sessionBus().interface()->isServiceRegistered( return QDBusConnection::sessionBus().interface()->isServiceRegistered(
GnomeGlobalShortcutBackend::kGsdService); GnomeGlobalShortcutBackend::kGsdService);
#else // QT_DBUS_LIB #else // HAVE_DBUS
return false; return false;
#endif #endif
} }

View File

@ -17,13 +17,14 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include "gnomeglobalshortcutbackend.h" #include "gnomeglobalshortcutbackend.h"
#include "globalshortcuts.h" #include "globalshortcuts.h"
#include "core/closure.h" #include "core/closure.h"
#include "core/logging.h" #include "core/logging.h"
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
#include "dbus/gnomesettingsdaemon.h" #include <dbus/gnomesettingsdaemon.h>
#endif #endif
#include <QAction> #include <QAction>
@ -31,7 +32,7 @@
#include <QDateTime> #include <QDateTime>
#include <QtDebug> #include <QtDebug>
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
#include <QtDBus> #include <QtDBus>
#endif #endif
@ -48,7 +49,7 @@ GnomeGlobalShortcutBackend::GnomeGlobalShortcutBackend(GlobalShortcuts* parent)
is_connected_(false) {} is_connected_(false) {}
bool GnomeGlobalShortcutBackend::DoRegister() { bool GnomeGlobalShortcutBackend::DoRegister() {
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
qLog(Debug) << "registering"; qLog(Debug) << "registering";
// Check if the GSD service is available // Check if the GSD service is available
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered( if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(
@ -71,7 +72,7 @@ bool GnomeGlobalShortcutBackend::DoRegister() {
SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher); SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher);
return true; return true;
#else // QT_DBUS_LIB #else // HAVE_DBUS
qLog(Warning) << "dbus not available"; qLog(Warning) << "dbus not available";
return false; return false;
#endif #endif
@ -79,7 +80,7 @@ bool GnomeGlobalShortcutBackend::DoRegister() {
void GnomeGlobalShortcutBackend::RegisterFinished( void GnomeGlobalShortcutBackend::RegisterFinished(
QDBusPendingCallWatcher* watcher) { QDBusPendingCallWatcher* watcher) {
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
QDBusMessage reply = watcher->reply(); QDBusMessage reply = watcher->reply();
watcher->deleteLater(); watcher->deleteLater();
@ -94,12 +95,12 @@ void GnomeGlobalShortcutBackend::RegisterFinished(
is_connected_ = true; is_connected_ = true;
qLog(Debug) << "registered"; qLog(Debug) << "registered";
#endif // QT_DBUS_LIB #endif // HAVE_DBUS
} }
void GnomeGlobalShortcutBackend::DoUnregister() { void GnomeGlobalShortcutBackend::DoUnregister() {
qLog(Debug) << "unregister"; qLog(Debug) << "unregister";
#ifdef QT_DBUS_LIB #ifdef HAVE_DBUS
// Check if the GSD service is available // Check if the GSD service is available
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered( if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(
kGsdService)) kGsdService))

View File

@ -114,7 +114,6 @@ void RegisterMetaTypes() {
qRegisterMetaType<QFileInfo>("QFileInfo"); qRegisterMetaType<QFileInfo>("QFileInfo");
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
qDBusRegisterMetaType<QImage>();
qDBusRegisterMetaType<TrackMetadata>(); qDBusRegisterMetaType<TrackMetadata>();
qDBusRegisterMetaType<TrackIds>(); qDBusRegisterMetaType<TrackIds>();
qDBusRegisterMetaType<QList<QByteArray>>(); qDBusRegisterMetaType<QList<QByteArray>>();
@ -124,5 +123,8 @@ void RegisterMetaTypes() {
qDBusRegisterMetaType<InterfacesAndProperties>(); qDBusRegisterMetaType<InterfacesAndProperties>();
qDBusRegisterMetaType<ManagedObjectList>(); qDBusRegisterMetaType<ManagedObjectList>();
#ifdef HAVE_X11
qDBusRegisterMetaType<QImage>();
#endif
#endif #endif
} }

View File

@ -34,7 +34,9 @@
#include "core/tagreaderclient.h" #include "core/tagreaderclient.h"
#include "core/utilities.h" #include "core/utilities.h"
#include "internet/core/internetmodel.h" #include "internet/core/internetmodel.h"
#ifdef HAVE_SPOTIFY
# include "internet/spotify/spotifyservice.h" # include "internet/spotify/spotifyservice.h"
#endif
AlbumCoverLoader::AlbumCoverLoader(QObject* parent) AlbumCoverLoader::AlbumCoverLoader(QObject* parent)
: QObject(parent), : QObject(parent),
@ -176,7 +178,9 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage(
remote_tasks_.insert(reply, task); remote_tasks_.insert(reply, task);
return TryLoadResult(true, false, QImage()); 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 // HACK: we should add generic image URL handlers
SpotifyService* spotify = InternetModel::Service<SpotifyService>(); SpotifyService* spotify = InternetModel::Service<SpotifyService>();
@ -196,7 +200,9 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage(
QMetaObject::invokeMethod(spotify, "LoadImage", Qt::QueuedConnection, QMetaObject::invokeMethod(spotify, "LoadImage", Qt::QueuedConnection,
Q_ARG(QString, id)); Q_ARG(QString, id));
return TryLoadResult(true, false, QImage()); 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 // 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_); 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); image.isNull() ? task.options.default_output_image_ : image);
} }
#ifdef HAVE_SPOTIFY
void AlbumCoverLoader::SpotifyImageLoaded(const QString& id, void AlbumCoverLoader::SpotifyImageLoaded(const QString& id,
const QImage& image) { const QImage& image) {
if (!remote_spotify_tasks_.contains(id)) return; 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);
emit ImageLoaded(task.id, scaled, image); emit ImageLoaded(task.id, scaled, image);
} }
#endif
void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply* reply) { void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply* reply) {
reply->deleteLater(); reply->deleteLater();

View File

@ -21,6 +21,7 @@
#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 "core/song.h" #include "core/song.h"
@ -66,7 +67,9 @@ class AlbumCoverLoader : public QObject {
protected slots: protected slots:
void ProcessTasks(); void ProcessTasks();
void RemoteFetchFinished(QNetworkReply* reply); void RemoteFetchFinished(QNetworkReply* reply);
#ifdef HAVE_SPOTIFY
void SpotifyImageLoaded(const QString& url, const QImage& image); void SpotifyImageLoaded(const QString& url, const QImage& image);
#endif
protected: protected:
enum State { State_TryingManual, State_TryingAuto, }; enum State { State_TryingManual, State_TryingAuto, };

View File

@ -56,9 +56,7 @@ void DeviceItemDelegate::paint(QPainter* p, const QStyleOptionViewItem& opt,
} }
// Draw the background // Draw the background
const QStyleOptionViewItemV3* vopt = const QWidget* widget = opt.widget;
qstyleoption_cast<const QStyleOptionViewItemV3*>(&opt);
const QWidget* widget = vopt->widget;
QStyle* style = widget->style() ? widget->style() : QApplication::style(); QStyle* style = widget->style() ? widget->style() : QApplication::style();
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, p, widget); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, p, widget);

View File

@ -42,11 +42,12 @@
#include <libmtp.h> #include <libmtp.h>
#include <QtDebug>
#include <QMutex>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QUrl>
#include <QUrlQuery>
#include <QMutex>
#include <QtDebug>
#ifndef kUSBSerialNumberString #ifndef kUSBSerialNumberString
#define kUSBSerialNumberString "USB Serial Number" #define kUSBSerialNumberString "USB Serial Number"
@ -118,9 +119,9 @@ void MacDeviceLister::Init() {
for (int i = 0; i < num; ++i) { for (int i = 0; i < num; ++i) {
LIBMTP_device_entry_t device = devices[i]; LIBMTP_device_entry_t device = devices[i];
MTPDevice d; MTPDevice d;
d.vendor = QString::fromAscii(device.vendor); d.vendor = QString::fromLatin1(device.vendor);
d.vendor_id = device.vendor_id; 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.product_id = device.product_id;
d.quirks = device.device_flags; d.quirks = device.device_flags;
sMTPDeviceList << d; sMTPDeviceList << d;
@ -305,7 +306,7 @@ QString GetSerialForMTPDevice(io_object_t device) {
QString FindDeviceProperty(const QString& bsd_name, CFStringRef property) { QString FindDeviceProperty(const QString& bsd_name, CFStringRef property) {
ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault));
ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName( ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName(
kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData()));
ScopedIOObject device(DADiskCopyIOMedia(disk.get())); ScopedIOObject device(DADiskCopyIOMedia(disk.get()));
QString ret = GetUSBRegistryEntryString(device.get(), property); QString ret = GetUSBRegistryEntryString(device.get(), property);
@ -358,7 +359,7 @@ void MacDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) {
#ifdef HAVE_AUDIOCD #ifdef HAVE_AUDIOCD
if (kind && strcmp([kind UTF8String], kIOCDMediaClass) == 0) { if (kind && strcmp([kind UTF8String], kIOCDMediaClass) == 0) {
// CD inserted. // CD inserted.
QString bsd_name = QString::fromAscii(DADiskGetBSDName(disk)); QString bsd_name = QString::fromLatin1(DADiskGetBSDName(disk));
me->cd_devices_ << bsd_name; me->cd_devices_ << bsd_name;
emit me->DeviceAdded(bsd_name); emit me->DeviceAdded(bsd_name);
return; 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 // We cannot access the USB tree when the disk is removed but we still get
// the BSD disk name. // 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)) { if (me->cd_devices_.remove(bsd_name)) {
emit me->DeviceRemoved(bsd_name); emit me->DeviceRemoved(bsd_name);
return; return;
@ -579,7 +580,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
4, 256, &data); 4, 256, &data);
if (!ret || data.at(0) != 0x28) continue; 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. // Not quite.
continue; continue;
} }
@ -590,7 +591,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
continue; continue;
} }
if (QString::fromAscii(data.data() + 0x12, 3) != "MTP") { if (QString::fromLatin1(data.data() + 0x12, 3) != "MTP") {
// Not quite. // Not quite.
continue; continue;
} }
@ -671,7 +672,7 @@ QString MacDeviceLister::MakeFriendlyName(const QString& serial) {
IsCDDevice(serial) ? *cd_devices_.find(serial) : current_devices_[serial]; IsCDDevice(serial) ? *cd_devices_.find(serial) : current_devices_[serial];
ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault));
ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName( ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName(
kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData()));
if (IsCDDevice(serial)) { if (IsCDDevice(serial)) {
scoped_nsobject<NSDictionary> properties( scoped_nsobject<NSDictionary> properties(
@ -700,12 +701,14 @@ QList<QUrl> MacDeviceLister::MakeDeviceUrls(const QString& serial) {
const MTPDevice& device = mtp_devices_[serial]; const MTPDevice& device = mtp_devices_[serial];
QString str; QString str;
str.sprintf("gphoto2://usb-%d-%d/", device.bus, device.address); 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); QUrl url(str);
url.addQueryItem("vendor", device.vendor); url.setQuery(url_query);
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));
return QList<QUrl>() << url; return QList<QUrl>() << url;
} }
@ -716,7 +719,7 @@ QList<QUrl> MacDeviceLister::MakeDeviceUrls(const QString& serial) {
QString bsd_name = current_devices_[serial]; QString bsd_name = current_devices_[serial];
ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault));
ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName( ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName(
kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData()));
scoped_nsobject<NSDictionary> properties( scoped_nsobject<NSDictionary> properties(
(NSDictionary*)DADiskCopyDescription(disk.get())); (NSDictionary*)DADiskCopyDescription(disk.get()));
@ -745,7 +748,7 @@ QVariantList MacDeviceLister::DeviceIcons(const QString& serial) {
QString bsd_name = current_devices_[serial]; QString bsd_name = current_devices_[serial];
ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault));
ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName( ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName(
kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData()));
ScopedIOObject device(DADiskCopyIOMedia(disk.get())); ScopedIOObject device(DADiskCopyIOMedia(disk.get()));
QString icon = GetIconForDevice(device.get()); QString icon = GetIconForDevice(device.get());
@ -788,7 +791,7 @@ quint64 MacDeviceLister::DeviceCapacity(const QString& serial) {
QString bsd_name = current_devices_[serial]; QString bsd_name = current_devices_[serial];
ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault));
ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName( ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName(
kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData()));
io_object_t device = DADiskCopyIOMedia(disk); io_object_t device = DADiskCopyIOMedia(disk);
@ -809,7 +812,7 @@ quint64 MacDeviceLister::DeviceFreeSpace(const QString& serial) {
QString bsd_name = current_devices_[serial]; QString bsd_name = current_devices_[serial];
ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef<DASessionRef> session(DASessionCreate(kCFAllocatorDefault));
ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName( ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName(
kCFAllocatorDefault, session.get(), bsd_name.toAscii().constData())); kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData()));
scoped_nsobject<NSDictionary> properties( scoped_nsobject<NSDictionary> properties(
(NSDictionary*)DADiskCopyDescription(disk)); (NSDictionary*)DADiskCopyDescription(disk));
@ -840,7 +843,7 @@ void MacDeviceLister::UnmountDevice(const QString& serial) {
QString bsd_name = current_devices_[serial]; QString bsd_name = current_devices_[serial];
ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName( ScopedCFTypeRef<DADiskRef> disk(DADiskCreateFromBSDName(
kCFAllocatorDefault, loop_session_, bsd_name.toAscii().constData())); kCFAllocatorDefault, loop_session_, bsd_name.toLatin1().constData()));
DADiskUnmount(disk, kDADiskUnmountOptionDefault, &DiskUnmountCallback, this); DADiskUnmount(disk, kDADiskUnmountOptionDefault, &DiskUnmountCallback, this);
} }

View File

@ -15,6 +15,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include <limits> #include <limits>
#include <QCoreApplication> #include <QCoreApplication>
@ -33,8 +35,10 @@
#include "core/signalchecker.h" #include "core/signalchecker.h"
#include "core/utilities.h" #include "core/utilities.h"
#include "internet/core/internetmodel.h" #include "internet/core/internetmodel.h"
#ifdef HAVE_SPOTIFY
# include "internet/spotify/spotifyserver.h" # include "internet/spotify/spotifyserver.h"
# include "internet/spotify/spotifyservice.h" # include "internet/spotify/spotifyservice.h"
#endif
const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000; const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000;
const int GstEnginePipeline::kFaderFudgeMsec = 2000; const int GstEnginePipeline::kFaderFudgeMsec = 2000;
@ -151,6 +155,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(GstElement* new_bin) {
bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
GstElement* new_bin = nullptr; GstElement* new_bin = nullptr;
#ifdef HAVE_SPOTIFY
if (url.scheme() == "spotify") { if (url.scheme() == "spotify") {
new_bin = gst_bin_new("spotify_bin"); new_bin = gst_bin_new("spotify_bin");
@ -181,6 +186,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
spotify_server, "StartPlayback", Qt::QueuedConnection, spotify_server, "StartPlayback", Qt::QueuedConnection,
Q_ARG(QString, url.toString()), Q_ARG(quint16, port)); Q_ARG(QString, url.toString()), Q_ARG(quint16, port));
} else { } else {
#endif
QByteArray uri; QByteArray uri;
if (url.scheme() == "cdda") { if (url.scheme() == "cdda") {
QString str = url.toString(); 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), "pad-added", &NewPadCallback, this);
CHECKED_GCONNECT(G_OBJECT(new_bin), "notify::source", &SourceSetupCallback, CHECKED_GCONNECT(G_OBJECT(new_bin), "notify::source", &SourceSetupCallback,
this); this);
#ifdef HAVE_SPOTIFY
} }
#endif
return ReplaceDecodeBin(new_bin); return ReplaceDecodeBin(new_bin);
} }
@ -1050,6 +1058,7 @@ GstState GstEnginePipeline::state() const {
} }
QFuture<GstStateChangeReturn> GstEnginePipeline::SetState(GstState state) { QFuture<GstStateChangeReturn> GstEnginePipeline::SetState(GstState state) {
#ifdef HAVE_SPOTIFY
if (url_.scheme() == "spotify" && !buffering_) { if (url_.scheme() == "spotify" && !buffering_) {
const GstState current_state = this->state(); const GstState current_state = this->state();
@ -1068,6 +1077,7 @@ QFuture<GstStateChangeReturn> GstEnginePipeline::SetState(GstState state) {
Q_ARG(bool, false)); Q_ARG(bool, false));
} }
} }
#endif
return ConcurrentRun::Run<GstStateChangeReturn, GstElement*, GstState>( return ConcurrentRun::Run<GstStateChangeReturn, GstElement*, GstState>(
&set_state_threadpool_, &gst_element_set_state, pipeline_, state); &set_state_threadpool_, &gst_element_set_state, pipeline_, state);
} }

View File

@ -41,7 +41,6 @@
#include "internet/magnatune/magnatuneservice.h" #include "internet/magnatune/magnatuneservice.h"
#include "internet/podcasts/podcastservice.h" #include "internet/podcasts/podcastservice.h"
#include "internet/somafm/somafmservice.h" #include "internet/somafm/somafmservice.h"
#include "internet/spotify/spotifyservice.h"
#include "internet/subsonic/subsonicservice.h" #include "internet/subsonic/subsonicservice.h"
#include "smartplaylists/generatormimedata.h" #include "smartplaylists/generatormimedata.h"
@ -60,6 +59,9 @@
#ifdef HAVE_SEAFILE #ifdef HAVE_SEAFILE
#include "internet/seafile/seafileservice.h" #include "internet/seafile/seafileservice.h"
#endif #endif
#ifdef HAVE_SPOTIFY
#include "internet/spotify/spotifyservice.h"
#endif
using smart_playlists::Generator; using smart_playlists::Generator;
using smart_playlists::GeneratorMimeData; using smart_playlists::GeneratorMimeData;
@ -92,7 +94,9 @@ InternetModel::InternetModel(Application* app, QObject* parent)
AddService(new RadioTunesService(app, this)); AddService(new RadioTunesService(app, this));
AddService(new SomaFMService(app, this)); AddService(new SomaFMService(app, this));
AddService(new IntergalacticFMService(app, this)); AddService(new IntergalacticFMService(app, this));
#ifdef HAVE_SPOTIFY
AddService(new SpotifyService(app, this)); AddService(new SpotifyService(app, this));
#endif
AddService(new SubsonicService(app, this)); AddService(new SubsonicService(app, this));
#ifdef HAVE_BOX #ifdef HAVE_BOX
AddService(new BoxService(app, this)); AddService(new BoxService(app, this));

View File

@ -90,9 +90,9 @@ SpotifyService::SpotifyService(Application* app, InternetModel* parent)
// Build the search path for the binary blob. // Build the search path for the binary blob.
// Look for one distributed alongside clementine first, then check in the // Look for one distributed alongside clementine first, then check in the
// user's home directory for any that have been downloaded. // 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() + system_blob_path_ = QCoreApplication::applicationDirPath() +
"/../PlugIns/clementine-spotifyblob"; "/" + USE_BUNDLE_DIR + "/clementine-spotifyblob";
#else #else
system_blob_path_ = QCoreApplication::applicationDirPath() + system_blob_path_ = QCoreApplication::applicationDirPath() +
"/clementine-spotifyblob" CMAKE_EXECUTABLE_SUFFIX; "/clementine-spotifyblob" CMAKE_EXECUTABLE_SUFFIX;

View File

@ -20,7 +20,9 @@
#include <QtGlobal> #include <QtGlobal>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
# ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0600 # define _WIN32_WINNT 0x0600
# endif
# include <windows.h> # include <windows.h>
# include <iostream> # include <iostream>
#endif // Q_OS_WIN32 #endif // Q_OS_WIN32
@ -95,7 +97,7 @@ const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image);
#endif #endif
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
#include <qtsparkle/Updater> #include <qtsparkle-qt5/Updater>
#endif #endif
// Load sqlite plugin on windows and mac. // Load sqlite plugin on windows and mac.
@ -151,14 +153,16 @@ void SetGstreamerEnvironment() {
QString registry_filename; QString registry_filename;
// On windows and mac we bundle the gstreamer plugins with clementine // On windows and mac we bundle the gstreamer plugins with clementine
#ifdef USE_BUNDLE
#if defined(Q_OS_DARWIN) #if defined(Q_OS_DARWIN)
scanner_path = scanner_path =
QCoreApplication::applicationDirPath() + "/../PlugIns/gst-plugin-scanner"; QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gst-plugin-scanner";
plugin_path = plugin_path =
QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer"; QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gstreamer";
#elif defined(Q_OS_WIN32) #elif defined(Q_OS_WIN32)
plugin_path = QCoreApplication::applicationDirPath() + "/gstreamer-plugins"; plugin_path = QCoreApplication::applicationDirPath() + "/gstreamer-plugins";
#endif #endif
#endif
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) #if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
registry_filename = registry_filename =
@ -177,9 +181,9 @@ void SetGstreamerEnvironment() {
SetEnv("GST_REGISTRY", registry_filename); SetEnv("GST_REGISTRY", registry_filename);
} }
#ifdef Q_OS_DARWIN #if defined(Q_OS_DARWIN) && defined(USE_BUNDLE)
SetEnv("GIO_EXTRA_MODULES", SetEnv("GIO_EXTRA_MODULES",
QCoreApplication::applicationDirPath() + "/../PlugIns/gio-modules"); QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gio-modules");
#endif #endif
SetEnv("PULSE_PROP_media.role", "music"); SetEnv("PULSE_PROP_media.role", "music");
@ -339,9 +343,10 @@ int main(int argc, char* argv[]) {
.toInt()); .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( QCoreApplication::setLibraryPaths(
QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns"); QStringList() << QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR);
#endif #endif
a.setQuitOnLastWindowClosed(false); a.setQuitOnLastWindowClosed(false);
@ -381,7 +386,9 @@ int main(int argc, char* argv[]) {
// Resources // Resources
Q_INIT_RESOURCE(data); Q_INIT_RESOURCE(data);
#ifdef HAVE_TRANSLATIONS
Q_INIT_RESOURCE(translations); Q_INIT_RESOURCE(translations);
#endif
// Add root CA cert for SoundCloud, whose certificate is missing on OS X. // Add root CA cert for SoundCloud, whose certificate is missing on OS X.
QSslSocket::addDefaultCaCertificates( QSslSocket::addDefaultCaCertificates(

View File

@ -29,6 +29,10 @@
#include "core/logging.h" #include "core/logging.h"
#include "core/signalchecker.h" #include "core/signalchecker.h"
#ifndef u_int32_t
typedef unsigned int u_int32_t;
#endif
static const int kDecodeRate = 11025; static const int kDecodeRate = 11025;
static const int kDecodeChannels = 1; static const int kDecodeChannels = 1;
static const int kPlayLengthSecs = 30; static const int kPlayLengthSecs = 30;

View File

@ -182,7 +182,7 @@ void PlaylistDelegateBase::paint(QPainter* painter,
} }
} }
QStyleOptionViewItemV4 PlaylistDelegateBase::Adjusted( QStyleOptionViewItem PlaylistDelegateBase::Adjusted(
const QStyleOptionViewItem& option, const QModelIndex& index) const { const QStyleOptionViewItem& option, const QModelIndex& index) const {
if (!view_) return option; if (!view_) return option;
@ -192,7 +192,7 @@ QStyleOptionViewItemV4 PlaylistDelegateBase::Adjusted(
if (view_->header()->logicalIndexAt(top_left) != index.column()) if (view_->header()->logicalIndexAt(top_left) != index.column())
return option; return option;
QStyleOptionViewItemV4 ret(option); QStyleOptionViewItem ret(option);
if (index.data(Playlist::Role_IsCurrent).toBool()) { if (index.data(Playlist::Role_IsCurrent).toBool()) {
// Move the text in a bit on the first column for the song that's currently // 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 QStyleOptionViewItem& option,
const QModelIndex& index) const { const QModelIndex& index) const {
// Draw the background // Draw the background
const QStyleOptionViewItemV3* vopt = option.widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option,
qstyleoption_cast<const QStyleOptionViewItemV3*>(&option); painter, option.widget);
vopt->widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, vopt,
painter, vopt->widget);
// Don't draw anything else if the user can't set the rating of this item // Don't draw anything else if the user can't set the rating of this item
if (!index.data(Playlist::Role_CanSetRating).toBool()) return; if (!index.data(Playlist::Role_CanSetRating).toBool()) return;

View File

@ -63,7 +63,7 @@ class PlaylistDelegateBase : public QueuedItemDelegate {
QSize sizeHint(const QStyleOptionViewItem& option, QSize sizeHint(const QStyleOptionViewItem& option,
const QModelIndex& index) const; const QModelIndex& index) const;
QStyleOptionViewItemV4 Adjusted(const QStyleOptionViewItem& option, QStyleOptionViewItem Adjusted(const QStyleOptionViewItem& option,
const QModelIndex& index) const; const QModelIndex& index) const;
static const int kMinHeight; static const int kMinHeight;

View File

@ -466,7 +466,7 @@ void PlaylistView::drawTree(QPainter* painter, const QRegion& region) const {
void PlaylistView::drawRow(QPainter* painter, void PlaylistView::drawRow(QPainter* painter,
const QStyleOptionViewItem& option, const QStyleOptionViewItem& option,
const QModelIndex& index) const { const QModelIndex& index) const {
QStyleOptionViewItemV4 opt(option); QStyleOptionViewItem opt(option);
bool is_current = index.data(Playlist::Role_IsCurrent).toBool(); bool is_current = index.data(Playlist::Role_IsCurrent).toBool();
bool is_paused = index.data(Playlist::Role_IsPaused).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) { const QModelIndex& index) {
cached_current_row_rect_ = option.rect; cached_current_row_rect_ = option.rect;
cached_current_row_row_ = index.row(); cached_current_row_row_ = index.row();

View File

@ -164,7 +164,7 @@ signals:
private: private:
void ReloadBarPixmaps(); void ReloadBarPixmaps();
QList<QPixmap> LoadBarPixmap(const QString& filename); QList<QPixmap> LoadBarPixmap(const QString& filename);
void UpdateCachedCurrentRowPixmap(QStyleOptionViewItemV4 option, void UpdateCachedCurrentRowPixmap(QStyleOptionViewItem option,
const QModelIndex& index); const QModelIndex& index);
void set_background_image_type(BackgroundImageType bg) { void set_background_image_type(BackgroundImageType bg) {

View File

@ -20,12 +20,16 @@
#include "songinfo/artistbiography.h" #include "songinfo/artistbiography.h"
#include "songinfo/songinfofetcher.h" #include "songinfo/songinfofetcher.h"
#include "songinfo/songkickconcerts.h" #include "songinfo/songkickconcerts.h"
#include "songinfo/spotifyimages.h"
#include "widgets/prettyimageview.h" #include "widgets/prettyimageview.h"
#ifdef HAVE_SPOTIFY
#include "songinfo/spotifyimages.h"
#endif
ArtistInfoView::ArtistInfoView(QWidget* parent) : SongInfoBase(parent) { ArtistInfoView::ArtistInfoView(QWidget* parent) : SongInfoBase(parent) {
fetcher_->AddProvider(new SongkickConcerts); fetcher_->AddProvider(new SongkickConcerts);
#ifdef HAVE_SPOTIFY
fetcher_->AddProvider(new SpotifyImages); fetcher_->AddProvider(new SpotifyImages);
#endif
fetcher_->AddProvider(new ArtistBiography); fetcher_->AddProvider(new ArtistBiography);
} }

View File

@ -39,7 +39,7 @@
#include <QtDebug> #include <QtDebug>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
#include <qtsparkle/Updater> #include <qtsparkle-qt5/Updater>
#endif #endif
#include "core/appearance.h" #include "core/appearance.h"

View File

@ -34,7 +34,6 @@
#include "internet/digitally/digitallyimportedsettingspage.h" #include "internet/digitally/digitallyimportedsettingspage.h"
#include "internet/magnatune/magnatunesettingspage.h" #include "internet/magnatune/magnatunesettingspage.h"
#include "internet/podcasts/podcastsettingspage.h" #include "internet/podcasts/podcastsettingspage.h"
#include "internet/spotify/spotifysettingspage.h"
#include "internet/subsonic/subsonicsettingspage.h" #include "internet/subsonic/subsonicsettingspage.h"
#include "library/librarysettingspage.h" #include "library/librarysettingspage.h"
#include "mainwindow.h" #include "mainwindow.h"
@ -78,6 +77,10 @@
#include "internet/seafile/seafilesettingspage.h" #include "internet/seafile/seafilesettingspage.h"
#endif #endif
#ifdef HAVE_SPOTIFY
#include "internet/spotify/spotifysettingspage.h"
#endif
#include <QAbstractButton> #include <QAbstractButton>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QPainter> #include <QPainter>
@ -174,7 +177,9 @@ SettingsDialog::SettingsDialog(Application* app, BackgroundStreams* streams,
AddPage(Page_Skydrive, new SkydriveSettingsPage(this), providers); AddPage(Page_Skydrive, new SkydriveSettingsPage(this), providers);
#endif #endif
#ifdef HAVE_SPOTIFY
AddPage(Page_Spotify, new SpotifySettingsPage(this), providers); AddPage(Page_Spotify, new SpotifySettingsPage(this), providers);
#endif
#ifdef HAVE_SEAFILE #ifdef HAVE_SEAFILE
AddPage(Page_Seafile, new SeafileSettingsPage(this), providers); AddPage(Page_Seafile, new SeafileSettingsPage(this), providers);

View File

@ -22,7 +22,9 @@
#include <QtDebug> #include <QtDebug>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
# ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0600 # define _WIN32_WINNT 0x0600
# endif
# include <windows.h> # include <windows.h>
# include <commctrl.h> # include <commctrl.h>
# include <shobjidl.h> # include <shobjidl.h>

View File

@ -214,8 +214,8 @@ void GroupedIconView::paintEvent(QPaintEvent* e) {
// This code was adapted from QListView::paintEvent(), changed to use the // This code was adapted from QListView::paintEvent(), changed to use the
// visualRect() of items, and to draw headers. // visualRect() of items, and to draw headers.
QStyleOptionViewItemV4 option(viewOptions()); QStyleOptionViewItem option(viewOptions());
if (isWrapping()) option.features = QStyleOptionViewItemV2::WrapText; if (isWrapping()) option.features = QStyleOptionViewItem::WrapText;
option.locale = locale(); option.locale = locale();
option.locale.setNumberOptions(QLocale::OmitGroupSeparator); option.locale.setNumberOptions(QLocale::OmitGroupSeparator);
option.widget = this; option.widget = this;

View File

@ -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*) {} void OSD::CallFinished(QDBusPendingCallWatcher*) {}
#endif #endif
#ifdef HAVE_WIIMOTEDEV
void OSD::WiiremoteActived(int id) { void OSD::WiiremoteActived(int id) {
ShowMessage(QString(tr("%1: Wiimotedev module")) ShowMessage(QString(tr("%1: Wiimotedev module"))
.arg(QCoreApplication::applicationName()), .arg(QCoreApplication::applicationName()),
@ -277,8 +275,6 @@ void OSD::WiiremoteCriticalBattery(int id, int live) {
.arg(QString::number(id), QString::number(live))); .arg(QString::number(id), QString::number(live)));
} }
#endif
void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) { void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) {
if (show_on_play_mode_change_) { if (show_on_play_mode_change_) {
QString current_mode = QString(); QString current_mode = QString();

View File

@ -38,6 +38,7 @@ class QDBusPendingCallWatcher;
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
#include <QDBusArgument> #include <QDBusArgument>
#include <QDBusPendingCall>
QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image); QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image);
const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image); const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image);
@ -81,14 +82,12 @@ class OSD : public QObject {
void ReshowCurrentSong(); void ReshowCurrentSong();
#ifdef HAVE_WIIMOTEDEV
void WiiremoteActived(int id); void WiiremoteActived(int id);
void WiiremoteDeactived(int id); void WiiremoteDeactived(int id);
void WiiremoteConnected(int id); void WiiremoteConnected(int id);
void WiiremoteDisconnected(int id); void WiiremoteDisconnected(int id);
void WiiremoteLowBattery(int id, int live); void WiiremoteLowBattery(int id, int live);
void WiiremoteCriticalBattery(int id, int live); void WiiremoteCriticalBattery(int id, int live);
#endif
void ShowPreview(const Behaviour type, const QString& line1, void ShowPreview(const Behaviour type, const QString& line1,
const QString& line2, const Song& song); const QString& line2, const Song& song);
@ -106,7 +105,9 @@ class OSD : public QObject {
QString ReplaceVariable(const QString& variable, const Song& song); QString ReplaceVariable(const QString& variable, const Song& song);
private slots: private slots:
#if defined(HAVE_DBUS)
void CallFinished(QDBusPendingCallWatcher* watcher); void CallFinished(QDBusPendingCallWatcher* watcher);
#endif
void AlbumArtLoaded(const Song& song, const QString& uri, void AlbumArtLoaded(const Song& song, const QString& uri,
const QImage& image); const QImage& image);

View File

@ -15,6 +15,7 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>. along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include "osdpretty.h" #include "osdpretty.h"
#include "ui_osdpretty.h" #include "ui_osdpretty.h"
@ -31,12 +32,14 @@
#include <QtDebug> #include <QtDebug>
#ifdef Q_WS_X11 #ifdef HAVE_X11
#include <QX11Info> #include <QX11Info>
#endif #endif
#ifdef Q_OS_WIN32
# include <QtWin>
#endif
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
#include "qtwin.h"
#include <windows.h> #include <windows.h>
#endif #endif
@ -137,7 +140,7 @@ OSDPretty::OSDPretty(Mode mode, QWidget* parent)
OSDPretty::~OSDPretty() { delete ui_; } OSDPretty::~OSDPretty() { delete ui_; }
bool OSDPretty::IsTransparencyAvailable() { bool OSDPretty::IsTransparencyAvailable() {
#ifdef Q_WS_X11 #if defined(HAVE_X11) && (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
return QX11Info::isCompositingManagerRunning(); return QX11Info::isCompositingManagerRunning();
#endif #endif
return true; return true;
@ -346,7 +349,7 @@ void OSDPretty::Reposition() {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
// On windows, enable blurbehind on the masked area // On windows, enable blurbehind on the masked area
QtWin::enableBlurBehindWindow(this, true, QRegion(mask)); QtWin::enableBlurBehindWindow(this, QRegion(mask));
#endif #endif
} }

View File

@ -23,7 +23,7 @@
#include "metatypes_env.h" #include "metatypes_env.h"
#include "resources_env.h" #include "resources_env.h"
#ifndef Q_WS_X11 #if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
# include <QtPlugin> # include <QtPlugin>
Q_IMPORT_PLUGIN(QSQLiteDriverPlugin) Q_IMPORT_PLUGIN(QSQLiteDriverPlugin)
#endif #endif