#4 Add initial page to enable OpenH264 codec
Opened 8 months ago by siosm. Modified 7 months ago
fedora-kde/ siosm/plasma-welcome-fedora main-openh264  into  main

@@ -0,0 +1,96 @@ 

+ /*

+  *  SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>

+  *  SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org>

+  *

+  *  SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL

+  */

+ 

+ import QtQuick

+ import QtQuick.Controls as QQC2

+ import QtQuick.Layouts

+ import org.kde.kirigami as Kirigami

+ import Qt5Compat.GraphicalEffects

+ 

+ import org.kde.plasma.welcome

+ 

+ GenericPage {

+     heading: i18nc("@info:window", "Install the OpenH264 codec")

+     description: xi18nc("@info:usagetip", "Cisco provides an OpenH264 codec (as a source and a binary), which is their of implementation of the H.264 codec, and they cover all licensing fees for all parties using their binary.")

+     id: root

+     topContent: [

+         Kirigami.UrlButton {

+             id: thirdPartyInfoLink

+             Layout.topMargin: Kirigami.Units.largeSpacing

+             text: i18nc("@action:button", "Learn more about the OpenH264 codec in Fedora")

+             url: "https://docs.fedoraproject.org/en-US/quick-docs/openh264/"

+         },

+         QQC2.Label {

+             id: ostreeWarning

+             Layout.fillWidth: true

+             text: "Note: Due to current limitations on Fedora Kinoite, installing the OpenH264 codec on the system will make applying updates slower."

+             wrapMode: Text.WordWrap

+             visible: false

+             Layout.topMargin: Kirigami.Units.largeSpacing

+         },

+         QQC2.Button {

+             id: installOpenh264

+             text: "Install the OpenH264 codec"

+             onClicked: {

+                 if (root.isOstree) {

+                     console.log('Installing openh264 via rpm-ostree');

+                     Controller.runCommand("pkexec rpm-ostree override remove noopenh264 --install openh264 --install mozilla-openh264");

+                 } else {

+                     console.log('Installing openh264 via dnf');

+                     Controller.runCommand("pkexec dnf install -y openh264");

+                 }

+                 showPassiveNotification(i18n("The OpenH264 codec is being installed in the background."));

+                 uninstallOpenh264.visible = true;

+                 installOpenh264.visible = false;

+             }

+             Layout.topMargin: Kirigami.Units.largeSpacing

+         },

+         QQC2.Button {

+             id: uninstallOpenh264

+             text: "Uninstall the OpenH264 codec"

+             visible: false

+             onClicked: {

+                 if (root.isOstree) {

+                     console.log('Uninstalling openh264 via rpm-ostree');

+                     Controller.runCommand("pkexec rpm-ostree override reset noopenh264 --uninstall openh264 --uninstall mozilla-openh264");

+                 } else {

+                     console.log('Uninstalling openh264 via dnf');

+                     Controller.runCommand("pkexec dnf remove -y openh264");

+                 }

+                 showPassiveNotification(i18n("The OpenH264 codec is being uninstalled in the background."));

+                 uninstallOpenh264.visible = false;

+                 installOpenh264.visible = true;

+             }

+             Layout.topMargin: Kirigami.Units.largeSpacing

+         }

+     ]

+     Component.onCompleted: {

+         Controller.runCommand("rpm -qi openh264", rpmCallback);

+         Controller.runCommand("test -f /run/ostree-booted", ostreeCallback);

+     }

+     property var rpmCallback: (returnStatus, outputText) => {

+         if (returnStatus == 0) {

+             uninstallOpenh264.visible = true;

+             installOpenh264.visible = false;

+             console.log('OpenH264 package is installed');

+         } else {

+             uninstallOpenh264.visible = false;

+             installOpenh264.visible = true;

+             console.log('OpenH264 package is not installed');

+         }

+     }

+     property var ostreeCallback: (returnStatus, outputText) => {

+         if (returnStatus == 0) {

+             ostreeWarning.visible = true;

+             root.isOstree = true;

+             console.log('Running on Kinoite');

+         } else {

+             console.log('Not running on Kinoite');

+         }

+     }

+     property var isOstree: false

+ }

7 new commits added

  • Add initial page to enable OpenH264 codec
  • ThirdPartyRepos: Clean up state logic
  • ThirdPartyRepos: Fix disable passive text
  • ThirdPartyRepos: Remove root.padding
  • ThirdPartyRepos: Link to Fedora License policy
  • ThirdPartyRepos: Directly point to software list
  • ThirdPartyRepos: Add more context
8 months ago

8 new commits added

  • OpenH264: Add initial page to install/uninstall codec
  • ThirdPartyRepos: Images are visible by default
  • ThirdPartyRepos: Clean up state logic
  • ThirdPartyRepos: Fix disable passive text
  • ThirdPartyRepos: Remove root.padding
  • ThirdPartyRepos: Link to Fedora License policy
  • ThirdPartyRepos: Directly point to software list
  • ThirdPartyRepos: Add more context
8 months ago

I've now fully tested it as working on Fedora Kinoite. Not tested on KDE Spin.

Can we please flip this logic? In other words, use if (root.isOstree) instead?

Is there a way to flag the OpenH264 page to not show up if OpenH264 is already installed?

Can we please flip this logic? In other words, use if (root.isOstree) instead?

Is there a way to flag the OpenH264 page to not show up if OpenH264 is already installed?

I'm not sure there / I don't know how to do it.

8 new commits added

  • OpenH264: Add initial page to install/uninstall codec
  • ThirdPartyRepos: Images are visible by default
  • ThirdPartyRepos: Clean up state logic
  • ThirdPartyRepos: Fix disable passive text
  • ThirdPartyRepos: Remove root.padding
  • ThirdPartyRepos: Link to Fedora License policy
  • ThirdPartyRepos: Directly point to software list
  • ThirdPartyRepos: Add more context
8 months ago

Can we please flip this logic? In other words, use if (root.isOstree) instead?

Done

Is there a way to flag the OpenH264 page to not show up if OpenH264 is already installed?

I'm not sure there / I don't know how to do it.

Then could we gray out the button instead of offering a way to uninstall it?

@ngompa would there be a way in the spec to delete the file if they are NOT in an rpmostree system?

We could subpackage the page, though.

@ngompa would there be a way in the spec to delete the file if they are NOT in an rpmostree system?

The goal is not to remove the page on ostree systems but to remove it on systems where openh264 is already installed, ostree or not, so it has to be dynamic

We'll likely have to ask upstream if and how to do it.

Yeah, it's not just that though. Fedora Asahi systems will almost always have OpenH264 installed before first login, so this page would be superfluous in that case.

Is there a way to flag the OpenH264 page to not show up if OpenH264 is already installed?

I'm not sure there / I don't know how to do it.

Then could we gray out the button instead of offering a way to uninstall it?

If we offer a way to install it then we should offer the reverse as well, other wise it's going to be confusing to users if they click on the button by mistake.

Or we completely disable the button and both pages if the third party repos / openh264 are already installed and remove the button once clicked installed as the installation will happen in the background anyway and won't be instant so you won't be able to directly uninstall it.

Maybe we need a small KCM page in the settings that is capable of adding/removing those so that we have a place to point users to after the plasma-welcome screen.

According to https://pagure.io/fedora-kde/SIG/issue/549#comment-921374 it's not need for the KDE Spin and only for Kinoite so indeed we can split this into a another sub-package.

We'd also want the skip logic so that these pages don't show up every time plasma welcome relaunches with new Plasma versions, so the RFE is still useful.

We'd also want the skip logic so that these pages don't show up every time plasma welcome relaunches with new Plasma versions, so the RFE is still useful.

That's not the same thing. The thing that pops when plasma gets updated afaik does not pop the custom pages, it's just that "You have been upgraded to plasma 6.x!" page.

Just double-checked, correct. Those pages don't show there.

rebased onto d8949a3

7 months ago

Let's hold on this one for F41 and I'll try it in F42. I'll try to do the workaround from https://bugs.kde.org/show_bug.cgi?id=491061.