summaryrefslogtreecommitdiff
path: root/src/controller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller.cpp')
-rw-r--r--src/controller.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/controller.cpp b/src/controller.cpp
index e15a54a..ad85183 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -214,7 +214,7 @@ void Controller::handleMetaWatchBatteryStatus(bool charging, int charge)
}
}
-void Controller::handleIncomingNotification(const QString &sender, const QIcon &icon, const QString &summary, const QString &body)
+void Controller::handleIncomingNotification(const QString &sender, const QIcon &icon, const QString &summary, int count, const QString &body, const QDateTime &dateTime)
{
if (!isWatchConnected()) {
return; // Ignoring notification if metawatch is not connected.
@@ -231,16 +231,21 @@ void Controller::handleIncomingNotification(const QString &sender, const QIcon &
p.drawImage(0, 0, QImage(SailfishApp::pathTo("qml/watch/notification.png").toLocalFile()));
icon.paint(&p, 0, 96 - 24, 24, 24, Qt::AlignLeft | Qt::AlignBottom);
- bool drawn_summary = false;
+ QString title = summary;
+ bool title_drawn_fully = false;
+ if (count > 0) {
+ title = QString("%1 %2").arg(count).arg(summary);
+ }
+
p.setFont(large);
- if (!summary.isEmpty()) {
- QRect area(2, 2, 96 - 20, 18);
+ if (!title.isEmpty()) {
+ QRect area(2, 2, 96 - 18, 18);
QRect r;
p.drawText(area,
Qt::AlignLeft | Qt::AlignTop | Qt::TextSingleLine,
- summary, &r);
+ title, &r);
if (area.contains(r)) {
- drawn_summary = true;
+ title_drawn_fully = true;
}
}
@@ -249,11 +254,11 @@ void Controller::handleIncomingNotification(const QString &sender, const QIcon &
int y = 26;
p.setFont(small);
- if (!drawn_summary && !summary.isEmpty()) {
+ if (!title_drawn_fully && !title.isEmpty()) {
QRect r;
p.drawText(QRect(x, y, max_x - x, max_y - y),
Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap,
- summary, &r);
+ title, &r);
y = r.bottom() + 1;
}
if (!body.isEmpty() && y < max_y) {