Application: Use shared pointers

Fixes #1239
This commit is contained in:
Jonas Kvinge
2023-07-21 05:55:24 +02:00
parent d6b53f78ab
commit 2e61235403
316 changed files with 2170 additions and 1643 deletions

View File

@@ -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()) {