Export logger, don't use qCInfo and thus don't depend on qt 5.5

This commit is contained in:
Hannah von Reth 2015-11-28 13:03:27 +01:00
parent da054dda25
commit 38c0ffd31a
7 changed files with 22 additions and 16 deletions

View File

@ -19,13 +19,14 @@ public:
instance.setSettingsValue(QStringLiteral("Timeout"), 1, LOCAL_SETTING); instance.setSettingsValue(QStringLiteral("Timeout"), 1, LOCAL_SETTING);
} }
// clazy is complaining about this string but QStringLiteral won't work for the multiline string, so use QStringBuilder to silence it.
QString htmlTestString = QLatin1String("<i>Italic A</i><br>" QString htmlTestString = QLatin1String("<i>Italic A</i><br>"
"<i>Italic B</i><br>" "<i>Italic B</i><br>"
"<b>Bold</b><br>" "<b>Bold</b><br>"
"<u>Underline</u><br>" "<u>Underline</u><br>"
"<font color=\"blue\">Font</font><br>" "<font color=\"blue\">Font</font><br>"
"&lt;&amp;&gt;<br>" "&lt;&amp;&gt;<br>"
"<a href=\"https://github.com/Snorenotify/Snorenotify\">Website</a><br>"); "<a href=\"https://github.com/Snorenotify/Snorenotify\">Website</a><br>") + QLatin1String("");
private Q_SLOTS: private Q_SLOTS:
void benchmarkUtilsToHtml(); void benchmarkUtilsToHtml();

View File

@ -157,7 +157,7 @@ void Notification::addActiveIn(const QObject *o)
} }
d->m_activeIn.insert(o); d->m_activeIn.insert(o);
SnoreCorePrivate::instance()->m_activeNotifications[id()] = *this; SnoreCorePrivate::instance()->m_activeNotifications[id()] = *this;
qCInfo(SNORE) << SnoreCorePrivate::instance()->m_activeNotifications.size(); qCDebug(SNORE) << SnoreCorePrivate::instance()->m_activeNotifications.size();
} }
bool Notification::isActiveIn(const QObject *o) const bool Notification::isActiveIn(const QObject *o) const
@ -170,7 +170,7 @@ bool Notification::removeActiveIn(const QObject *o)
bool out = d->m_activeIn.remove(o); bool out = d->m_activeIn.remove(o);
if (d->m_activeIn.isEmpty()) { if (d->m_activeIn.isEmpty()) {
SnoreCorePrivate::instance()->m_activeNotifications.remove(id()); SnoreCorePrivate::instance()->m_activeNotifications.remove(id());
qCInfo(SNORE) << SnoreCorePrivate::instance()->m_activeNotifications.size(); qCDebug(SNORE) << SnoreCorePrivate::instance()->m_activeNotifications.size();
} }
return out; return out;
} }

View File

@ -43,8 +43,8 @@ NotificationData::NotificationData(const Snore::Application &application, const
m_hints(m_application.constHints()) m_hints(m_application.constHints())
{ {
notificationCount++; notificationCount++;
qCInfo(SNORE) << "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id; qCDebug(SNORE) << "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id;
qCInfo(SNORE) << title << text; qCDebug(SNORE) << title << text;
} }
Snore::NotificationData::NotificationData(const Notification &old, const QString &title, const QString &text, const Icon &icon, int timeout, Notification::Prioritys priority): Snore::NotificationData::NotificationData(const Notification &old, const QString &title, const QString &text, const Icon &icon, int timeout, Notification::Prioritys priority):
@ -60,15 +60,15 @@ Snore::NotificationData::NotificationData(const Notification &old, const QString
m_toReplace(old) m_toReplace(old)
{ {
notificationCount++; notificationCount++;
qCInfo(SNORE) << "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id; qCDebug(SNORE) << "Creating Notification: ActiveNotifications" << notificationCount << "id" << m_id;
qCInfo(SNORE) << title << text; qCDebug(SNORE) << title << text;
} }
NotificationData::~NotificationData() NotificationData::~NotificationData()
{ {
stopTimeoutTimer(); stopTimeoutTimer();
notificationCount--; notificationCount--;
qCInfo(SNORE) << "Deleting Notification: ActiveNotifications" << notificationCount << "id" << m_id << "Close Reason:" << m_closeReason; qCDebug(SNORE) << "Deleting Notification: ActiveNotifications" << notificationCount << "id" << m_id << "Close Reason:" << m_closeReason;
} }
void NotificationData::setActionInvoked(const Snore::Action &action) void NotificationData::setActionInvoked(const Snore::Action &action)

View File

@ -165,7 +165,7 @@ const QDir &PluginContainer::pluginDir()
if (path.entryInfoList(pluginFileFilters()).isEmpty()) { if (path.entryInfoList(pluginFileFilters()).isEmpty()) {
qCWarning(SNORE) << "Couldnt find any plugins"; qCWarning(SNORE) << "Couldnt find any plugins";
} }
qCInfo(SNORE) << "PluginPath is :" << path.absolutePath(); qCDebug(SNORE) << "PluginPath is :" << path.absolutePath();
} }
return path; return path;
} }

View File

@ -34,8 +34,6 @@
using namespace Snore; using namespace Snore;
Q_LOGGING_CATEGORY(SNORE, "SNORE", QtWarningMsg)
SnoreCore::SnoreCore(QObject *parent): SnoreCore::SnoreCore(QObject *parent):
QObject(parent) QObject(parent)
{ {
@ -111,7 +109,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
} }
} }
d->slotInitPrimaryNotificationBackend(); d->slotInitPrimaryNotificationBackend();
qCInfo(SNORE) << "Loaded Plugins:" << d->m_pluginNames; qCDebug(SNORE) << "Loaded Plugins:" << d->m_pluginNames;
} }
void SnoreCore::broadcastNotification(Notification notification) void SnoreCore::broadcastNotification(Notification notification)

View File

@ -31,6 +31,13 @@
using namespace Snore; using namespace Snore;
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
SNORE_EXPORT Q_LOGGING_CATEGORY(SNORE, "libsnorenotify", QtWarningMsg)
#else
SNORE_EXPORT Q_LOGGING_CATEGORY(SNORE, "libsnorenotify")
#endif
SnoreCorePrivate::SnoreCorePrivate(): SnoreCorePrivate::SnoreCorePrivate():
m_localSettingsPrefix(qApp->applicationName().isEmpty() ? QStringLiteral("SnoreNotify") : qApp->applicationName()) m_localSettingsPrefix(qApp->applicationName().isEmpty() ? QStringLiteral("SnoreNotify") : qApp->applicationName())
{ {
@ -39,9 +46,9 @@ SnoreCorePrivate::SnoreCorePrivate():
} else { } else {
m_settings = new QSettings(QStringLiteral("Snorenotify"), QStringLiteral("libsnore"), this); m_settings = new QSettings(QStringLiteral("Snorenotify"), QStringLiteral("libsnore"), this);
} }
qCInfo(SNORE) << "Version:" << Version::version(); qCDebug(SNORE) << "Version:" << Version::version();
if (!Version::revision().isEmpty()) { if (!Version::revision().isEmpty()) {
qCInfo(SNORE) << "Revision:" << Version::revision(); qCDebug(SNORE) << "Revision:" << Version::revision();
} }
qCDebug(SNORE) << "Temp dir is" << tempPath(); qCDebug(SNORE) << "Temp dir is" << tempPath();

View File

@ -25,8 +25,8 @@ int FreedesktopImageHint::imageHintID = qDBusRegisterMetaType<FreedesktopImageHi
FreedesktopImageHint::FreedesktopImageHint(const QImage &img) FreedesktopImageHint::FreedesktopImageHint(const QImage &img)
{ {
QImage image(img.convertToFormat(QImage::Format_ARGB32)); QImage image(img.convertToFormat(QImage::Format_ARGB32).rgbSwapped());
imageData = QByteArray((char *)image.rgbSwapped().bits(), image.byteCount()); imageData = QByteArray((char *)image.bits(), image.byteCount());
width = image.width(); width = image.width();
height = image.height(); height = image.height();
rowstride = image.bytesPerLine(); rowstride = image.bytesPerLine();