More macos fixes

This commit is contained in:
Jonas Kvinge
2018-07-03 17:51:52 +02:00
parent efdaf57f99
commit ab3569a285
25 changed files with 2393 additions and 106 deletions

View File

@@ -179,7 +179,6 @@ set(SOURCES
covermanager/albumcovermanager.cpp
covermanager/albumcovermanagerlist.cpp
covermanager/albumcoverloader.cpp
covermanager/albumcoverloaderoptions.cpp
covermanager/albumcoverfetcher.cpp
covermanager/albumcoverfetchersearch.cpp
covermanager/albumcoversearcher.cpp
@@ -790,12 +789,8 @@ optional_source(APPLE
globalshortcuts/globalshortcutgrabber.mm
globalshortcuts/macglobalshortcutbackend.mm
HEADERS
core/mac_startup.h
core/macsystemtrayicon.h
core/macscreensaver.h
core/macfslistener.h
core/mac_utilities.h
core/mac_delegate.h
globalshortcuts/macglobalshortcutbackend.h
)
@@ -916,6 +911,7 @@ if (APPLE)
"-framework IOKit"
"-framework ScriptingBridge"
)
target_link_libraries(strawberry_lib ${SPMEDIAKEYTAP_LIBRARIES})
if (HAVE_SPARKLE)
include_directories(${SPARKLE}/Headers)
@@ -982,55 +978,10 @@ target_link_libraries(strawberry
# macdeploy.py relies on the blob being built first.
add_dependencies(strawberry strawberry-tagreader)
#set_target_properties(strawberry PROPERTIES
#MACOSX_BUNDLE_INFO_PLIST "../dist/macos/Info.plist"
#)
if (NOT APPLE)
install(TARGETS strawberry RUNTIME DESTINATION bin)
endif()
if (APPLE)
install(FILES ../dist/macos/strawberry.icns DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
install(FILES ../dist/macos/qt.conf DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
install(FILES ../dist/macos/sparkle_pub.pem DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
install(DIRECTORY "${QT_QTGUI_LIBRARY_RELEASE}/Versions/Current/Resources/" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
if (HAVE_SPARKLE)
install(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/Sparkle.framework")
endif (HAVE_SPARKLE)
install(FILES "${QT_QTCORE_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtCore.framework/Versions/4/Resources")
install(FILES "${QT_QTGUI_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtGui.framework/Versions/4/Resources")
install(FILES "${QT_QTNETWORK_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtNetwork.framework/Versions/4/Resources")
install(FILES "${QT_QTOPENGL_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtOpenGL.framework/Versions/4/Resources")
install(FILES "${QT_QTSQL_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtSql.framework/Versions/4/Resources")
install(FILES "${QT_QTSVG_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtSvg.framework/Versions/4/Resources")
install(FILES "${QT_QTXML_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtXml.framework/Versions/4/Resources")
#add_custom_command(TARGET strawberry
# POST_BUILD
# COMMAND
# ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/macdeploy.py ${PROJECT_BINARY_DIR}/strawberry.app -f
# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
#)
#if (APPLE_DEVELOPER_ID)
# add_custom_target(
# sign
# COMMAND
# ${PROJECT_SOURCE_DIR}/dist/macos/codesign.py ${APPLE_DEVELOPER_ID} ${PROJECT_BINARY_DIR}/strawberry.app
# DEPENDS strawberry
# VERBATIM
# )
#endif()
#add_custom_command(
# OUTPUT ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/strawberry-$#{STRAWBERRY_VERSION_PACKAGE}.dmg
# COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/create-dmg.sh ${PROJECT_BINARY_DIR}/strawberry.app
# COMMAND ${CMAKE_COMMAND} -E rename ${PROJECT_BINARY_DIR}/strawberry.dmg ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg
# DEPENDS strawberry
# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
#)
#add_custom_target(dmg
# DEPENDS ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg)
else (APPLE)
install(TARGETS strawberry RUNTIME DESTINATION bin )
set_target_properties(strawberry PROPERTIES MACOSX_BUNDLE_INFO_PLIST "../dist/macos/Info.plist")
endif (APPLE)

View File

@@ -22,29 +22,14 @@
#include "config.h"
#include "version.h"
#include <QtGlobal>
#include <glib.h>
#include <stdlib.h>
#include <stdbool.h>
#include <memory>
#include <time.h>
#include <QtGlobal>
#include <QObject>
#include <QCoreApplication>
#include <QStandardPaths>
#include <QFileDevice>
#include <QIODevice>
#include <QByteArray>
#include <QNetworkProxy>
#include <QFile>
#include <QString>
#include <QImage>
#include <QSettings>
#include <QtDebug>
#ifdef HAVE_DBUS
# include <QDBusArgument>
#endif
#ifdef Q_OS_UNIX
# include <unistd.h>
#endif
@@ -62,6 +47,22 @@
#include <iostream>
#endif // Q_OS_WIN32
#include <QObject>
#include <QCoreApplication>
#include <QStandardPaths>
#include <QFileDevice>
#include <QIODevice>
#include <QByteArray>
#include <QNetworkProxy>
#include <QFile>
#include <QString>
#include <QImage>
#include <QSettings>
#include <QtDebug>
#ifdef HAVE_DBUS
# include <QDBusArgument>
#endif
#include "main.h"
#include "core/logging.h"
@@ -161,7 +162,7 @@ int main(int argc, char* argv[]) {
QtSingleApplication a(argc, argv);
#ifdef Q_OS_MACOS
QCoreApplication::setLibraryPaths(QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns");
//QCoreApplication::setLibraryPaths(QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns");
#endif
a.setQuitOnLastWindowClosed(false);

View File

@@ -1 +0,0 @@
#include "albumcoverloaderoptions.h"

View File

@@ -398,7 +398,6 @@ bool GstEngine::ValidOutput(const QString &output) {
}
bool GstEngine::CustomDeviceSupport(const QString &output) {
return (output == kALSASink || output == kOpenALSASink || output == kOSSSink || output == kOSS4Sink || output == kPulseSink || output == kA2DPSink || output == kAVDTPSink);
}
@@ -429,9 +428,12 @@ void GstEngine::SetEnvironment() {
// On windows and mac we bundle the gstreamer plugins with strawberry
#if defined(Q_OS_MACOS)
scanner_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gst-plugin-scanner";
plugin_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer";
#elif defined(Q_OS_WIN32)
//scanner_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gst-plugin-scanner";
//plugin_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer";
scanner_path = "/usr/local/Cellar/gstreamer/1.14.1/libexec/gstreamer-1.0/gst-plugin-scanner";
plugin_path = "/usr/local/lib/gstreamer-1.0";
#endif
#if defined(Q_OS_WIN32)
plugin_path = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/gstreamer-plugins");
#endif
@@ -451,9 +453,9 @@ void GstEngine::SetEnvironment() {
Utilities::SetEnv("GST_REGISTRY", registry_filename);
}
#ifdef Q_OS_MACOS
Utilities::SetEnv("GIO_EXTRA_MODULES", QCoreApplication::applicationDirPath() + "/../PlugIns/gio-modules");
#endif
//#ifdef Q_OS_MACOS
//Utilities::SetEnv("GIO_EXTRA_MODULES", QCoreApplication::applicationDirPath() + "/../PlugIns/gio-modules");
//#endif
Utilities::SetEnv("PULSE_PROP_media.role", "music");

View File

@@ -206,17 +206,19 @@ bool GstEnginePipeline::InitAudioBin() {
if (device_.isValid() && g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "device")) {
switch (device_.type()) {
case QVariant::Int:
g_object_set(G_OBJECT(audiosink_), "device", device_.toInt(), nullptr);
break;
case QVariant::String:
if (device_.toString().isEmpty()) break;
g_object_set(G_OBJECT(audiosink_), "device", device_.toString().toUtf8().constData(), nullptr);
break;
case QVariant::ByteArray: {
case QVariant::ByteArray:
g_object_set(G_OBJECT(audiosink_), "device", device_.toByteArray().constData(), nullptr);
break;
}
case QVariant::LongLong:
g_object_set(G_OBJECT(audiosink_), "device", device_.toLongLong(), nullptr);
break;
case QVariant::Int:
g_object_set(G_OBJECT(audiosink_), "device", device_.toInt(), nullptr);
break;
default:
qLog(Warning) << "Unknown device type" << device_;
break;

View File

@@ -102,11 +102,13 @@ QList<DeviceFinder::Device> OsxDeviceFinder::ListDevices() {
}
Device dev;
dev.description = QString::fromUtf8(CFStringGetCStringPtr(*device_name, CFStringGetSystemEncoding()));
dev.value = id;
dev.description = QString::fromUtf8(CFStringGetCStringPtr(*device_name, CFStringGetSystemEncoding()));
if (dev.description.isEmpty()) dev.description = QString("Unknown device " + dev.value.toString());
dev.iconname = GuessIconName(dev.description);
ret.append(dev);
}
return ret;
}