@@ -31,6 +31,7 @@
|
||||
#include "osdbase.h"
|
||||
#include "osdpretty.h"
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/application.h"
|
||||
#include "core/logging.h"
|
||||
#ifdef Q_OS_MACOS
|
||||
@@ -43,7 +44,7 @@
|
||||
|
||||
const char *OSDBase::kSettingsGroup = "OSD";
|
||||
|
||||
OSDBase::OSDBase(std::shared_ptr<SystemTrayIcon> tray_icon, Application *app, QObject *parent)
|
||||
OSDBase::OSDBase(SharedPtr<SystemTrayIcon> tray_icon, Application *app, QObject *parent)
|
||||
: QObject(parent),
|
||||
app_(app),
|
||||
tray_icon_(tray_icon),
|
||||
@@ -61,7 +62,7 @@ OSDBase::OSDBase(std::shared_ptr<SystemTrayIcon> tray_icon, Application *app, QO
|
||||
ignore_next_stopped_(false),
|
||||
playing_(false) {
|
||||
|
||||
QObject::connect(app_->current_albumcover_loader(), &CurrentAlbumCoverLoader::ThumbnailLoaded, this, &OSDBase::AlbumCoverLoaded);
|
||||
QObject::connect(&*app_->current_albumcover_loader(), &CurrentAlbumCoverLoader::ThumbnailLoaded, this, &OSDBase::AlbumCoverLoaded);
|
||||
|
||||
app_name_[0] = app_name_[0].toUpper();
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
@@ -33,6 +31,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QImage>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/song.h"
|
||||
#include "playlist/playlistsequence.h"
|
||||
|
||||
@@ -44,7 +43,7 @@ class OSDBase : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OSDBase(std::shared_ptr<SystemTrayIcon> tray_icon, Application *app, QObject *parent = nullptr);
|
||||
explicit OSDBase(SharedPtr<SystemTrayIcon> tray_icon, Application *app, QObject *parent = nullptr);
|
||||
~OSDBase() override;
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
@@ -97,7 +96,7 @@ class OSDBase : public QObject {
|
||||
|
||||
private:
|
||||
Application *app_;
|
||||
std::shared_ptr<SystemTrayIcon> tray_icon_;
|
||||
SharedPtr<SystemTrayIcon> tray_icon_;
|
||||
OSDPretty *pretty_popup_;
|
||||
|
||||
QString app_name_;
|
||||
|
||||
@@ -41,10 +41,13 @@
|
||||
#include <QDBusPendingCallWatcher>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/scoped_ptr.h"
|
||||
#include "osddbus.h"
|
||||
|
||||
#include "notification.h"
|
||||
|
||||
using std::make_unique;
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const QImage &image) {
|
||||
|
||||
if (image.isNull()) {
|
||||
@@ -101,7 +104,7 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QImage &image) {
|
||||
|
||||
}
|
||||
|
||||
OSDDBus::OSDDBus(std::shared_ptr<SystemTrayIcon> tray_icon, Application *app, QObject *parent)
|
||||
OSDDBus::OSDDBus(SharedPtr<SystemTrayIcon> tray_icon, Application *app, QObject *parent)
|
||||
: OSDBase(tray_icon, app, parent),
|
||||
version_(1, 1),
|
||||
notification_id_(0) {
|
||||
@@ -114,7 +117,7 @@ OSDDBus::~OSDDBus() = default;
|
||||
|
||||
void OSDDBus::Init() {
|
||||
|
||||
interface_ = std::make_unique<OrgFreedesktopNotificationsInterface>(OrgFreedesktopNotificationsInterface::staticInterfaceName(), "/org/freedesktop/Notifications", QDBusConnection::sessionBus());
|
||||
interface_ = make_unique<OrgFreedesktopNotificationsInterface>(OrgFreedesktopNotificationsInterface::staticInterfaceName(), "/org/freedesktop/Notifications", QDBusConnection::sessionBus());
|
||||
if (!interface_->isValid()) {
|
||||
qLog(Warning) << "Error connecting to notifications service.";
|
||||
}
|
||||
@@ -173,7 +176,7 @@ void OSDDBus::ShowMessageNative(const QString &summary, const QString &message,
|
||||
|
||||
void OSDDBus::CallFinished(QDBusPendingCallWatcher *watcher) {
|
||||
|
||||
std::unique_ptr<QDBusPendingCallWatcher> w(watcher);
|
||||
ScopedPtr<QDBusPendingCallWatcher> w(watcher);
|
||||
|
||||
QDBusPendingReply<uint> reply = *w;
|
||||
if (reply.isError()) {
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
@@ -35,6 +33,7 @@
|
||||
#include <QDBusArgument>
|
||||
#include <QVersionNumber>
|
||||
|
||||
#include "core/scoped_ptr.h"
|
||||
#include "osdbase.h"
|
||||
|
||||
class OrgFreedesktopNotificationsInterface;
|
||||
@@ -47,7 +46,7 @@ class OSDDBus : public OSDBase {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OSDDBus(std::shared_ptr<SystemTrayIcon> tray_icon, Application *app, QObject *parent = nullptr);
|
||||
explicit OSDDBus(SharedPtr<SystemTrayIcon> tray_icon, Application *app, QObject *parent = nullptr);
|
||||
~OSDDBus() override;
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
@@ -63,7 +62,7 @@ class OSDDBus : public OSDBase {
|
||||
void CallFinished(QDBusPendingCallWatcher *watcher);
|
||||
|
||||
private:
|
||||
std::unique_ptr<OrgFreedesktopNotificationsInterface> interface_;
|
||||
ScopedPtr<OrgFreedesktopNotificationsInterface> interface_;
|
||||
QVersionNumber version_;
|
||||
uint notification_id_;
|
||||
QDateTime last_notification_time_;
|
||||
|
||||
@@ -37,7 +37,7 @@ class OSDMac : public OSDBase {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OSDMac(std::shared_ptr<SystemTrayIcon> tray_icon, Application *app, QObject *parent = nullptr);
|
||||
explicit OSDMac(SharedPtr<SystemTrayIcon> tray_icon, Application *app, QObject *parent = nullptr);
|
||||
~OSDMac() override;
|
||||
|
||||
bool SupportsNativeNotifications() override;
|
||||
|
||||
@@ -53,7 +53,7 @@ void SendNotificationCenterMessage(NSString *title, NSString *subtitle) {
|
||||
|
||||
} // namespace
|
||||
|
||||
OSDMac::OSDMac(std::shared_ptr<SystemTrayIcon> tray_icon, Application *app, QObject *parent) : OSDBase(tray_icon, app, parent) {}
|
||||
OSDMac::OSDMac(SharedPtr<SystemTrayIcon> tray_icon, Application *app, QObject *parent) : OSDBase(tray_icon, app, parent) {}
|
||||
|
||||
OSDMac::~OSDMac() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user