summaryrefslogtreecommitdiffstats
path: root/hyperui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hyperui/mainwindow.cpp')
-rw-r--r--hyperui/mainwindow.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/hyperui/mainwindow.cpp b/hyperui/mainwindow.cpp
index 4bf104d..5006917 100644
--- a/hyperui/mainwindow.cpp
+++ b/hyperui/mainwindow.cpp
@@ -69,12 +69,17 @@ MainWindow::MainWindow(QGraphicsItem *parent)
QGraphicsSimpleTextItem *phoneLabel =
new QGraphicsSimpleTextItem(tr("T-Mobile"), this);
+ m_hourLabel = new QGraphicsSimpleTextItem(this);
+
QFont labelFont(Resource::stringValue("default/font-family"));
labelFont.setBold(true);
labelFont.setPixelSize(Resource::intValue("topbar/font-size"));
phoneLabel->setFont(labelFont);
phoneLabel->setBrush(QColor(Resource::stringValue("default/font-color")));
+ m_hourLabel->setFont(labelFont);
+ m_hourLabel->setBrush(QColor(Resource::stringValue("default/font-color")));
+
QGraphicsPixmapItem *iconBattery =
new QGraphicsPixmapItem(Resource::pixmap("topbar_battery.png"), this);
@@ -84,12 +89,28 @@ MainWindow::MainWindow(QGraphicsItem *parent)
QGraphicsPixmapItem *iconNetwork =
new QGraphicsPixmapItem(Resource::pixmap("topbar_network.png"), this);
+ m_hourLabel->setPos(Resource::value("topbar/hour-label-pos").toPoint());
phoneLabel->setPos(Resource::value("topbar/label-pos").toPoint());
iconNetwork->setPos(Resource::value("topbar/icon-network-pos").toPoint());
icon3G->setPos(Resource::value("topbar/icon-3g-pos").toPoint());
iconBattery->setPos(Resource::value("topbar/icon-battery-pos").toPoint());
+ updateTime();
createDummyDailyEvents();
+
+ // update time each 30 seconds
+ startTimer(30000);
+}
+
+void MainWindow::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+ updateTime();
+}
+
+void MainWindow::updateTime()
+{
+ m_hourLabel->setText(QDateTime::currentDateTime().toString("hh:mm"));
}
void MainWindow::onDragModeIn()