1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-02-05 03:47:51 +01:00

Remove builtin qtwin and use WinExtras, replace some macros

This commit is contained in:
Jonas Kvinge 2018-09-15 13:07:51 +02:00
parent 072facdf7b
commit 6563bec7e4
16 changed files with 50 additions and 319 deletions

View File

@ -27,3 +27,5 @@ ADD_LIBRARY(qtsingleapplication STATIC
) )
target_link_libraries(qtsingleapplication Qt5::Core Qt5::Widgets Qt5::Network) target_link_libraries(qtsingleapplication Qt5::Core Qt5::Widgets Qt5::Network)
include_directories(${CMAKE_BINARY_DIR}/src)

View File

@ -45,7 +45,7 @@
#include <QVector> #include <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)

View File

@ -37,6 +37,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "config.h"
#include "qtsingleapplication.h" #include "qtsingleapplication.h"
@ -44,6 +45,10 @@
#include <QWidget> #include <QWidget>
#include <QString> #include <QString>
#ifdef HAVE_X11_ // FIXME
# include <X11/Xlib.h>
#endif
#include "qtlocalpeer.h" #include "qtlocalpeer.h"
/*! /*!
@ -173,14 +178,14 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char *
} }
#if defined(Q_WS_X11) #if defined(HAVE_X11_) // FIXME
/*! /*!
Special constructor for X11, ref. the documentation of Special constructor for X11, ref. the documentation of
QApplication's corresponding constructor. The application identifier QApplication's corresponding constructor. The application identifier
will be QCoreApplication::applicationFilePath(). \a dpy, \a visual, will be QCoreApplication::applicationFilePath(). \a dpy, \a visual,
and \a cmap are passed on to the QApplication constructor. and \a cmap are passed on to the QApplication constructor.
*/ */
QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap) QtSingleApplication::QtSingleApplication(Display *dpy, Qt::HANDLE visual, Qt::HANDLE cmap)
: QApplication(dpy, visual, cmap) : QApplication(dpy, visual, cmap)
{ {
sysInit(); sysInit();
@ -206,7 +211,7 @@ QtSingleApplication::QtSingleApplication(Display *dpy, int &argc, char **argv, Q
argv, \a visual, and \a cmap are passed on to the QApplication argv, \a visual, and \a cmap are passed on to the QApplication
constructor. constructor.
*/ */
QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap) QtSingleApplication::QtSingleApplication(Display *dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap)
: QApplication(dpy, argc, argv, visual, cmap) : QApplication(dpy, argc, argv, visual, cmap)
{ {
sysInit(appId); sysInit(appId);

View File

@ -40,14 +40,21 @@
#ifndef QTSINGLEAPPLICATION_H #ifndef QTSINGLEAPPLICATION_H
#define QTSINGLEAPPLICATION_H #define QTSINGLEAPPLICATION_H
#include "config.h"
#include <QtGlobal> #include <QtGlobal>
#include <QObject> #include <QObject>
#include <QWidget> #include <QWidget>
#include <QApplication> #include <QApplication>
#include <QString> #include <QString>
#if defined(HAVE_X11_) // FIXME
# include <X11/Xlib.h>
#endif
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)
@ -70,10 +77,10 @@ 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) #if defined(HAVE_X11_) // FIXME
QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); 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, 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); QtSingleApplication(Display *dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
#endif #endif
bool isRunning(); bool isRunning();

View File

@ -40,6 +40,8 @@
#ifndef QTSINGLECOREAPPLICATION_H #ifndef QTSINGLECOREAPPLICATION_H
#define QTSINGLECOREAPPLICATION_H #define QTSINGLECOREAPPLICATION_H
#include "config.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QObject> #include <QObject>
#include <QString> #include <QString>

View File

@ -1,14 +0,0 @@
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_STANDARD 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::toLatin1("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::toLatin1("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::toLatin1("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

@ -38,36 +38,36 @@
#include "qxtglobalshortcut_p.h" #include "qxtglobalshortcut_p.h"
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

@ -137,6 +137,9 @@ endif()
if(APPLE) if(APPLE)
find_package(Qt5 REQUIRED COMPONENTS MacExtras) find_package(Qt5 REQUIRED COMPONENTS MacExtras)
endif() endif()
if(WIN32)
find_package(Qt5 REQUIRED COMPONENTS WinExtras)
endif()
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml) set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml)
@ -149,11 +152,9 @@ endif()
if(APPLE) if(APPLE)
set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::MacExtras) set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::MacExtras)
endif() endif()
if(WIN32)
# Don't try to use webkit if their include directories couldn't be found. set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::WinExtras)
if (NOT QT_QTWEBKIT_INCLUDE_DIR) endif()
set (QT_USE_QTWEBKIT 0)
endif (NOT QT_QTWEBKIT_INCLUDE_DIR)
# TAGLIB # TAGLIB
pkg_check_modules(TAGLIB taglib) pkg_check_modules(TAGLIB taglib)
@ -243,11 +244,6 @@ endif (USE_SYSTEM_QXT)
set(QOCOA_LIBRARIES Qocoa) set(QOCOA_LIBRARIES Qocoa)
add_subdirectory(3rdparty/qocoa) add_subdirectory(3rdparty/qocoa)
# Windows
if (WIN32)
add_subdirectory(3rdparty/qtwin)
endif (WIN32)
if (APPLE) if (APPLE)
find_library(SPARKLE Sparkle) find_library(SPARKLE Sparkle)
add_subdirectory(3rdparty/SPMediaKeyTap) add_subdirectory(3rdparty/SPMediaKeyTap)

View File

@ -155,6 +155,7 @@ Section "Strawberry" Strawberry
File "Qt5Sql.dll" File "Qt5Sql.dll"
File "Qt5Widgets.dll" File "Qt5Widgets.dll"
File "Qt5Xml.dll" File "Qt5Xml.dll"
File "Qt5WinExtras.dll"
File "zlib1.dll" File "zlib1.dll"
File "libxine-2.dll" File "libxine-2.dll"
File "libmpcdec-5.dll" File "libmpcdec-5.dll"
@ -396,6 +397,7 @@ Section "Uninstall"
Delete "$INSTDIR\Qt5Sql.dll" Delete "$INSTDIR\Qt5Sql.dll"
Delete "$INSTDIR\Qt5Widgets.dll" Delete "$INSTDIR\Qt5Widgets.dll"
Delete "$INSTDIR\Qt5Xml.dll" Delete "$INSTDIR\Qt5Xml.dll"
Delete "$INSTDIR\Qt5WinExtras.dll"
Delete "$INSTDIR\zlib1.dll" Delete "$INSTDIR\zlib1.dll"
Delete "$INSTDIR\libxine-2.dll" Delete "$INSTDIR\libxine-2.dll"
Delete "$INSTDIR\libmpcdec-5.dll" Delete "$INSTDIR\libmpcdec-5.dll"

View File

@ -155,6 +155,7 @@ Section "Strawberry" Strawberry
File "Qt5Sql.dll" File "Qt5Sql.dll"
File "Qt5Widgets.dll" File "Qt5Widgets.dll"
File "Qt5Xml.dll" File "Qt5Xml.dll"
File "Qt5WinExtras.dll"
File "zlib1.dll" File "zlib1.dll"
;File "libmpcdec-5.dll" ;File "libmpcdec-5.dll"
;File "libtheora-0.dll" ;File "libtheora-0.dll"
@ -364,6 +365,7 @@ Section "Uninstall"
Delete "$INSTDIR\Qt5Sql.dll" Delete "$INSTDIR\Qt5Sql.dll"
Delete "$INSTDIR\Qt5Widgets.dll" Delete "$INSTDIR\Qt5Widgets.dll"
Delete "$INSTDIR\Qt5Xml.dll" Delete "$INSTDIR\Qt5Xml.dll"
Delete "$INSTDIR\Qt5WinExtras.dll"
Delete "$INSTDIR\zlib1.dll" Delete "$INSTDIR\zlib1.dll"
;Delete "$INSTDIR\libmpcdec-5.dll" ;Delete "$INSTDIR\libmpcdec-5.dll"
;Delete "$INSTDIR\libtheora-0.dll" ;Delete "$INSTDIR\libtheora-0.dll"

View File

@ -74,11 +74,6 @@ include_directories(${CMAKE_SOURCE_DIR}/ext/libstrawberry-common)
include_directories(${CMAKE_SOURCE_DIR}/ext/libstrawberry-tagreader) include_directories(${CMAKE_SOURCE_DIR}/ext/libstrawberry-tagreader)
include_directories(${CMAKE_BINARY_DIR}/ext/libstrawberry-tagreader) include_directories(${CMAKE_BINARY_DIR}/ext/libstrawberry-tagreader)
# Windows
if (WIN32)
include_directories(../3rdparty/qtwin)
endif (WIN32)
set(SOURCES set(SOURCES
core/mainwindow.cpp core/mainwindow.cpp
core/application.cpp core/application.cpp
@ -965,7 +960,6 @@ endif (APPLE)
if (WIN32) if (WIN32)
target_link_libraries(strawberry_lib target_link_libraries(strawberry_lib
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
qtwin
dsound dsound
${QT_QTGUI_LIBRARY} ${QT_QTGUI_LIBRARY}
) )

View File

@ -217,7 +217,7 @@ void QtSystemTrayIcon::SetVisible(bool visible) {
void QtSystemTrayIcon::SetNowPlaying(const Song &song, const QString &image_path) { void QtSystemTrayIcon::SetNowPlaying(const Song &song, const QString &image_path) {
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
// Windows doesn't support HTML in tooltips, so just show something basic // Windows doesn't support HTML in tooltips, so just show something basic
tray_->setToolTip(song.PrettyTitleWithArtist()); tray_->setToolTip(song.PrettyTitleWithArtist());
return; return;

View File

@ -49,15 +49,17 @@
#include <QSettings> #include <QSettings>
#include <QFlags> #include <QFlags>
#include <QtEvents> #include <QtEvents>
#ifdef Q_WS_X11 #ifdef HAVE_X11
# include <QX11Info> # include <QX11Info>
#endif #endif
#ifdef Q_OS_WIN
# include <QtWin>
#endif
#include "osdpretty.h" #include "osdpretty.h"
#include "ui_osdpretty.h" #include "ui_osdpretty.h"
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
# include "qtwin.h"
# include <windows.h> # include <windows.h>
#endif #endif
@ -160,7 +162,7 @@ OSDPretty::~OSDPretty() {
} }
bool OSDPretty::IsTransparencyAvailable() { bool OSDPretty::IsTransparencyAvailable() {
#ifdef Q_WS_X11 #ifdef HAVE_X11
return QX11Info::isCompositingManagerRunning(); return QX11Info::isCompositingManagerRunning();
#endif #endif
return true; return true;
@ -366,7 +368,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
} }