doc and some asserts

This commit is contained in:
Patrick von Reth 2015-07-08 12:21:20 +02:00
parent 889eab6f38
commit 608a1be3d4
3 changed files with 13 additions and 13 deletions

View File

@ -18,13 +18,14 @@
#include "application.h"
#include "application_p.h"
#include "snore_p.h"
#include <QApplication>
using namespace Snore;
Application::Application():
d(NULL)
d(nullptr)
{}
Application::Application(const QString &name, const Icon &icon) :
@ -52,6 +53,8 @@ Application::~Application()
void Application::addAlert(const Alert &alert)
{
Q_ASSERT_X(!SnoreCore::instance().aplications().contains(name()), Q_FUNC_INFO,
"Alerts must be added before the application is Registered." );
d->m_alerts.insert(alert.name().toUtf8(), alert);
}

View File

@ -64,7 +64,8 @@ public:
~Application();
/**
* Add an alert to the Application
* Add an alert to the Application.
* Alerts must be added before the application is registered.
* @param alert the Alert
*/
void addAlert(const Alert &alert);

View File

@ -92,7 +92,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
}
}
}
break;
break;
default:
snoreDebug(SNORE_WARNING) << "Plugin Cache corrupted\n" << info->file() << info->type();
continue;
@ -114,10 +114,6 @@ void SnoreCore::broadcastNotification(Notification notification)
{
Q_D(SnoreCore);
Q_ASSERT_X(!notification.data()->isBroadcasted(), Q_FUNC_INFO, "Notification was already broadcasted.");
if (notification.data()->isBroadcasted()) {
snoreDebug(SNORE_WARNING) << "Notification" << notification << "was already broadcasted.";
return;
}
snoreDebug(SNORE_DEBUG) << "Broadcasting" << notification << "timeout:" << notification.timeout();
if (d->m_notificationBackend != nullptr) {
if (notification.isUpdate() && !d->m_notificationBackend->canUpdateNotification()) {
@ -131,11 +127,11 @@ void SnoreCore::broadcastNotification(Notification notification)
void SnoreCore::registerApplication(const Application &application)
{
Q_D(SnoreCore);
if (!d->m_applications.contains(application.name())) {
snoreDebug(SNORE_DEBUG) << "Registering Application:" << application;
d->m_applications.insert(application.name(), application);
emit d->applicationRegistered(application);
}
Q_ASSERT_X(!d->m_applications.contains(application.name()), Q_FUNC_INFO,
"Applications mus be registered only once.");
snoreDebug(SNORE_DEBUG) << "Registering Application:" << application;
d->m_applications.insert(application.name(), application);
emit d->applicationRegistered(application);
}
void SnoreCore::deregisterApplication(const Application &application)
@ -246,7 +242,7 @@ void SnoreCore::displayExapleNotification()
{
Application app = SnoreCorePrivate::instance()->defaultApplication();
QString text = QLatin1String("<i>") + tr("This is Snore") + QLatin1String("</i><br>") +
QLatin1String("<a href=\"https://github.com/Snorenotify/Snorenotify\">") + tr("Project Website") + QLatin1String("</a><br>");
QLatin1String("<a href=\"https://github.com/Snorenotify/Snorenotify\">") + tr("Project Website") + QLatin1String("</a><br>");
if (!app.constHints().value("use-markup").toBool()) {
text = Utils::normalizeMarkup(text, Utils::NO_MARKUP);
}