Browse Source

Merge branch 'master' into test

Ian Walton 3 years ago
parent
commit
d3a5a62b6f

+ 2 - 1
native/nativeshell.js

@@ -13,7 +13,8 @@ const features = [
     "filedownload",
     "remotevideo",
     "displaymode",
-    "screensaver"
+    "screensaver",
+    "fileinput"
 ];
 
 const plugins = [

+ 2 - 2
resources/settings/settings_description.json

@@ -1,7 +1,7 @@
 [
   {
     "section": "__meta__",
-    "version": 5
+    "version": 6
   },
   {
     "section": "state",
@@ -223,7 +223,7 @@
       },
       {
         "value": "hardwareDecoding",
-        "default": "enabled",
+        "default": "copy",
         "possible_values": [
           [ "enabled", "video.decode.enabled", { "platforms_excluded": "osx" } ],
           [ "enabled", "video.decode.enabled.modern", { "platforms": "osx" } ],

+ 14 - 5
src/settings/SettingsComponent.cpp

@@ -214,14 +214,19 @@ void SettingsComponent::load()
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 void SettingsComponent::loadConf(const QString& path, bool storage)
 {
-  bool migrateJmpSettings = false;
+  bool migrateJmpSettings4 = false;
+  bool migrateJmpSettings5 = false;
   QJsonObject json = loadJson(path);
 
   int version = json["version"].toInt(0);
 
-  if (version == 4 && m_settingsVersion == 5)
+  if (version == 4 && m_settingsVersion == 6)
   {
-    migrateJmpSettings = true;
+    migrateJmpSettings4 = true;
+  }
+  else if (version == 5 && m_settingsVersion == 6)
+  {
+    migrateJmpSettings5 = true;
   }
   else if (version != m_settingsVersion)
   {
@@ -264,11 +269,15 @@ void SettingsComponent::loadConf(const QString& path, bool storage)
       sec->setValue(setting, jsonSection.value(setting).toVariant());
   }
 
-  if (migrateJmpSettings) {
+  if (migrateJmpSettings4) {
     getSection(SETTINGS_SECTION_MAIN)->setValue("webMode", "desktop");
     getSection(SETTINGS_SECTION_MAIN)->setValue("layout", "desktop");
     if (getSection(SETTINGS_SECTION_VIDEO)->value("hardwareDecoding") == "disabled") {
-      getSection(SETTINGS_SECTION_VIDEO)->setValue("hardwareDecoding", "enabled");
+      getSection(SETTINGS_SECTION_VIDEO)->setValue("hardwareDecoding", "copy");
+    }
+  } else if (migrateJmpSettings5) {
+    if (getSection(SETTINGS_SECTION_VIDEO)->value("hardwareDecoding") == "enabled") {
+      getSection(SETTINGS_SECTION_VIDEO)->setValue("hardwareDecoding", "copy");
     }
   }
 }

+ 45 - 10
src/taskbar/TaskbarComponentWin.cpp

@@ -195,6 +195,11 @@ void TaskbarComponentWin::initializeMediaTransport(HWND hwnd)
   hr = m_systemControls->put_IsPauseEnabled(true);
   hr = m_systemControls->put_IsPreviousEnabled(true);
   hr = m_systemControls->put_IsNextEnabled(true);
+  hr = m_systemControls->put_IsStopEnabled(true);
+  hr = m_systemControls->put_IsRewindEnabled(true);
+  hr = m_systemControls->put_IsFastForwardEnabled(true);
+  hr = m_systemControls->put_IsChannelDownEnabled(true);
+  hr = m_systemControls->put_IsChannelUpEnabled(true);
 
   hr = m_systemControls->get_DisplayUpdater(&m_displayUpdater);
   if (FAILED(hr))
@@ -330,21 +335,39 @@ void TaskbarComponentWin::setVideoMeta(const QVariantMap& meta)
 /////////////////////////////////////////////////////////////////////////////////////////
 void TaskbarComponentWin::setThumbnail(const QVariantMap& meta, QUrl baseUrl)
 {
+  QString imgUrl;
+  HRESULT hr;
+
   auto images = meta["ImageTags"].toMap();
-  if (!images.contains("Primary"))
+  if (images.contains("Primary"))
+  {
+    auto itemId = meta["Id"].toString();
+    auto imgTag = images["Primary"].toString();
+    QUrlQuery query;
+    query.addQueryItem("tag", imgTag);
+    baseUrl.setPath("/Items/" + itemId + "/Images/Primary");
+    baseUrl.setQuery(query);
+    imgUrl = baseUrl.toString();
+  }
+  else if (meta.contains("AlbumId") && meta.contains("AlbumPrimaryImageTag")
+           && meta["AlbumId"].canConvert(QMetaType::QString)
+           && meta["AlbumPrimaryImageTag"].canConvert(QMetaType::QString))
+  {
+    auto itemId = meta["AlbumId"].toString();
+    auto imgTag = meta["AlbumPrimaryImageTag"].toString();
+    QUrlQuery query;
+    query.addQueryItem("tag", imgTag);
+    baseUrl.setPath("/Items/" + itemId + "/Images/Primary");
+    baseUrl.setQuery(query);
+    imgUrl = baseUrl.toString();
+  }
+  else
   {
     QLOG_DEBUG() << "No Primary image found. Do nothing";
     return;
   }
 
-  HRESULT hr;
-  auto itemId = meta["Id"].toString();
-  auto imgTag = images["Primary"].toString();
-  QUrlQuery query;
-  query.addQueryItem("tag", imgTag);
-  baseUrl.setPath("/Items/" + itemId + "/Images/Primary");
-  baseUrl.setQuery(query);
-  auto imgUrl = baseUrl.toString();
+  
 
   ComPtr<IRandomAccessStreamReferenceStatics> streamRefFactory;
   hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Storage_Streams_RandomAccessStreamReference).Get(),
@@ -420,11 +443,23 @@ HRESULT TaskbarComponentWin::buttonPressed(ISystemMediaTransportControls* sender
       InputComponent::Get().sendAction("stop");
       QLOG_DEBUG() << "Received stop button press";
       break;
-    case SystemMediaTransportControlsButton::SystemMediaTransportControlsButton_Record:
     case SystemMediaTransportControlsButton::SystemMediaTransportControlsButton_FastForward:
+      InputComponent::Get().sendAction("seek_forward");
+      QLOG_DEBUG() << "Received seek_forward button press";
+      break;
     case SystemMediaTransportControlsButton::SystemMediaTransportControlsButton_Rewind:
+      InputComponent::Get().sendAction("seek_backward");
+      QLOG_DEBUG() << "Received seek_backward button press";
+      break;
     case SystemMediaTransportControlsButton::SystemMediaTransportControlsButton_ChannelUp:
+      InputComponent::Get().sendAction("channelup");
+      QLOG_DEBUG() << "Received channelup button press";
+      break;
     case SystemMediaTransportControlsButton::SystemMediaTransportControlsButton_ChannelDown:
+      InputComponent::Get().sendAction("channeldown");
+      QLOG_DEBUG() << "Received channeldown button press";
+      break;
+    case SystemMediaTransportControlsButton::SystemMediaTransportControlsButton_Record:
       QLOG_DEBUG() << "Received unsupported button press";
       break;
   }

+ 17 - 11
src/ui/EventFilter.cpp

@@ -12,9 +12,6 @@
 #include <QKeyEvent>
 #include <QObject>
 
-#ifdef Q_OS_WIN
-static QStringList desktopWhiteListedKeys = { "Back"};
-#else
 static QStringList desktopWhiteListedKeys = { "Media Play",
                                               "Media Pause",
                                               "Media Stop",
@@ -23,10 +20,15 @@ static QStringList desktopWhiteListedKeys = { "Media Play",
                                               "Media Rewind",
                                               "Media FastForward",
                                               "Back"};
-#endif
 
 // These just happen to be mostly the same.
-static QStringList win32AppcommandBlackListedKeys = desktopWhiteListedKeys;
+static QStringList win32BlackListedKeys = { "Media Play",
+                                                      "Media Pause",
+                                                      "Media Stop",
+                                                      "Media Next",
+                                                      "Media Previous",
+                                                      "Media Rewind",
+                                                      "Media FastForward"};
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 static QString keyEventToKeyString(QKeyEvent *kevent)
@@ -84,6 +86,13 @@ bool EventFilter::eventFilter(QObject* watched, QEvent* event)
           keystatus = InputBase::KeyUp;
 
         QString seq = keyEventToKeyString(key);
+#ifdef Q_OS_WIN32
+        if (win32BlackListedKeys.contains(seq))
+        {
+          return true;
+        }
+#endif
+
         if (desktopWhiteListedKeys.contains(seq))
         {
           InputKeyboard::Get().keyPress(seq, keystatus);
@@ -143,12 +152,9 @@ bool EventFilter::eventFilter(QObject* watched, QEvent* event)
     QString keyName = keyEventToKeyString(kevent);
 
 #ifdef Q_OS_WIN32
-    // On Windows, we get some media keys twice. This is because Windows supports both
-    // normal key events and APPCOMMAND_ messages for media keys. To avoid getting two
-    // key events per key press, filter out non-APPCOMMAND media keys by using the fact
-    // that APPCOMMAND media keys won't have a key code.
-    if (win32AppcommandBlackListedKeys.contains(keyName) && kevent->nativeVirtualKey())
-      return QObject::eventFilter(watched, event);
+    // On Windows, ignore media keys as they are handled elsewhere.
+    if (win32BlackListedKeys.contains(keyName))
+      return true;
 #endif
 
     if (keystatus == InputBase::KeyDown)