Fix cross build for windows.

This commit is contained in:
Jonas Kvinge
2018-04-02 18:35:58 +02:00
parent 1817127a90
commit 6bbc1271e4
16 changed files with 72 additions and 72 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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";