Remove non-moc headers from makefile +++

This commit is contained in:
Jonas Kvinge
2018-03-18 18:39:30 +01:00
parent 2bbcf819c8
commit bd163f989e
7 changed files with 61 additions and 194 deletions

View File

@@ -85,6 +85,7 @@ void OSD::ReloadSettings() {
if (!SupportsTrayPopups() && behaviour_ == TrayPopup) behaviour_ = Disabled;
ReloadPrettyOSDSettings();
}
// Reload just Pretty OSD settings, not everything

View File

@@ -35,6 +35,7 @@
#include <QTextDocument>
QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) {
if (image.isNull()) {
// Sometimes this gets called with a null QImage for no obvious reason.
arg.beginStructure();
@@ -74,6 +75,7 @@ QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) {
arg << QByteArray(reinterpret_cast<const char*>(i.bits()), i.byteCount());
arg.endStructure();
return arg;
}
const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image) {
@@ -84,31 +86,32 @@ const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image) {
#endif // HAVE_DBUS
void OSD::Init() {
#ifdef HAVE_DBUS
notification_id_ = 0;
interface_.reset(new OrgFreedesktopNotificationsInterface(
OrgFreedesktopNotificationsInterface::staticInterfaceName(),
"/org/freedesktop/Notifications",
QDBusConnection::sessionBus()));
interface_.reset(new OrgFreedesktopNotificationsInterface(OrgFreedesktopNotificationsInterface::staticInterfaceName(), "/org/freedesktop/Notifications", QDBusConnection::sessionBus()));
if (!interface_->isValid()) {
qLog(Warning) << "Error connecting to notifications service.";
}
#endif // HAVE_DBUS
}
bool OSD::SupportsNativeNotifications() {
#ifdef HAVE_DBUS
return true;
#else
return false;
#endif
}
bool OSD::SupportsTrayPopups() { return true; }
void OSD::ShowMessageNative(const QString& summary, const QString& message,
const QString& icon, const QImage& image) {
void OSD::ShowMessageNative(const QString& summary, const QString& message, const QString& icon, const QImage& image) {
#ifdef HAVE_DBUS
if (!interface_) return;
@@ -118,33 +121,25 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message,
}
int id = 0;
if (last_notification_time_.secsTo(QDateTime::currentDateTime()) * 1000
< timeout_msec_) {
if (last_notification_time_.secsTo(QDateTime::currentDateTime()) * 1000 < timeout_msec_) {
// Reuse the existing popup if it's still open. The reason we don't always
// reuse the popup is because the notification daemon on KDE4 won't re-show
// the bubble if it's already gone to the tray. See issue #118
id = notification_id_;
}
QDBusPendingReply<uint> reply = interface_->Notify(
QCoreApplication::applicationName(),
id,
icon,
summary,
message,
QStringList(),
hints,
timeout_msec_);
QDBusPendingReply<uint> reply = interface_->Notify(QCoreApplication::applicationName(), id, icon, summary, message, QStringList(), hints, timeout_msec_);
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
SLOT(CallFinished(QDBusPendingCallWatcher*)));
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*)));
#else // HAVE_DBUS
qLog(Warning) << "not implemented";
#endif // HAVE_DBUS
}
#ifdef HAVE_DBUS
void OSD::CallFinished(QDBusPendingCallWatcher* watcher) {
std::unique_ptr<QDBusPendingCallWatcher> w(watcher);
QDBusPendingReply<uint> reply = *watcher;