Fix cross build for windows.
This commit is contained in:
@@ -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
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user