mirror of
https://github.com/jellyfin/jellyfin-desktop.git
synced 2026-10-26 16:45:24 +00:00
Fix warnings; remove dead code
This commit is contained in:
1 parent
b3885236f1
commit
cd8698c0e2
30 files changed
+82
-346
No files matched your search
@@ -6,7 +6,7 @@ find_Library(CARBON Carbon)
|
||||
find_library(SECURITY Security)
|
||||
find_library(MEDIAPLAYER MediaPlayer)
|
||||
|
||||
set(OS_LIBS ${FOUNDATION} ${APPKIT} ${IOKIT} ${COCOA} ${SECURITY} ${CARBON} hidremote plistparser letsmove)
|
||||
set(OS_LIBS ${FOUNDATION} ${APPKIT} ${IOKIT} ${COCOA} ${SECURITY} ${CARBON} hidremote letsmove)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework MediaPlayer")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.15 -fno-omit-frame-pointer")
|
||||
|
||||
@@ -10,6 +10,8 @@ if(NOT MSVC)
|
||||
enable_if_supported(COMPILER_FLAGS "-Wmissing-include-dirs")
|
||||
enable_if_supported(COMPILER_FLAGS "-Woverloaded-virtual")
|
||||
enable_if_supported(COMPILER_FLAGS "-Wold-style-cast")
|
||||
enable_if_supported(COMPILER_FLAGS "-Wsign-compare")
|
||||
enable_if_supported(COMPILER_FLAGS "-Wdeprecated-declarations")
|
||||
endif()
|
||||
|
||||
enable_if_supported(COMPILER_FLAGS "-Wshorten-64-to-32")
|
||||
|
||||
Vendored
-1
@@ -2,7 +2,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS_THIRD_PARTY}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_FLAGS_THIRD_PARTY}")
|
||||
|
||||
if(APPLE)
|
||||
add_subdirectory(plistparser)
|
||||
add_subdirectory(HIDRemote)
|
||||
add_subdirectory(letsmove)
|
||||
endif(APPLE)
|
||||
|
||||
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
include_directories(.)
|
||||
|
||||
add_library(plistparser STATIC
|
||||
plistparser.cpp
|
||||
plistparser.h
|
||||
plistserializer.cpp
|
||||
plistserializer.h
|
||||
)
|
||||
std_target_properties(plistparser)
|
||||
target_link_libraries(plistparser
|
||||
Qt6::Core
|
||||
Qt6::Xml
|
||||
)
|
||||
Vendored
-22
@@ -1,22 +0,0 @@
|
||||
Gist: this is an MIT license. Act accordingly (basically, do whatever you want).
|
||||
It would be nice to get an email from you if you use this, but if not that's also cool.
|
||||
|
||||
Copyright (c) 2010 Reilly Watson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
Vendored
-98
@@ -1,98 +0,0 @@
|
||||
// Own includes
|
||||
#include "plistparser.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QDomNode>
|
||||
#include <QDomDocument>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
|
||||
QVariant PListParser::parsePList(QIODevice *device) {
|
||||
QVariantMap result;
|
||||
QDomDocument doc;
|
||||
QString errorMessage;
|
||||
int errorLine;
|
||||
int errorColumn;
|
||||
bool success = doc.setContent(device, false, &errorMessage, &errorLine, &errorColumn);
|
||||
if (!success) {
|
||||
qDebug() << "PListParser Warning: Could not parse PList file!";
|
||||
qDebug() << "Error message: " << errorMessage;
|
||||
qDebug() << "Error line: " << errorLine;
|
||||
qDebug() << "Error column: " << errorColumn;
|
||||
return result;
|
||||
}
|
||||
QDomElement root = doc.documentElement();
|
||||
if (root.attribute(QStringLiteral("version"), QStringLiteral("1.0")) != QLatin1String("1.0")) {
|
||||
qDebug() << "PListParser Warning: plist is using an unknown format version, parsing might fail unexpectedly";
|
||||
}
|
||||
return parseElement(root.firstChild().toElement());
|
||||
}
|
||||
|
||||
QVariant PListParser::parseElement(const QDomElement &e) {
|
||||
QString tagName = e.tagName();
|
||||
QVariant result;
|
||||
if (tagName == QLatin1String("dict")) {
|
||||
result = parseDictElement(e);
|
||||
}
|
||||
else if (tagName == QLatin1String("array")) {
|
||||
result = parseArrayElement(e);
|
||||
}
|
||||
else if (tagName == QLatin1String("string")) {
|
||||
result = e.text();
|
||||
}
|
||||
else if (tagName == QLatin1String("data")) {
|
||||
result = QByteArray::fromBase64(e.text().toUtf8());
|
||||
}
|
||||
else if (tagName == QLatin1String("integer")) {
|
||||
result = e.text().toInt();
|
||||
}
|
||||
else if (tagName == QLatin1String("real")) {
|
||||
result = e.text().toFloat();
|
||||
}
|
||||
else if (tagName == QLatin1String("true")) {
|
||||
result = true;
|
||||
}
|
||||
else if (tagName == QLatin1String("false")) {
|
||||
result = false;
|
||||
}
|
||||
else if (tagName == QLatin1String("date")) {
|
||||
result = QDateTime::fromString(e.text(), Qt::ISODate);
|
||||
}
|
||||
else {
|
||||
qDebug() << "PListParser Warning: Invalid tag found: " << e.tagName() << e.text();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QVariantList PListParser::parseArrayElement(const QDomElement& element) {
|
||||
QVariantList result;
|
||||
QDomNodeList children = element.childNodes();
|
||||
for (int i = 0; i < children.count(); i++) {
|
||||
QDomNode child = children.at(i);
|
||||
QDomElement e = child.toElement();
|
||||
if (!e.isNull()) {
|
||||
result.append(parseElement(e));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QVariantMap PListParser::parseDictElement(const QDomElement& element) {
|
||||
QVariantMap result;
|
||||
QDomNodeList children = element.childNodes();
|
||||
QString currentKey;
|
||||
for (int i = 0; i < children.count(); i++) {
|
||||
QDomNode child = children.at(i);
|
||||
QDomElement e = child.toElement();
|
||||
if (!e.isNull()) {
|
||||
QString tagName = e.tagName();
|
||||
if (tagName == QLatin1String("key")) {
|
||||
currentKey = e.text();
|
||||
}
|
||||
else if (!currentKey.isEmpty()) {
|
||||
result[currentKey] = parseElement(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Vendored
-18
@@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Qt includes
|
||||
#include <QIODevice>
|
||||
#include <QVariant>
|
||||
#include <QVariantList>
|
||||
#include <QVariantMap>
|
||||
#include <QDomElement>
|
||||
|
||||
class PListParser {
|
||||
public:
|
||||
static QVariant parsePList(QIODevice *device);
|
||||
private:
|
||||
static QVariant parseElement(const QDomElement &e);
|
||||
static QVariantList parseArrayElement(const QDomElement& node);
|
||||
static QVariantMap parseDictElement(const QDomElement& element);
|
||||
};
|
||||
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
// Own includes
|
||||
#include "plistserializer.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QDomElement>
|
||||
#include <QDomDocument>
|
||||
#include <QDate>
|
||||
#include <QDateTime>
|
||||
|
||||
static QDomElement textElement(QDomDocument& doc, const char *tagName, QString contents) {
|
||||
QDomElement tag = doc.createElement(QString::fromLatin1(tagName));
|
||||
tag.appendChild(doc.createTextNode(contents));
|
||||
return tag;
|
||||
}
|
||||
|
||||
static QDomElement serializePrimitive(QDomDocument &doc, const QVariant &variant) {
|
||||
QDomElement result;
|
||||
if (variant.type() == QVariant::Bool) {
|
||||
result = doc.createElement(variant.toBool() ? QStringLiteral("true") : QStringLiteral("false"));
|
||||
}
|
||||
else if (variant.type() == QVariant::Date) {
|
||||
result = textElement(doc, "date", variant.toDate().toString(Qt::ISODate));
|
||||
}
|
||||
else if (variant.type() == QVariant::DateTime) {
|
||||
result = textElement(doc, "date", variant.toDateTime().toString(Qt::ISODate));
|
||||
}
|
||||
else if (variant.type() == QVariant::ByteArray) {
|
||||
result = textElement(doc, "data", QString::fromLatin1(variant.toByteArray().toBase64()));
|
||||
}
|
||||
else if (variant.type() == QVariant::String) {
|
||||
result = textElement(doc, "string", variant.toString());
|
||||
}
|
||||
else if (variant.type() == QVariant::Int) {
|
||||
result = textElement(doc, "integer", QString::number(variant.toInt()));
|
||||
}
|
||||
else if (variant.canConvert(QVariant::Double)) {
|
||||
QString num;
|
||||
num.setNum(variant.toDouble());
|
||||
result = textElement(doc, "real", num);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QDomElement PListSerializer::serializeElement(QDomDocument &doc, const QVariant &variant) {
|
||||
if (variant.type() == QVariant::Map) {
|
||||
return serializeMap(doc, variant.toMap());
|
||||
}
|
||||
else if (variant.type() == QVariant::List) {
|
||||
return serializeList(doc, variant.toList());
|
||||
}
|
||||
else {
|
||||
return serializePrimitive(doc, variant);
|
||||
}
|
||||
}
|
||||
|
||||
QDomElement PListSerializer::serializeList(QDomDocument &doc, const QVariantList &list) {
|
||||
QDomElement element = doc.createElement(QStringLiteral("array"));
|
||||
foreach(QVariant item, list) {
|
||||
element.appendChild(serializeElement(doc, item));
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
QDomElement PListSerializer::serializeMap(QDomDocument &doc, const QVariantMap &map) {
|
||||
QDomElement element = doc.createElement(QStringLiteral("dict"));
|
||||
QList<QString> keys = map.keys();
|
||||
foreach(QString key, keys) {
|
||||
QDomElement keyElement = textElement(doc, "key", key);
|
||||
element.appendChild(keyElement);
|
||||
element.appendChild(serializeElement(doc, map[key]));
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
QString PListSerializer::toPList(const QVariant &variant) {
|
||||
QDomDocument document(QStringLiteral("plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\""));
|
||||
document.appendChild(document.createProcessingInstruction(QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")));
|
||||
QDomElement plist = document.createElement(QStringLiteral("plist"));
|
||||
plist.setAttribute(QStringLiteral("version"), QStringLiteral("1.0"));
|
||||
document.appendChild(plist);
|
||||
plist.appendChild(serializeElement(document, variant));
|
||||
return document.toString();
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Qt includes
|
||||
#include <QIODevice>
|
||||
#include <QVariant>
|
||||
#include <QVariantList>
|
||||
#include <QVariantMap>
|
||||
#include <QDomElement>
|
||||
#include <QDomDocument>
|
||||
#include <QString>
|
||||
|
||||
class PListSerializer {
|
||||
public:
|
||||
static QString toPList(const QVariant &variant);
|
||||
private:
|
||||
static QDomElement serializeElement(QDomDocument &doc, const QVariant &variant);
|
||||
static QDomElement serializeMap(QDomDocument &doc, const QVariantMap &map);
|
||||
static QDomElement serializeList(QDomDocument &doc, const QVariantList &list);
|
||||
};
|
||||
|
||||
@@ -172,12 +172,7 @@ class inputPlugin {
|
||||
|
||||
const state = playbackManager.getPlayerState();
|
||||
if (state && state.NowPlayingItem) {
|
||||
let serverAddress = '';
|
||||
if (window.ApiClient && typeof window.ApiClient.serverAddress === 'function') {
|
||||
serverAddress = window.ApiClient.serverAddress();
|
||||
}
|
||||
|
||||
api.player.notifyMetadata(state.NowPlayingItem, serverAddress || '');
|
||||
api.player.notifyMetadata(state.NowPlayingItem);
|
||||
|
||||
const initialPos = playbackManager.currentTime();
|
||||
if (initialPos !== undefined && initialPos !== null) {
|
||||
|
||||
@@ -546,7 +546,7 @@
|
||||
player.videoPlaybackActive.connect((active) => console.log(`[MPV Signal] videoPlaybackActive: ${active}`));
|
||||
player.windowVisible.connect((visible) => console.log(`[MPV Signal] windowVisible: ${visible}`));
|
||||
player.onVideoRecangleChanged.connect(() => console.log('[MPV Signal] onVideoRecangleChanged'));
|
||||
player.onMetaData.connect((meta, baseUrl) => console.log(`[MPV Signal] onMetaData: ${JSON.stringify(meta)}`));
|
||||
player.onMetaData.connect((meta) => console.log(`[MPV Signal] onMetaData: ${JSON.stringify(meta)}`));
|
||||
}
|
||||
|
||||
if (options.fullscreen) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/external/HIDRemote
|
||||
${CMAKE_SOURCE_DIR}/external/plistparser
|
||||
${CMAKE_SOURCE_DIR}/external/letsmove
|
||||
${CMAKE_SOURCE_DIR}/src/player
|
||||
core
|
||||
|
||||
@@ -9,7 +9,7 @@ void DisplayManagerDummy::addMode(float rate)
|
||||
return;
|
||||
|
||||
DMVideoModePtr mode = DMVideoModePtr(new DMVideoMode());
|
||||
mode->m_id = m_displays[0]->m_videoModes.size();
|
||||
mode->m_id = static_cast<int>(m_displays[0]->m_videoModes.size());
|
||||
mode->m_interlaced = false;
|
||||
mode->m_refreshRate = rate;
|
||||
mode->m_width = 1280;
|
||||
@@ -24,7 +24,7 @@ bool DisplayManagerDummy::initialize()
|
||||
m_displays.clear();
|
||||
|
||||
DMDisplayPtr display = DMDisplayPtr(new DMDisplay());
|
||||
display->m_id = m_displays.size();
|
||||
display->m_id = static_cast<int>(m_displays.size());
|
||||
display->m_name = "Dummy display";
|
||||
m_displays[display->m_id] = display;
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ bool DisplayManagerOSX::initialize()
|
||||
|
||||
m_displays.clear();
|
||||
|
||||
for (int i = 0; i < m_osxDisplayModes.size(); i++)
|
||||
for (size_t i = 0; i < m_osxDisplayModes.size(); i++)
|
||||
{
|
||||
if (m_osxDisplayModes[i])
|
||||
CFRelease(m_osxDisplayModes[i]);
|
||||
if (m_osxDisplayModes[static_cast<int>(i)])
|
||||
CFRelease(m_osxDisplayModes[static_cast<int>(i)]);
|
||||
}
|
||||
m_osxDisplayModes.clear();
|
||||
|
||||
@@ -33,7 +33,7 @@ bool DisplayManagerOSX::initialize()
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int displayid = 0; displayid < m_osxnumDisplays; displayid++)
|
||||
for (uint32_t displayid = 0; displayid < m_osxnumDisplays; displayid++)
|
||||
{
|
||||
// add the display to the list
|
||||
DMDisplayPtr display = DMDisplayPtr(new DMDisplay);
|
||||
@@ -45,35 +45,27 @@ bool DisplayManagerOSX::initialize()
|
||||
if (!m_osxDisplayModes[displayid])
|
||||
continue;
|
||||
|
||||
int numModes = (int)CFArrayGetCount(m_osxDisplayModes[displayid]);
|
||||
CFIndex numModes = CFArrayGetCount(m_osxDisplayModes[displayid]);
|
||||
|
||||
for (int modeid = 0; modeid < numModes; modeid++)
|
||||
for (CFIndex modeid = 0; modeid < numModes; modeid++)
|
||||
{
|
||||
totalModes++;
|
||||
|
||||
|
||||
// add the videomode to the display
|
||||
DMVideoModePtr mode = DMVideoModePtr(new DMVideoMode);
|
||||
mode->m_id = modeid;
|
||||
display->m_videoModes[modeid] = mode;
|
||||
mode->m_id = static_cast<int>(modeid);
|
||||
display->m_videoModes[static_cast<int>(modeid)] = mode;
|
||||
|
||||
// grab videomode info
|
||||
CGDisplayModeRef displayMode =
|
||||
(CGDisplayModeRef)CFArrayGetValueAtIndex(m_osxDisplayModes[displayid], modeid);
|
||||
static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(m_osxDisplayModes[displayid], modeid)));
|
||||
|
||||
mode->m_height = (int)CGDisplayModeGetHeight(displayMode);
|
||||
mode->m_width = (int)CGDisplayModeGetWidth(displayMode);
|
||||
mode->m_refreshRate = (float)CGDisplayModeGetRefreshRate(displayMode);
|
||||
mode->m_height = static_cast<int>(CGDisplayModeGetHeight(displayMode));
|
||||
mode->m_width = static_cast<int>(CGDisplayModeGetWidth(displayMode));
|
||||
mode->m_refreshRate = static_cast<float>(CGDisplayModeGetRefreshRate(displayMode));
|
||||
|
||||
CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(displayMode);
|
||||
|
||||
if (CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
mode->m_bitsPerPixel = 32;
|
||||
else if (CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
mode->m_bitsPerPixel = 16;
|
||||
else if (CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
mode->m_bitsPerPixel = 8;
|
||||
|
||||
CFRelease(pixEnc);
|
||||
// Assume 32-bit color depth (CGDisplayModeCopyPixelEncoding deprecated in 10.11)
|
||||
mode->m_bitsPerPixel = 32;
|
||||
|
||||
mode->m_interlaced = (CGDisplayModeGetIOFlags(displayMode) & kDisplayModeInterlacedFlag) > 0;
|
||||
|
||||
@@ -95,7 +87,7 @@ bool DisplayManagerOSX::setDisplayMode(int display, int mode)
|
||||
return false;
|
||||
|
||||
CGDisplayModeRef displayMode =
|
||||
(CGDisplayModeRef)CFArrayGetValueAtIndex(m_osxDisplayModes[display], mode);
|
||||
static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(m_osxDisplayModes[display], mode)));
|
||||
|
||||
CGError err = CGDisplaySetDisplayMode(m_osxDisplays[display], displayMode, nullptr);
|
||||
if (err)
|
||||
@@ -116,59 +108,59 @@ int DisplayManagerOSX::getCurrentDisplayMode(int display)
|
||||
CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(m_osxDisplays[display]);
|
||||
uint32_t currentIOKitID = CGDisplayModeGetIODisplayModeID(currentMode);
|
||||
|
||||
for (int mode = 0; mode < CFArrayGetCount(m_osxDisplayModes[display]); mode++)
|
||||
for (CFIndex mode = 0; mode < CFArrayGetCount(m_osxDisplayModes[display]); mode++)
|
||||
{
|
||||
CGDisplayModeRef checkMode = (CGDisplayModeRef)CFArrayGetValueAtIndex(m_osxDisplayModes[display], mode);
|
||||
CGDisplayModeRef checkMode = static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(m_osxDisplayModes[display], mode)));
|
||||
uint32_t checkIOKitID = CGDisplayModeGetIODisplayModeID(checkMode);
|
||||
|
||||
if (currentIOKitID == checkIOKitID)
|
||||
{
|
||||
CFRelease(currentMode);
|
||||
return mode;
|
||||
return static_cast<int>(mode);
|
||||
}
|
||||
}
|
||||
CFRelease(currentMode);
|
||||
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int DisplayManagerOSX::getMainDisplay()
|
||||
{
|
||||
CGDirectDisplayID mainID = CGMainDisplayID();
|
||||
|
||||
for (int i = 0; i < m_osxnumDisplays; i++)
|
||||
for (uint32_t i = 0; i < m_osxnumDisplays; i++)
|
||||
{
|
||||
if (m_osxDisplays[i] == mainID)
|
||||
return i;
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
DisplayManagerOSX::~DisplayManagerOSX()
|
||||
{
|
||||
for (int i = 0; i < m_osxDisplayModes.size(); i++)
|
||||
for (size_t i = 0; i < m_osxDisplayModes.size(); i++)
|
||||
{
|
||||
if (m_osxDisplayModes[i])
|
||||
CFRelease(m_osxDisplayModes[i]);
|
||||
if (m_osxDisplayModes[static_cast<int>(i)])
|
||||
CFRelease(m_osxDisplayModes[static_cast<int>(i)]);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int DisplayManagerOSX::getDisplayFromPoint(int x, int y)
|
||||
{
|
||||
CGPoint point = { (double)x, (double)y };
|
||||
CGPoint point = { static_cast<CGFloat>(x), static_cast<CGFloat>(y) };
|
||||
CGDirectDisplayID foundDisplay;
|
||||
uint32_t numFound;
|
||||
|
||||
CGGetDisplaysWithPoint(point, 1, &foundDisplay, &numFound);
|
||||
|
||||
for (int i=0; i<m_osxnumDisplays; i++)
|
||||
for (uint32_t i = 0; i < m_osxnumDisplays; i++)
|
||||
{
|
||||
if (foundDisplay == m_osxDisplays[i])
|
||||
return i;
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
isPressed:(BOOL)isPressed
|
||||
fromHardwareWithAttributes:(NSMutableDictionary *)attributes
|
||||
{
|
||||
m_remoteHandler->remoteButtonEvent(buttonCode, isPressed, [self remoteNameFromAttributes:attributes]);
|
||||
m_remoteHandler->remoteButtonEvent(buttonCode, isPressed);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -17,11 +17,11 @@ public:
|
||||
const char* inputName() override { return "AppleMediaKeys"; }
|
||||
|
||||
private slots:
|
||||
void handleStateChanged(PlayerComponent::State newState, PlayerComponent::State oldState);
|
||||
void handleStateChanged(PlayerComponent::State newState);
|
||||
void handlePositionUpdate(quint64 position);
|
||||
void handleUpdateDuration(qint64 duration);
|
||||
void handleUpdateMetaData(const QVariantMap& meta);
|
||||
void handleAlbumArtReady(const QByteArray& imageData, const QString& mimeType);
|
||||
void handleAlbumArtReady(const QByteArray& imageData);
|
||||
void handleAlbumArtUnavailable();
|
||||
|
||||
private:
|
||||
|
||||
@@ -113,7 +113,7 @@ bool InputAppleMediaKeys::initInput()
|
||||
dlopen("/System/Library/PrivateFrameworks/MediaRemote.framework/MediaRemote", RTLD_NOW))
|
||||
{
|
||||
#define LOAD_FUNC(name) \
|
||||
name = (name ## Func)dlsym(lib, "MRMediaRemote" #name)
|
||||
name = reinterpret_cast<name ## Func>(dlsym(lib, "MRMediaRemote" #name))
|
||||
LOAD_FUNC(SetNowPlayingVisibility);
|
||||
LOAD_FUNC(GetLocalOrigin);
|
||||
LOAD_FUNC(SetCanBeNowPlayingApplication);
|
||||
@@ -143,12 +143,12 @@ static MPNowPlayingPlaybackState convertState(PlayerComponent::State newState)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void InputAppleMediaKeys::handleStateChanged(PlayerComponent::State newState, PlayerComponent::State oldState)
|
||||
void InputAppleMediaKeys::handleStateChanged(PlayerComponent::State newState)
|
||||
{
|
||||
MPNowPlayingPlaybackState newMPState = convertState(newState);
|
||||
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
|
||||
NSMutableDictionary *playingInfo = [NSMutableDictionary dictionaryWithDictionary:center.nowPlayingInfo];
|
||||
[playingInfo setObject:[NSNumber numberWithDouble:(double)m_currentTime / 1000] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
|
||||
[playingInfo setObject:[NSNumber numberWithDouble:static_cast<double>(m_currentTime) / 1000] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
|
||||
center.nowPlayingInfo = playingInfo;
|
||||
[MPNowPlayingInfoCenter defaultCenter].playbackState = newMPState;
|
||||
if (SetNowPlayingVisibility && GetLocalOrigin) {
|
||||
@@ -169,7 +169,7 @@ void InputAppleMediaKeys::handlePositionUpdate(quint64 position)
|
||||
if (m_pendingUpdate) {
|
||||
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
|
||||
NSMutableDictionary *playingInfo = [NSMutableDictionary dictionaryWithDictionary:center.nowPlayingInfo];
|
||||
[playingInfo setObject:[NSNumber numberWithDouble:(double)position / 1000] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
|
||||
[playingInfo setObject:[NSNumber numberWithDouble:static_cast<double>(position) / 1000] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
|
||||
center.nowPlayingInfo = playingInfo;
|
||||
m_pendingUpdate = false;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ void InputAppleMediaKeys::handleUpdateDuration(qint64 duration)
|
||||
{
|
||||
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
|
||||
NSMutableDictionary *playingInfo = [NSMutableDictionary dictionaryWithDictionary:center.nowPlayingInfo];
|
||||
[playingInfo setObject:[NSNumber numberWithDouble:(double)duration / 1000] forKey:MPMediaItemPropertyPlaybackDuration];
|
||||
[playingInfo setObject:[NSNumber numberWithDouble:static_cast<double>(duration) / 1000] forKey:MPMediaItemPropertyPlaybackDuration];
|
||||
center.nowPlayingInfo = playingInfo;
|
||||
m_pendingUpdate = true;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ void InputAppleMediaKeys::handleUpdateMetaData(const QVariantMap& meta)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void InputAppleMediaKeys::handleAlbumArtReady(const QByteArray& imageData, const QString& mimeType)
|
||||
void InputAppleMediaKeys::handleAlbumArtReady(const QByteArray& imageData)
|
||||
{
|
||||
// Convert QByteArray to NSData
|
||||
NSData *nsImageData = [NSData dataWithBytes:imageData.constData() length:imageData.size()];
|
||||
@@ -235,7 +235,7 @@ void InputAppleMediaKeys::handleAlbumArtReady(const QByteArray& imageData, const
|
||||
|
||||
// Create MPMediaItemArtwork from NSImage
|
||||
MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc] initWithBoundsSize:nsImage.size
|
||||
requestHandler:^NSImage * _Nonnull(CGSize size) {
|
||||
requestHandler:^NSImage * _Nonnull(__unused CGSize size) {
|
||||
return nsImage;
|
||||
}];
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
const char* inputName() override { return "AppleRemote"; }
|
||||
bool initInput() override;
|
||||
|
||||
void remoteButtonEvent(quint8 code, bool pressed, const QString& name);
|
||||
void remoteButtonEvent(quint8 code, bool pressed);
|
||||
|
||||
void addRemote(const QString& name);
|
||||
void removeRemote(const QString& name);
|
||||
|
||||
@@ -33,7 +33,7 @@ void InputAppleRemote::removeRemote(const QString &name)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void InputAppleRemote::remoteButtonEvent(quint8 code, bool pressed, const QString &name)
|
||||
void InputAppleRemote::remoteButtonEvent(quint8 code, bool pressed)
|
||||
{
|
||||
// This following code emulates the harmony remotes input to PHT. The Apple API is actually
|
||||
// limited to just the number of keys that are on Apple specific remotes so we had to work
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@ int main(int argc, char *argv[])
|
||||
parser.addOption(createProfileOption);
|
||||
|
||||
char **newArgv = appendCommandLineArguments(argc, argv, g_qtFlags);
|
||||
int newArgc = argc + g_qtFlags.size();
|
||||
int newArgc = argc + static_cast<int>(g_qtFlags.size());
|
||||
|
||||
preinitQt();
|
||||
|
||||
|
||||
@@ -583,10 +583,10 @@ void MprisComponent::notifySeek(qint64 positionMs)
|
||||
m_seekPending = false;
|
||||
}
|
||||
|
||||
void MprisComponent::notifyMetadata(const QVariantMap& metadata, const QString& baseUrl)
|
||||
void MprisComponent::notifyMetadata(const QVariantMap& metadata)
|
||||
{
|
||||
qDebug() << "MPRIS: Metadata update from JS";
|
||||
updateMetadata(metadata, QUrl(baseUrl));
|
||||
updateMetadata(metadata);
|
||||
}
|
||||
|
||||
void MprisComponent::notifyVolumeChange(double volume)
|
||||
@@ -767,10 +767,10 @@ void MprisComponent::onPlayerDurationChanged(qint64 duration)
|
||||
}
|
||||
}
|
||||
|
||||
void MprisComponent::onPlayerMetaData(const QVariantMap& metadata, const QUrl& baseUrl)
|
||||
void MprisComponent::onPlayerMetaData(const QVariantMap& metadata)
|
||||
{
|
||||
qDebug() << "MPRIS: Received metadata from PlayerComponent:" << metadata.value("Name").toString();
|
||||
updateMetadata(metadata, baseUrl);
|
||||
updateMetadata(metadata);
|
||||
}
|
||||
|
||||
void MprisComponent::onPlayerVolumeChanged()
|
||||
@@ -831,7 +831,7 @@ void MprisComponent::updatePlaybackStatus(const QString& status)
|
||||
}
|
||||
}
|
||||
|
||||
void MprisComponent::updateMetadata(const QVariantMap& jellyfinMeta, const QUrl& baseUrl)
|
||||
void MprisComponent::updateMetadata(const QVariantMap& jellyfinMeta)
|
||||
{
|
||||
QVariantMap mprisMeta;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
void notifyPlaybackState(const QString& state);
|
||||
void notifyPosition(qint64 positionMs);
|
||||
void notifySeek(qint64 positionMs);
|
||||
void notifyMetadata(const QVariantMap& metadata, const QString& baseUrl);
|
||||
void notifyMetadata(const QVariantMap& metadata);
|
||||
void notifyVolumeChange(double volume);
|
||||
|
||||
public Q_SLOTS:
|
||||
@@ -97,7 +97,7 @@ private Q_SLOTS:
|
||||
void onPlayerStateChanged(PlayerComponent::State newState, PlayerComponent::State oldState);
|
||||
void onPlayerPositionUpdate(quint64 position);
|
||||
void onPlayerDurationChanged(qint64 duration);
|
||||
void onPlayerMetaData(const QVariantMap& metadata, const QUrl& baseUrl);
|
||||
void onPlayerMetaData(const QVariantMap& metadata);
|
||||
void onPlayerVolumeChanged();
|
||||
void onShuffleModeChanged(bool shuffleEnabled);
|
||||
void onRepeatModeChanged(const QString& repeatMode);
|
||||
@@ -112,7 +112,7 @@ Q_SIGNALS:
|
||||
|
||||
private:
|
||||
void updatePlaybackStatus(const QString& status);
|
||||
void updateMetadata(const QVariantMap& jellyfinMeta, const QUrl& baseUrl = QUrl());
|
||||
void updateMetadata(const QVariantMap& jellyfinMeta);
|
||||
void emitPropertyChange(const QString& interface, const QString& property, const QVariant& value);
|
||||
void emitMultiplePropertyChanges(const QString& interface, const QVariantMap& properties);
|
||||
void connectPlayerSignals();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <QtGlobal>
|
||||
#include <QColorSpace>
|
||||
#include <QSurfaceFormat>
|
||||
#include <QCoreApplication>
|
||||
#include <QOpenGLContext>
|
||||
@@ -23,7 +24,7 @@ void detectOpenGLEarly()
|
||||
format.setMinorVersion(2);
|
||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||
// Fix oversaturated colors on HDR displays
|
||||
format.setColorSpace(QSurfaceFormat::sRGBColorSpace);
|
||||
format.setColorSpace(QColorSpace::SRgb);
|
||||
QSurfaceFormat::setDefaultFormat(format);
|
||||
}
|
||||
|
||||
|
||||
@@ -780,9 +780,9 @@ void PlayerComponent::notifySeek(qint64 positionMs)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void PlayerComponent::notifyMetadata(const QVariantMap& metadata, const QString& baseUrl)
|
||||
void PlayerComponent::notifyMetadata(const QVariantMap& metadata)
|
||||
{
|
||||
emit metadataChanged(metadata, baseUrl);
|
||||
emit metadataChanged(metadata);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -977,7 +977,7 @@ void PlayerComponent::reselectStream(const QVariant &streamSelection, MediaType
|
||||
|
||||
if (streamSelectionStr.startsWith("#"))
|
||||
{
|
||||
int splitPos = streamSelectionStr.indexOf(",");
|
||||
qsizetype splitPos = streamSelectionStr.indexOf(",");
|
||||
if (splitPos < 0)
|
||||
{
|
||||
// Stream from the main file
|
||||
@@ -1467,8 +1467,8 @@ void PlayerComponent::setOtherConfiguration()
|
||||
|
||||
for(const QString& configuration : configurationList)
|
||||
{
|
||||
int splitIndex = configuration.indexOf("=");
|
||||
int configurationLength = configuration.length();
|
||||
qsizetype splitIndex = configuration.indexOf("=");
|
||||
qsizetype configurationLength = configuration.length();
|
||||
if (splitIndex > 0 && splitIndex < configurationLength - 1)
|
||||
{
|
||||
QString configurationKey = configuration.left(splitIndex).remove(QRegularExpression("^([\"]+)")).remove(QRegularExpression("([\"]+)$"));
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
Q_INVOKABLE void notifyPlaybackState(const QString& state);
|
||||
Q_INVOKABLE void notifyPosition(qint64 positionMs);
|
||||
Q_INVOKABLE void notifySeek(qint64 positionMs);
|
||||
Q_INVOKABLE void notifyMetadata(const QVariantMap& metadata, const QString& baseUrl);
|
||||
Q_INVOKABLE void notifyMetadata(const QVariantMap& metadata);
|
||||
Q_INVOKABLE void notifyVolumeChange(double volume);
|
||||
|
||||
// 0-100 volume 0=mute and 100=normal
|
||||
@@ -217,7 +217,7 @@ Q_SIGNALS:
|
||||
void playbackStateChanged(const QString& state);
|
||||
void positionChanged(qint64 positionMs);
|
||||
void seekPerformed(qint64 positionMs);
|
||||
void metadataChanged(const QVariantMap& metadata, const QString& baseUrl);
|
||||
void metadataChanged(const QVariantMap& metadata);
|
||||
void volumeChanged(double volume);
|
||||
private:
|
||||
// this is the function actually implemented in the backends. the variantmap contains
|
||||
|
||||
@@ -159,19 +159,21 @@ private:
|
||||
dst->u.double_ = src.toDouble();
|
||||
} else if (src.canConvert<QVariantList>()) {
|
||||
QVariantList qlist = src.toList();
|
||||
mpv_node_list *list = create_list(dst, false, qlist.size());
|
||||
int size = static_cast<int>(qlist.size());
|
||||
mpv_node_list *list = create_list(dst, false, size);
|
||||
if (!list)
|
||||
goto fail;
|
||||
list->num = qlist.size();
|
||||
for (int n = 0; n < qlist.size(); n++)
|
||||
list->num = size;
|
||||
for (int n = 0; n < size; n++)
|
||||
set(&list->values[n], qlist[n]);
|
||||
} else if (src.canConvert<QVariantMap>()) {
|
||||
QVariantMap qmap = src.toMap();
|
||||
mpv_node_list *list = create_list(dst, true, qmap.size());
|
||||
int size = static_cast<int>(qmap.size());
|
||||
mpv_node_list *list = create_list(dst, true, size);
|
||||
if (!list)
|
||||
goto fail;
|
||||
list->num = qmap.size();
|
||||
for (int n = 0; n < qmap.size(); n++) {
|
||||
list->num = size;
|
||||
for (int n = 0; n < size; n++) {
|
||||
list->keys[n] = dup_qstring(qmap.keys()[n]);
|
||||
if (!list->keys[n]) {
|
||||
free_node(dst);
|
||||
|
||||
@@ -91,7 +91,7 @@ void SettingsComponent::cycleSettingCommand(const QString& args)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void SettingsComponent::setSettingCommand(const QString& args)
|
||||
{
|
||||
int spaceIndex = args.indexOf(" ");
|
||||
qsizetype spaceIndex = args.indexOf(" ");
|
||||
if (spaceIndex < 0)
|
||||
{
|
||||
qCritical() << "No value provided to settings set command.";
|
||||
@@ -99,7 +99,7 @@ void SettingsComponent::setSettingCommand(const QString& args)
|
||||
}
|
||||
QString settingName = args.mid(0, spaceIndex);
|
||||
QString settingValue = args.mid(spaceIndex + 1);
|
||||
int subIndex = settingName.indexOf(".");
|
||||
qsizetype subIndex = settingName.indexOf(".");
|
||||
if (subIndex < 0 || subIndex == args.size() - 1)
|
||||
{
|
||||
qCritical() << "Setting must be in the form section.name but got:" << settingName;
|
||||
|
||||
@@ -221,7 +221,7 @@ QString SystemComponent::extractBaseUrl(const QString& url)
|
||||
QString path = parsedUrl.path();
|
||||
|
||||
// Find last occurrence of "/web" in path only (case-insensitive)
|
||||
int webIndex = path.toLower().lastIndexOf("/web");
|
||||
qsizetype webIndex = path.toLower().lastIndexOf("/web");
|
||||
|
||||
if (webIndex >= 0) {
|
||||
// Truncate path at /web
|
||||
|
||||
@@ -87,7 +87,7 @@ void WindowManager::initializeWindow(QQuickWindow* window)
|
||||
m_geometrySaveTimer = new QTimer(this);
|
||||
m_geometrySaveTimer->setSingleShot(true);
|
||||
m_geometrySaveTimer->setInterval(30000);
|
||||
connect(m_geometrySaveTimer, &QTimer::timeout, this, [this]() {
|
||||
connect(m_geometrySaveTimer, &QTimer::timeout, this, []() {
|
||||
// STATE section is storage, so use saveStorage()
|
||||
SettingsComponent::Get().saveStorage();
|
||||
});
|
||||
@@ -571,7 +571,7 @@ void WindowManager::loadGeometry()
|
||||
// Config key helpers (per-screen-configuration)
|
||||
QString WindowManager::configKeyPrefix() const
|
||||
{
|
||||
int screenCount = QGuiApplication::screens().size();
|
||||
auto screenCount = QGuiApplication::screens().size();
|
||||
if (screenCount == 1)
|
||||
{
|
||||
QScreen* primary = QGuiApplication::primaryScreen();
|
||||
|
||||
+3
-3
@@ -58,16 +58,16 @@ static void qtMessageOutput(QtMsgType type, const QMessageLogContext& context, c
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
static void elidePattern(QString& msg, const QString& substring, int chars)
|
||||
static void elidePattern(QString& msg, const QString& substring, qsizetype chars)
|
||||
{
|
||||
int start = 0;
|
||||
qsizetype start = 0;
|
||||
while (true)
|
||||
{
|
||||
start = msg.indexOf(substring, start);
|
||||
if (start < 0 || start + substring.length() + chars > msg.length())
|
||||
break;
|
||||
start += substring.length();
|
||||
for (int n = 0; n < chars; n++)
|
||||
for (qsizetype n = 0; n < chars; n++)
|
||||
msg[start + n] = QChar('x');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user