From 49c64104c0750857858504b512955d9cc31e5c42 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 5 May 2013 01:55:41 +0200 Subject: update the rest of the watchlets --- sysinfowatchlet/sysinfoplugin.cpp | 4 ++-- sysinfowatchlet/sysinfoplugin.h | 2 +- sysinfowatchlet/sysinfowatchlet.cpp | 16 ++++++++-------- sysinfowatchlet/sysinfowatchlet.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'sysinfowatchlet') diff --git a/sysinfowatchlet/sysinfoplugin.cpp b/sysinfowatchlet/sysinfoplugin.cpp index 3e56307..c87e864 100644 --- a/sysinfowatchlet/sysinfoplugin.cpp +++ b/sysinfowatchlet/sysinfoplugin.cpp @@ -28,11 +28,11 @@ SysInfoPlugin::WatchletInfo SysInfoPlugin::describeWatchlet(const QString &id) return info; } -Watchlet* SysInfoPlugin::getWatchlet(const QString& id, ConfigKey *settings, WatchServer *server) +Watchlet* SysInfoPlugin::getWatchlet(const QString& id, ConfigKey *settings, Watch *watch) { Q_UNUSED(id); Q_UNUSED(settings); - return new SysInfoWatchlet(server); + return new SysInfoWatchlet(watch); } Q_EXPORT_PLUGIN2(sysinfowatchlet, SysInfoPlugin) diff --git a/sysinfowatchlet/sysinfoplugin.h b/sysinfowatchlet/sysinfoplugin.h index 8b37a1c..e22e00b 100644 --- a/sysinfowatchlet/sysinfoplugin.h +++ b/sysinfowatchlet/sysinfoplugin.h @@ -17,7 +17,7 @@ public: QStringList watchlets(); WatchletInfo describeWatchlet(const QString &id); - Watchlet* getWatchlet(const QString &id, ConfigKey *settings, WatchServer *server); + Watchlet* getWatchlet(const QString &id, ConfigKey *settings, Watch *watch); }; } diff --git a/sysinfowatchlet/sysinfowatchlet.cpp b/sysinfowatchlet/sysinfowatchlet.cpp index e159fc7..214d5de 100644 --- a/sysinfowatchlet/sysinfowatchlet.cpp +++ b/sysinfowatchlet/sysinfowatchlet.cpp @@ -5,14 +5,14 @@ using namespace sowatch; QTM_USE_NAMESPACE -SysInfoWatchlet::SysInfoWatchlet(WatchServer* server) : - DeclarativeWatchlet(server, "com.javispedro.sowatch.sysinfo"), +SysInfoWatchlet::SysInfoWatchlet(Watch* watch) : + DeclarativeWatchlet(watch, "com.javispedro.sowatch.sysinfo"), _devInfo(new QSystemDeviceInfo(this)), _netMgr(new QNetworkConfigurationManager(this)) { - rootContext()->setContextProperty("batteryLevel", 0); - rootContext()->setContextProperty("networkName", ""); - setSource(QUrl(SOWATCH_QML_DIR "/sysinfowatchlet/" + server->watch()->model() + ".qml")); + context()->setContextProperty("batteryLevel", 0); + context()->setContextProperty("networkName", ""); + setSource(QUrl(SOWATCH_QML_DIR "/sysinfowatchlet/" + watch->model() + ".qml")); connect(this, SIGNAL(activated()), SLOT(handleActivated())); connect(this, SIGNAL(deactivated()), SLOT(handleDeactivated())); } @@ -35,10 +35,10 @@ void SysInfoWatchlet::updateInformation() QList cfgs = _netMgr->allConfigurations(QNetworkConfiguration::Active); int batteryLevel = _devInfo->batteryLevel(); qDebug() << "Updating system information (batteryLevel =" << batteryLevel << "%)"; - rootContext()->setContextProperty("batteryLevel", batteryLevel); + context()->setContextProperty("batteryLevel", batteryLevel); if (cfgs.size() > 0) { - rootContext()->setContextProperty("networkName", cfgs[0].name()); + context()->setContextProperty("networkName", cfgs[0].name()); } else { - rootContext()->setContextProperty("networkName", "-"); + context()->setContextProperty("networkName", "-"); } } diff --git a/sysinfowatchlet/sysinfowatchlet.h b/sysinfowatchlet/sysinfowatchlet.h index 9ef3d7f..fe4f96f 100644 --- a/sysinfowatchlet/sysinfowatchlet.h +++ b/sysinfowatchlet/sysinfowatchlet.h @@ -14,7 +14,7 @@ class SysInfoWatchlet : public DeclarativeWatchlet { Q_OBJECT public: - explicit SysInfoWatchlet(WatchServer* server); + explicit SysInfoWatchlet(Watch* watch); private slots: void handleActivated(); -- cgit v1.2.3