forked from quickshell/quickshell
service/mpris: preserve mpris watcher and players across reload
This commit is contained in:
parent
9d5dd402b9
commit
b1f5a5eb94
4 changed files with 29 additions and 11 deletions
|
@ -16,7 +16,7 @@ namespace qs::service::mpris {
|
|||
|
||||
Q_LOGGING_CATEGORY(logMprisWatcher, "quickshell.service.mpris.watcher", QtWarningMsg);
|
||||
|
||||
MprisWatcher::MprisWatcher(QObject* parent): QObject(parent) {
|
||||
MprisWatcher::MprisWatcher() {
|
||||
qCDebug(logMprisWatcher) << "Starting MprisWatcher";
|
||||
|
||||
auto bus = QDBusConnection::sessionBus();
|
||||
|
@ -102,4 +102,13 @@ void MprisWatcher::registerPlayer(const QString& address) {
|
|||
qCDebug(logMprisWatcher) << "Registered MprisPlayer" << address;
|
||||
}
|
||||
|
||||
MprisWatcher* MprisWatcher::instance() {
|
||||
static MprisWatcher* instance = new MprisWatcher(); // NOLINT
|
||||
return instance;
|
||||
}
|
||||
|
||||
ObjectModel<MprisPlayer>* MprisQml::players() { // NOLINT
|
||||
return MprisWatcher::instance()->players();
|
||||
}
|
||||
|
||||
} // namespace qs::service::mpris
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue