This is far less code and allows for an easier enforcing of standards, for
example the name of the log identifiers which were adjusted in a few cases.
Also clean up unused includes when noticed.
By commenting out the parameter name, we get compile-time checks
Also, we can omit them for slots and Qt will not forward the parameters.
In case we had TODOs next to the code, I kept the Q_UNUSED statements
for now.
- We do not need the return type. If a plugin declares it can handle the
packet it should do so. We don't have any fallback logic in place and
the packet types are namespaced with the plugin IDs anyway.
- Provide a default implementation with a warning, not all plugins need
to overwrite this
The rationale is explained in https://planet.kde.org/friedrich-kossebau-2023-06-28-include-also-moc-files-of-headers/
In case of KDEConnect, it impressively speeds up compilation. Before it
took 390 seconds on a clean build and with this change it took 330 seconds.
This is due to the mocs_compilation having to include the header files
and thus all their headers. Due to the lots of small plugins we have,
this means that the same headers must be compiled plenty of times.
When we include the moc files directly in the C++ file, they are already
available.
* Moves the XML definitions of DBus interfaces and code generation from the different plugins
to kdeconnectinterfaces. Before each plugin had their own, some of them duplicated.
* Appends `// clazy:skip` to the generated interface files, so Clazy doesn't emit warnings
about them because they are missing the NOTIFY/CONSTANT keywords on Q_PROPERTIES.
* Makes kdeconnectinterfaces static on Qt5 as well (removes a difference with Qt6).
* Moves the generated files to a `generated` directory and updates the includes so they are
easily distinguished from other header files.
We've had separate title & artist for a while, and all clients should be
using those by now.
Also fixes the position change not being emitted when the song changes,
and fixes the values being written after emitting that they changed.
Better patch to replace !218.
- Auto and quick detection of previous D-Bus instance;
- Remove private D-Bus compile definition, only use it on macOS without an existing D-Bus instance;
- Safe reboot after crashes because the indicator is not relating on the kdeconnectd to run a D-Bus session;
- Safe exit after clicking on `Quit` in the systray.
More details in commit logs:
Only enable private D-Bus on macOS because the other platforms do not
need them.
The app should be able to easily detect the session bus from the env
DBUS_LAUNCHD_SESSION_BUS_SOCKET from launchd through launchctl.
Because https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/dbus/dbus-sysdeps-unix.c#L4392
shows that it is the only probing method on macOS with launchd.
The D-Bus session bus can be easily found from launchd/launchctl
with DBUS_LAUNCHD_SESSION_BUS_SOCKET env. It can be an external one
(installed from HomeBrew) or an internal one (launched by a previous
instance followed by a crash).
The indicator helper on macOS can now automatically detect whether we can use a potentially
(with launchd/launchctl env set, or KDE Connect macOS
private_bus_address set) existed and usable session bus.
If previous bus is usable, just try to launch the kdeconnectd with us.
Otherwise, launch a private D-Bus daemon, export the launchd/launchctl
env, and run a kdeconnectd instance.
Everything works better and quicker now :)
This automatizes the generation of logging categories so a
kdeconnect-kde.categories is generated and installed to
/usr/share/qlogging-categories5/ so kdebugsettings can use it.
Also, sets the default logging level to Warning. So now the logs
of users won't be filled with debug messages but they can
modify the configuration easily with kdebugsettings.
playerctld (https://github.com/altdesktop/playerctl/issues/161) is a proxy daemon for the currently active player by playerctl, which facilitates managing mpris players, forwarding requests to the currently active/last active player, and sorting out troubles with selecting the correct player manually.
Unfortunately, it also creates an annoying issue with kdeconnect: when playing media on the phone, kdeconnect publishes the state to the computer through the mprisremote plugin - then, playerctld picks it up as active player, and registers its own mpris media player. As a result, the mpriscontrol plugin sees this as a running media player, and in turn, publishes the state back to the phone, essentially creating another media session on the phone, resulting in two notifications. As playerctld is _always_ only a proxy to another media player (or kdeconnect), it can safely be ignored, just like kdeconnect itself already is. This commit adds an if check doing exactly that.
Summary:
The current behavior in plasma-workspace's mediacontroller is to get the
title and the album info from the URL contained in the MPRIS metadata,
if it is dealing with a local file and missing title and artist. This
commit aligns the behavior to the one mediacontroller has.
Reviewers: #kde_connect, nicolasfella
Reviewed By: #kde_connect, nicolasfella
Subscribers: nicolasfella, kdeconnect
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D26097
Summary: If the android code sees a file url, and album art is needed, it will start a request to transfer the album art. This code does some sanity checks to prevent abuse and then transfers the album art.
Test Plan: Art is transferred succesfully.
Reviewers: #kde_connect, nicolasfella, albertvaka
Reviewed By: #kde_connect, albertvaka
Subscribers: nicolasfella, albertvaka
Differential Revision: https://phabricator.kde.org/D11017
Summary:
Not sure what operator+ overload has been used exactly for the int,
in any case it does not work as intended and needs e.g. an explicit
QString::number() invocation.
Also start with number 2 for duplicated instances.
Test Plan:
Start multiple instances of an MPRIS player (e.g. Gwenview). Before the
second instance would get labelled with "Name []", with this patch it is
labelled with "Name [2]".
Reviewers: #kde_connect, mtijink
Reviewed By: #kde_connect, mtijink
Subscribers: mtijink, nicolasfella
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D11411
Summary:
If MPRIS players were appearing and disappearing multiple times, the
OrgFreedesktopDBusPropertiesInterface & OrgMprisMediaPlayer2PlayerInterface
instances created for listening to the signals had been accumulating and
thus resulting in X signals per X restarted player, because the instances
were not deleted when a player disappeared.
Additionally were instances of them created on the fly on the stack in
some of the methods, instead of reusing the existing ones.
This patch changes that by introducing a class MprisPlayer which holds all
data & instances per player. This allows to look up the respective
interfaces instances to reuse them as well as properly controlling their
lifetime.
Test Plan:
Starting and restarting multiple MPRIS players (incl. multiple instances of
the same player app) works as expected as befire. They are listed on the
Android Media control as well as have proper states there when selected.
Additionally no longer multiple change signals are emitted if restarting a
player.
Reviewers: #kde_connect, mtijink
Reviewed By: #kde_connect, mtijink
Subscribers: mtijink
Differential Revision: https://phabricator.kde.org/D11389
Summary: KDE Connect, now with correct naming!
Test Plan: It still builds.
Reviewers: #kde_connect, apol, nicolasfella
Reviewed By: #kde_connect, apol, nicolasfella
Subscribers: nicolasfella
Differential Revision: https://phabricator.kde.org/D11036
Summary: Sends the album art url, so that the android app can display the album art (by fetching it from the internet). Transferring local album art is not supported yet, but can be added in a future diff.
Test Plan: Works for me in players with/without album art and with/without local file album art.
Reviewers: #kde_connect, nicolasfella
Reviewed By: #kde_connect, nicolasfella
Differential Revision: https://phabricator.kde.org/D9563
Summary: This diff adds the title, artist and album to the MPRIS network packets. That's useful when you need more detail than just "artist - title", for example in the future media control notification. It also fixes weird song descriptions for empty artist strings (e.g. Spotify uses an empty (but present) artist when playing ads)
Reviewers: #kde_connect, apol
Reviewed By: #kde_connect, apol
Subscribers: nicolasfella, apol
Differential Revision: https://phabricator.kde.org/D8957
Summary:
Add a number in brackets to distinguish different players with the same display name so that they can all be controlled.
See this task: https://phabricator.kde.org/T6500
Reviewers: #kde_connect
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D7017
Summary:
The use of Q_FOREACH is advised against (https://doc.qt.io/qt-5/qtglobal.html#Q_FOREACH) since Qt 5.7 and will eventually be removed from Qt.
I replaced all occurrences with the range-for loop introduced in C++11 (except for the one in daemon.cpp in deviceIdByName which might have a bug / typo in it).
I added const to the container or casted it with qAsConst when appropriate to avoid unnecessary copies.
(This is my first submission. I did all the unit tests, and they all passed but I don't know how to show it here.)
Reviewers: #kde_connect, nicolasfella, apol
Reviewed By: #kde_connect, nicolasfella, apol
Subscribers: albertvaka, apol, nicolasfella
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D6724
This was very poorly implemented and can't stay as it is right now:
- Every second or so the art image was being loaded from disk, scaled,
base64 encoded and sent over the freakin network!
- The Android interface didn't take into account small screens, and
adding the image would cut stuff out of the screen.
- Didn't manage "edge cases" like playing a song without cover after one
with cover (previous image was still being shown) or changing players.
This reverts commit e66096d05a.
# Conflicts:
# plugins/mpriscontrol/mpriscontrolplugin.cpp
Makes it possible to specify the different properties sent at once,
rather than one by one as we used to do.
Also port whenever possible to the initializer-list syntax.
REVIEW: 128269
Right now we only support album art if the player provides a local URL,
but some players provide a remote URL (spotify) I'll be adding support
for that in a later patch.
REVIEW: 128199
The previous used QDbusServiceWatcher doesn't work as it does only watch out
for specific services, but the players use different, unpredictable names, so
we need to check all service registrations for mpris players.
BUG: 361367
REVIEW: 127611
media player services are not registered as org.mpris.MediaPlayer2 just
use a service name that starts with that. We need to watch all services
and then filter.
BUG: 352529
Reviewed-by: Albert Vaca
We used to have the following warning: "Connecting to deprecated signal
QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)"
Port away from it as recommended in Qt documentation.
REVIEW: 123637