mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-13 08:56:37 +00:00
style fixes
This commit is contained in:
parent
e555d36e56
commit
5edad0fe6f
@ -20,8 +20,6 @@ public:
|
|||||||
instance.setSettingsValue(QLatin1String("Timeout"), 1, LOCAL_SETTING);
|
instance.setSettingsValue(QLatin1String("Timeout"), 1, LOCAL_SETTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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>"
|
||||||
@ -83,15 +81,13 @@ void SnoreBenchmark::benchmarkNotifications()
|
|||||||
{
|
{
|
||||||
SnoreCore &instance = SnoreCore::instance();
|
SnoreCore &instance = SnoreCore::instance();
|
||||||
int closed = 0;
|
int closed = 0;
|
||||||
connect(&instance, SnoreCore::notificationClosed, [&closed](Notification)
|
connect(&instance, SnoreCore::notificationClosed, [&closed](Notification) {
|
||||||
{
|
|
||||||
closed++;
|
closed++;
|
||||||
});
|
});
|
||||||
|
|
||||||
Application app = SnoreCorePrivate::instance()->defaultApplication();
|
Application app = SnoreCorePrivate::instance()->defaultApplication();
|
||||||
// QBENCHMARK_ONCE{
|
// QBENCHMARK_ONCE{
|
||||||
for( int i=0; i<100; ++i)
|
for (int i = 0; i < 100; ++i) {
|
||||||
{
|
|
||||||
QString number = QString::number(i);
|
QString number = QString::number(i);
|
||||||
Notification n(app, app.defaultAlert(), QLatin1String("Test ") + number, QLatin1String("Message ") + number, app.icon());
|
Notification n(app, app.defaultAlert(), QLatin1String("Test ") + number, QLatin1String("Message ") + number, app.icon());
|
||||||
instance.broadcastNotification(n);
|
instance.broadcastNotification(n);
|
||||||
|
@ -109,8 +109,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
|
|||||||
void SnoreCore::broadcastNotification(Notification notification)
|
void SnoreCore::broadcastNotification(Notification notification)
|
||||||
{
|
{
|
||||||
Q_D(SnoreCore);
|
Q_D(SnoreCore);
|
||||||
if(d->m_activeNotifications.size() > d->maxNumberOfActiveNotifications())
|
if (d->m_activeNotifications.size() > d->maxNumberOfActiveNotifications()) {
|
||||||
{
|
|
||||||
snoreDebug(SNORE_DEBUG) << "queue size:" << d->m_notificationQue.size() << "active size:" << d->m_activeNotifications.size();
|
snoreDebug(SNORE_DEBUG) << "queue size:" << d->m_notificationQue.size() << "active size:" << d->m_activeNotifications.size();
|
||||||
d->m_notificationQue.append(notification);
|
d->m_notificationQue.append(notification);
|
||||||
return;
|
return;
|
||||||
@ -124,8 +123,7 @@ void SnoreCore::broadcastNotification(Notification notification)
|
|||||||
}
|
}
|
||||||
notification.data()->setBroadcasted();
|
notification.data()->setBroadcasted();
|
||||||
notification.addActiveIn(this);
|
notification.addActiveIn(this);
|
||||||
if(!d->m_notificationBackend)
|
if (!d->m_notificationBackend) {
|
||||||
{
|
|
||||||
d->startNotificationTimeoutTimer(notification);
|
d->startNotificationTimeoutTimer(notification);
|
||||||
}
|
}
|
||||||
emit d->notify(notification);
|
emit d->notify(notification);
|
||||||
|
@ -35,8 +35,7 @@ using namespace Snore;
|
|||||||
SnoreCorePrivate::SnoreCorePrivate():
|
SnoreCorePrivate::SnoreCorePrivate():
|
||||||
m_localSettingsPrefix(qApp->applicationName().isEmpty() ? QLatin1String("SnoreNotify") : qApp->applicationName())
|
m_localSettingsPrefix(qApp->applicationName().isEmpty() ? QLatin1String("SnoreNotify") : qApp->applicationName())
|
||||||
{
|
{
|
||||||
if(!qgetenv("LIBSNORE_SETTINGS_FILE").isNull())
|
if (!qgetenv("LIBSNORE_SETTINGS_FILE").isNull()) {
|
||||||
{
|
|
||||||
m_settings = new QSettings(QString::fromUtf8(qgetenv("LIBSNORE_SETTINGS_FILE")), QSettings::IniFormat);
|
m_settings = new QSettings(QString::fromUtf8(qgetenv("LIBSNORE_SETTINGS_FILE")), QSettings::IniFormat);
|
||||||
} else {
|
} else {
|
||||||
m_settings = new QSettings(QLatin1String("Snorenotify"), QLatin1String("libsnore"), this);
|
m_settings = new QSettings(QLatin1String("Snorenotify"), QLatin1String("libsnore"), this);
|
||||||
@ -226,12 +225,10 @@ void SnoreCorePrivate::slotNotificationClosed(Notification n)
|
|||||||
{
|
{
|
||||||
Q_Q(SnoreCore);
|
Q_Q(SnoreCore);
|
||||||
emit q->notificationClosed(n);
|
emit q->notificationClosed(n);
|
||||||
if(!n.removeActiveIn(q))
|
if (!n.removeActiveIn(q)) {
|
||||||
{
|
|
||||||
snoreDebug(SNORE_WARNING) << n << "was already closed";
|
snoreDebug(SNORE_WARNING) << n << "was already closed";
|
||||||
}
|
}
|
||||||
if(!m_notificationQue.isEmpty() && m_activeNotifications.size() < maxNumberOfActiveNotifications())
|
if (!m_notificationQue.isEmpty() && m_activeNotifications.size() < maxNumberOfActiveNotifications()) {
|
||||||
{
|
|
||||||
snoreDebug(SNORE_DEBUG) << "Broadcast from queue" << m_notificationQue.size();
|
snoreDebug(SNORE_DEBUG) << "Broadcast from queue" << m_notificationQue.size();
|
||||||
q->broadcastNotification(m_notificationQue.takeFirst());
|
q->broadcastNotification(m_notificationQue.takeFirst());
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,6 @@ int main(int argc, char *argv[])
|
|||||||
app.setOrganizationName(QLatin1String("SnoreNotify"));
|
app.setOrganizationName(QLatin1String("SnoreNotify"));
|
||||||
app.setApplicationVersion(Snore::Version::version());
|
app.setApplicationVersion(Snore::Version::version());
|
||||||
|
|
||||||
|
|
||||||
Snore::SnoreCore::instance().loadPlugins(Snore::SnorePlugin::ALL);
|
Snore::SnoreCore::instance().loadPlugins(Snore::SnorePlugin::ALL);
|
||||||
Snore::SnoreCorePrivate::instance()->defaultApplication().hints().setValue("use-markup", QVariant::fromValue(true));
|
Snore::SnoreCorePrivate::instance()->defaultApplication().hints().setValue("use-markup", QVariant::fromValue(true));
|
||||||
|
|
||||||
@ -103,7 +102,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
parser.process(app);
|
parser.process(app);
|
||||||
|
|
||||||
|
|
||||||
QString appName = parser.value(appNameCommand);
|
QString appName = parser.value(appNameCommand);
|
||||||
|
|
||||||
SettingsType type = GLOBAL_SETTING;
|
SettingsType type = GLOBAL_SETTING;
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
void bringToFront(QString pid)
|
void bringToFront(QString pid)
|
||||||
{
|
{
|
||||||
snoreDebug(SNORE_DEBUG) << pid;
|
snoreDebug(SNORE_DEBUG) << pid;
|
||||||
@ -124,8 +123,7 @@ int main(int argc, char *argv[])
|
|||||||
Alert alert(parser.value(alertName), icon);
|
Alert alert(parser.value(alertName), icon);
|
||||||
application.addAlert(alert);
|
application.addAlert(alert);
|
||||||
|
|
||||||
if(parser.value(markup).toInt() == 1)
|
if (parser.value(markup).toInt() == 1) {
|
||||||
{
|
|
||||||
application.hints().setValue("use-markup", true);
|
application.hints().setValue("use-markup", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user