Fix cross build for windows.
This commit is contained in:
parent
1817127a90
commit
6bbc1271e4
15
3rdparty/qtsingleapplication/qtlocalpeer.cpp
vendored
15
3rdparty/qtsingleapplication/qtlocalpeer.cpp
vendored
@ -54,14 +54,12 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0;
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
namespace QtLP_Private {
|
||||
#include "qtlockedfile.cpp"
|
||||
#if defined(Q_OS_WIN)
|
||||
#include "qtlockedfile_win.cpp"
|
||||
#else
|
||||
#include "qtlockedfile_unix.cpp"
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* QtLocalPeer::ack = "ack";
|
||||
|
||||
@ -81,8 +79,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
||||
|
||||
QByteArray idc = id.toUtf8();
|
||||
quint16 idNum = qChecksum(idc.constData(), idc.size());
|
||||
socketName = QLatin1String("qtsingleapp-") + prefix
|
||||
+ QLatin1Char('-') + QString::number(idNum, 16);
|
||||
socketName = QLatin1String("qtsingleapp-") + prefix + QLatin1Char('-') + QString::number(idNum, 16);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
if (!pProcessIdToSessionId) {
|
||||
@ -99,9 +96,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
||||
#endif
|
||||
|
||||
server = new QLocalServer(this);
|
||||
QString lockName = QDir(QDir::tempPath()).absolutePath()
|
||||
+ QLatin1Char('/') + socketName
|
||||
+ QLatin1String("-lockfile");
|
||||
QString lockName = QDir(QDir::tempPath()).absolutePath() + QLatin1Char('/') + socketName + QLatin1String("-lockfile");
|
||||
lockFile.setFileName(lockName);
|
||||
lockFile.open(QIODevice::ReadWrite);
|
||||
}
|
||||
@ -113,7 +108,8 @@ bool QtLocalPeer::isClient()
|
||||
if (lockFile.isLocked())
|
||||
return false;
|
||||
|
||||
if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false))
|
||||
//if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false))
|
||||
if (!lockFile.lock(QtLockedFile::WriteLock, false))
|
||||
return true;
|
||||
|
||||
bool res = server->listen(socketName);
|
||||
@ -187,7 +183,8 @@ void QtLocalPeer::receiveConnection()
|
||||
got = ds.readRawData(uMsgBuf, remaining);
|
||||
remaining -= got;
|
||||
uMsgBuf += got;
|
||||
} while (remaining && got >= 0 && socket->waitForReadyRead(2000));
|
||||
}
|
||||
while (remaining && got >= 0 && socket->waitForReadyRead(2000));
|
||||
if (got < 0) {
|
||||
qWarning("QtLocalPeer: Message reception failed %s", socket->errorString().toLatin1().constData());
|
||||
delete socket;
|
||||
|
4
3rdparty/qtsingleapplication/qtlocalpeer.h
vendored
4
3rdparty/qtsingleapplication/qtlocalpeer.h
vendored
@ -66,8 +66,8 @@ protected Q_SLOTS:
|
||||
protected:
|
||||
QString id;
|
||||
QString socketName;
|
||||
QLocalServer* server;
|
||||
QtLP_Private::QtLockedFile lockFile;
|
||||
QLocalServer *server;
|
||||
QtLockedFile lockFile;
|
||||
|
||||
private:
|
||||
static const char* ack;
|
||||
|
4
3rdparty/qtsingleapplication/qtlockedfile.h
vendored
4
3rdparty/qtsingleapplication/qtlockedfile.h
vendored
@ -61,8 +61,6 @@
|
||||
# define QT_QTLOCKEDFILE_EXPORT
|
||||
#endif
|
||||
|
||||
namespace QtLP_Private {
|
||||
|
||||
class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile
|
||||
{
|
||||
public:
|
||||
@ -92,5 +90,5 @@ private:
|
||||
#endif
|
||||
LockMode m_lock_mode;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -58,24 +58,14 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
|
||||
|
||||
Qt::HANDLE mutex;
|
||||
if (doCreate) {
|
||||
#if (QT_VERSION < 0x050000)
|
||||
QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); },
|
||||
{ mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } );
|
||||
#else
|
||||
mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16());
|
||||
#endif
|
||||
mutex = CreateMutexW(NULL, FALSE, (WCHAR*)mname.utf16());
|
||||
if (!mutex) {
|
||||
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if (QT_VERSION < 0x050000)
|
||||
QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); },
|
||||
{ mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
|
||||
#else
|
||||
mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16());
|
||||
#endif
|
||||
mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16());
|
||||
if (!mutex) {
|
||||
if (GetLastError() != ERROR_FILE_NOT_FOUND)
|
||||
qErrnoWarning("QtLockedFile::lock(): OpenMutex failed");
|
||||
|
@ -105,6 +105,7 @@ pkg_check_modules(LIBVLC libvlc)
|
||||
pkg_check_modules(PHONON phonon4qt5)
|
||||
pkg_check_modules(LIBGPOD libgpod-1.0>=0.7.92)
|
||||
pkg_check_modules(LIBMTP libmtp>=1.0)
|
||||
|
||||
pkg_check_modules(LIBPULSE libpulse)
|
||||
pkg_check_modules(LIBXML libxml-2.0)
|
||||
pkg_check_modules(TAGLIB REQUIRED taglib>=1.8)
|
||||
@ -115,7 +116,6 @@ find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf)
|
||||
|
||||
if (WIN32)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_library(QTSPARKLE_LIBRARIES qtsparkle-qt5)
|
||||
endif (WIN32)
|
||||
|
||||
# LASTFM
|
||||
@ -327,7 +327,6 @@ add_subdirectory(3rdparty/qocoa)
|
||||
add_subdirectory(src)
|
||||
if (WIN32)
|
||||
add_subdirectory(3rdparty/qtwin)
|
||||
add_subdirectory(3rdparty/tinysvcmdns)
|
||||
endif (WIN32)
|
||||
add_subdirectory(dist)
|
||||
add_subdirectory(ext/libstrawberry-common)
|
||||
|
BIN
dist/strawberry.ico
vendored
Normal file
BIN
dist/strawberry.ico
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
dist/strawberry.png
vendored
Normal file
BIN
dist/strawberry.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
25
dist/windres.rc.in
vendored
Normal file
25
dist/windres.rc.in
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
strawberry ICON "${CMAKE_CURRENT_SOURCE_DIR}/../dist/strawberry.ico"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${STRAWBERRY_VERSION_MAJOR},${STRAWBERRY_VERSION_MINOR},0,0
|
||||
PRODUCTVERSION ${STRAWBERRY_VERSION_MAJOR},${STRAWBERRY_VERSION_MINOR},0,0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "080904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Strawberry"
|
||||
VALUE "FileDescription", "Strawberry Music Player"
|
||||
VALUE "FileVersion", "${STRAWBERRY_VERSION_DISPLAY}"
|
||||
VALUE "InternalName", "strawberry"
|
||||
VALUE "LegalCopyright", "David Sansome"
|
||||
VALUE "OriginalFilename", "strawberry.exe"
|
||||
VALUE "ProductName", "Strawberry"
|
||||
VALUE "ProductVersion", "${STRAWBERRY_VERSION_DISPLAY}"
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x809, 1252
|
||||
END
|
||||
END
|
@ -31,6 +31,7 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURR
|
||||
|
||||
if(WIN32)
|
||||
include_directories(../3rdparty/qtwin)
|
||||
#include_directories(../3rdparty/qtsparkle)
|
||||
endif(WIN32)
|
||||
|
||||
# Activate fast QString concatenation
|
||||
@ -928,8 +929,6 @@ target_link_libraries(strawberry_lib qsqlite)
|
||||
if (WIN32)
|
||||
target_link_libraries(strawberry_lib
|
||||
${ZLIB_LIBRARIES}
|
||||
${QTSPARKLE_LIBRARIES}
|
||||
tinysvcmdns
|
||||
qtwin
|
||||
dsound
|
||||
${QT_QTGUI_LIBRARY}
|
||||
@ -962,10 +961,9 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE)
|
||||
set(STRAWBERRY-WIN32-FLAG WIN32)
|
||||
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE)
|
||||
|
||||
# resource file for windows
|
||||
# Resource file for windows
|
||||
if(WIN32)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windows/windres.rc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/windres.rc)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windres.rc.in ${CMAKE_CURRENT_BINARY_DIR}/windres.rc)
|
||||
set(STRAWBERRY-WIN32-RESOURCES windres.rc)
|
||||
endif(WIN32)
|
||||
|
||||
|
@ -23,6 +23,11 @@
|
||||
#include <fileref.h>
|
||||
#include <tag.h>
|
||||
|
||||
// This is defined by one of the windows headers that is included by taglib.
|
||||
#ifdef RemoveDirectory
|
||||
#undef RemoveDirectory
|
||||
#endif
|
||||
|
||||
#include "collectionwatcher.h"
|
||||
|
||||
#include "collectionbackend.h"
|
||||
@ -44,11 +49,6 @@
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
|
||||
// This is defined by one of the windows headers that is included by taglib.
|
||||
#ifdef RemoveDirectory
|
||||
#undef RemoveDirectory
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
static const char *kNoMediaFile = ".nomedia";
|
||||
static const char *kNoMusicFile = ".nomusic";
|
||||
@ -587,7 +587,7 @@ void CollectionWatcher::AddWatch(const Directory &dir, const QString &path) {
|
||||
|
||||
}
|
||||
|
||||
void CollectionWatcher::RemoveDirectory(const Directory& dir) {
|
||||
void CollectionWatcher::RemoveDirectory(const Directory &dir) {
|
||||
|
||||
rescan_queue_.remove(dir.id);
|
||||
watched_dirs_.remove(dir.id);
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -42,10 +43,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <iostream>
|
||||
#include <qtsparkle/Updater>
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
#include <QObject>
|
||||
@ -91,7 +93,7 @@
|
||||
#ifdef HAVE_GSTREAMER
|
||||
#include "engine/gstengine.h"
|
||||
#endif
|
||||
#include "version.h"
|
||||
|
||||
#include "widgets/osd.h"
|
||||
|
||||
#include "tagreadermessages.pb.h"
|
||||
@ -185,8 +187,7 @@ int main(int argc, char* argv[]) {
|
||||
QtSingleApplication a(argc, argv);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
QCoreApplication::setCollectionPaths(
|
||||
QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns");
|
||||
QCoreApplication::setCollectionPaths(QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns");
|
||||
#endif
|
||||
|
||||
a.setQuitOnLastWindowClosed(false);
|
||||
@ -224,11 +225,6 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
// Resources
|
||||
Q_INIT_RESOURCE(data);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
// Set the language for qtsparkle
|
||||
qtsparkle::LoadTranslations(language);
|
||||
#endif
|
||||
|
||||
// Icons
|
||||
IconLoader::Init();
|
||||
|
@ -49,10 +49,6 @@
|
||||
#include <QModelIndex>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#include <qtsparkle/Updater>
|
||||
#endif
|
||||
|
||||
#include "core/appearance.h"
|
||||
#include "core/application.h"
|
||||
#include "core/commandlineoptions.h"
|
||||
@ -548,14 +544,6 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
connect(check_updates, SIGNAL(triggered(bool)), SLOT(CheckForUpdates()));
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
qLog(Debug) << "Creating sparkle updater";
|
||||
qtsparkle::Updater* updater = new qtsparkle::Updater(QUrl("https://strawberry-data.appspot.com/sparkle-windows"), this);
|
||||
updater->SetNetworkAccessManager(new NetworkAccessManager(this));
|
||||
updater->SetVersion(STRAWBERRY_VERSION_PACKAGE);
|
||||
connect(check_updates, SIGNAL(triggered()), updater, SLOT(CheckNow()));
|
||||
#endif
|
||||
|
||||
// Global shortcuts
|
||||
connect(global_shortcuts_, SIGNAL(Play()), app_->player(), SLOT(Play()));
|
||||
connect(global_shortcuts_, SIGNAL(Pause()), app_->player(), SLOT(Pause()));
|
||||
|
@ -21,7 +21,11 @@
|
||||
//#ifdef HAVE_GIO
|
||||
//#undef signals // Clashes with GIO, and not needed in this file
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QString>
|
||||
|
||||
#include "core/logging.h"
|
||||
|
||||
//namespace {
|
||||
|
@ -28,13 +28,15 @@
|
||||
#include "core/logging.h"
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
# define _WIN32_WINNT 0x0600
|
||||
# include <windows.h>
|
||||
# include <commctrl.h>
|
||||
# include <shobjidl.h>
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <shobjidl.h>
|
||||
extern HICON qt_pixmapToWinHICON(const QPixmap &p);
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
|
||||
const int Windows7ThumbBar::kIconSize = 16;
|
||||
const int Windows7ThumbBar::kMaxButtonCount = 7;
|
||||
|
||||
@ -66,7 +68,7 @@ void Windows7ThumbBar::SetActions(const QList<QAction*>& actions) {
|
||||
static void SetupButton(const QAction *action, THUMBBUTTON *button) {
|
||||
|
||||
if (action) {
|
||||
button->hIcon = action->icon().pixmap(Windows7ThumbBar::kIconSize).toWinHICON();
|
||||
button->hIcon = qt_pixmapToWinHICON(action->icon().pixmap(Windows7ThumbBar::kIconSize));
|
||||
button->dwFlags = action->isEnabled() ? THBF_ENABLED : THBF_DISABLED;
|
||||
// This is unsafe - doesn't obey 260-char restriction
|
||||
action->text().toWCharArray(button->szTip);
|
||||
@ -108,8 +110,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG *msg) {
|
||||
// Copied from win7 SDK shobjidl.h
|
||||
static const GUID CLSID_ITaskbarList ={ 0x56FDF344,0xFD6D,0x11d0,{0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90}};
|
||||
// Create the taskbar list
|
||||
hr = CoCreateInstance(CLSID_ITaskbarList, nullptr, CLSCTX_ALL,
|
||||
IID_ITaskbarList3, (void**)&taskbar_list_);
|
||||
hr = CoCreateInstance(CLSID_ITaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&taskbar_list_);
|
||||
if (hr != S_OK) {
|
||||
qLog(Warning) << "Error creating the ITaskbarList3 interface" << hex << DWORD (hr);
|
||||
return;
|
||||
@ -135,7 +136,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG *msg) {
|
||||
}
|
||||
|
||||
qLog(Debug) << "Adding buttons";
|
||||
hr = taskbar_list->ThumbBarAddButtons(widget_->winId(), actions_.count(), buttons);
|
||||
hr = taskbar_list->ThumbBarAddButtons((HWND)widget_->winId(), actions_.count(), buttons);
|
||||
if (hr != S_OK)
|
||||
qLog(Debug) << "Failed to add buttons" << hex << DWORD (hr);
|
||||
for (int i = 0; i < actions_.count(); i++) {
|
||||
@ -172,7 +173,7 @@ void Windows7ThumbBar::ActionChanged() {
|
||||
if (buttons->hIcon > 0) DestroyIcon(buttons->hIcon);
|
||||
}
|
||||
|
||||
taskbar_list->ThumbBarUpdateButtons(widget_->winId(), actions_.count(), buttons);
|
||||
taskbar_list->ThumbBarUpdateButtons((HWND)widget_->winId(), actions_.count(), buttons);
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ BOOL DirectSoundDeviceFinder::EnumerateCallback(LPGUID guid, LPCSTR description,
|
||||
Device dev;
|
||||
dev.description = QString::fromUtf8(description);
|
||||
dev.device_property_value = QUuid(*guid).toByteArray();
|
||||
dev.icon_name = GuessIconName(dev.plugin_name, dev.description);
|
||||
dev.iconname = GuessIconName(dev.string, dev.description);
|
||||
state->devices.append(dev);
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,12 @@
|
||||
#include "core/iconloader.h"
|
||||
#include "engine/enginetype.h"
|
||||
#include "engine/enginebase.h"
|
||||
#ifdef HAVE_GSTREAMER
|
||||
#include "engine/gstengine.h"
|
||||
#endif
|
||||
#ifdef HAVE_XINE
|
||||
#include "engine/xineengine.h"
|
||||
#endif
|
||||
#include "engine/devicefinder.h"
|
||||
|
||||
const char *BackendSettingsPage::kSettingsGroup = "Backend";
|
||||
|
Loading…
x
Reference in New Issue
Block a user