From 12cf6df3f1c90c6ccbab398f0ae03c946e4af638 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 5 May 2013 03:18:46 +0200 Subject: continue working on qml watchface support --- libsowatch/watchletplugininterface.h | 6 + libsowatch/watchserver.cpp | 126 ++++++++++++++------- libsowatch/watchserver.h | 11 +- metawatch/metawatch.pro | 12 +- metawatch/metawatchdigital.cpp | 6 + metawatch/metawatchdigitalsimulator.cpp | 13 ++- metawatch/metawatchfacewatchlet.cpp | 9 -- metawatch/metawatchfacewatchlet.h | 18 --- metawatch/metawatchscanner.cpp | 2 + metawatch/qml/metawatch-digital-watchface.qml | 7 -- metawatchwatchlets/metawatch-digital-watchface.qml | 18 +++ metawatchwatchlets/metawatchfacewatchlet.cpp | 11 ++ metawatchwatchlets/metawatchfacewatchlet.h | 20 ++++ metawatchwatchlets/metawatchwatchlets.pro | 26 +++++ metawatchwatchlets/metawatchwatchletsplugin.cpp | 40 +++++++ metawatchwatchlets/metawatchwatchletsplugin.h | 25 ++++ sowatch.pro | 3 +- sowatchd/watchhandler.cpp | 16 +++ sowatchui/watchletsmodel.cpp | 2 +- 19 files changed, 279 insertions(+), 92 deletions(-) delete mode 100644 metawatch/metawatchfacewatchlet.cpp delete mode 100644 metawatch/metawatchfacewatchlet.h delete mode 100644 metawatch/qml/metawatch-digital-watchface.qml create mode 100644 metawatchwatchlets/metawatch-digital-watchface.qml create mode 100644 metawatchwatchlets/metawatchfacewatchlet.cpp create mode 100644 metawatchwatchlets/metawatchfacewatchlet.h create mode 100644 metawatchwatchlets/metawatchwatchlets.pro create mode 100644 metawatchwatchlets/metawatchwatchletsplugin.cpp create mode 100644 metawatchwatchlets/metawatchwatchletsplugin.h diff --git a/libsowatch/watchletplugininterface.h b/libsowatch/watchletplugininterface.h index 5e99605..ed90467 100644 --- a/libsowatch/watchletplugininterface.h +++ b/libsowatch/watchletplugininterface.h @@ -22,7 +22,13 @@ public: struct WatchletInfo { QString name; QUrl icon; + bool hidden; QUrl configQmlUrl; + + inline WatchletInfo() : + hidden(false) + { + } }; virtual QStringList watchlets() = 0; diff --git a/libsowatch/watchserver.cpp b/libsowatch/watchserver.cpp index d3328df..6448508 100644 --- a/libsowatch/watchserver.cpp +++ b/libsowatch/watchserver.cpp @@ -8,12 +8,12 @@ using namespace sowatch; WatchServer::WatchServer(Watch* watch, QObject* parent) : - QObject(parent), _watch(watch), - _nextWatchletButton(-1), - _oldNotificationThreshold(300), + QObject(parent), _watch(watch), + _nextWatchletButton(-1), _idleWatchlet(0), _notificationWatchlet(0), + _oldNotificationThreshold(300), _notifications(new NotificationsModel(this)), - _currentWatchlet(0), _currentWatchletActive(false), _currentWatchletIndex(-1), - _syncTimeTimer(new QTimer(this)) + _activeWatchlet(0), _currentWatchlet(0), _currentWatchletIndex(-1), + _syncTimeTimer(new QTimer(this)) { connect(_watch, SIGNAL(connected()), SLOT(handleWatchConnected())); connect(_watch, SIGNAL(disconnected()), SLOT(handleWatchDisconnected())); @@ -56,6 +56,39 @@ void WatchServer::setNextWatchletButton(const QString& value) } } +Watchlet * WatchServer::idleWatchlet() +{ + return _idleWatchlet; +} + +void WatchServer::setIdleWatchlet(Watchlet *watchlet) +{ + if (_idleWatchlet) { + removeWatchlet(_idleWatchlet); + } + _idleWatchlet = watchlet; + if (watchlet) { + _watchletIds[watchlet->id()] = watchlet; + } +} + +Watchlet * WatchServer::notificationWatchlet() +{ + return _notificationWatchlet; +} + +void WatchServer::setNotificationWatchlet(Watchlet *watchlet) +{ + if (_notificationWatchlet) { + removeWatchlet(_notificationWatchlet); + } + _notificationWatchlet = watchlet; + if (watchlet) { + _watchletIds[watchlet->id()] = watchlet; + // TODO Possibly activate this watchlet now if we are on the idle screen. + } +} + void WatchServer::addWatchlet(Watchlet *watchlet) { Q_ASSERT(watchlet); @@ -168,12 +201,12 @@ void WatchServer::nextNotification() if (!_watch->isConnected()) return; if (!_pendingNotifications.empty()) { Notification *n = _pendingNotifications.head(); - if (_currentWatchlet && _currentWatchletActive) { - deactivateCurrentWatchlet(); + if (_activeWatchlet) { + deactivateActiveWatchlet(); } _watch->displayNotification(n); } else if (_currentWatchlet) { - reactivateCurrentWatchlet(); + activateCurrentWatchlet(); } else { goToIdle(); } @@ -182,12 +215,12 @@ void WatchServer::nextNotification() void WatchServer::runWatchlet(Watchlet *watchlet) { Q_ASSERT(watchlet->watch() == _watch); - if (_currentWatchlet && _currentWatchletActive) { - deactivateCurrentWatchlet(); + if (_activeWatchlet) { + deactivateActiveWatchlet(); } _currentWatchlet = watchlet; if (_watch->isConnected()) { - reactivateCurrentWatchlet(); + activateCurrentWatchlet(); } } @@ -200,8 +233,8 @@ void WatchServer::runWatchlet(const QString& id) void WatchServer::closeWatchlet() { if (_currentWatchlet) { - if (_currentWatchletActive) { - deactivateCurrentWatchlet(); + if (_currentWatchlet == _activeWatchlet) { + deactivateActiveWatchlet(); } _currentWatchlet = 0; if (_watch->isConnected() && _pendingNotifications.empty()) { @@ -210,23 +243,43 @@ void WatchServer::closeWatchlet() } } -void WatchServer::deactivateCurrentWatchlet() +void WatchServer::setWatchletProperties(Watchlet *watchlet) { - Q_ASSERT(_currentWatchlet != 0); - Q_ASSERT(_currentWatchletActive); - qDebug() << "deactivating watchlet" << _currentWatchlet->id(); - _currentWatchlet->deactivate(); - _currentWatchletActive = false; + Q_ASSERT(watchlet->watch() == _watch); + watchlet->setNotificationsModel(_notifications); } -void WatchServer::reactivateCurrentWatchlet() +void WatchServer::unsetWatchletProperties(Watchlet *watchlet) { - Q_ASSERT(_currentWatchlet != 0); - Q_ASSERT(!_currentWatchletActive); - qDebug() << "activating watchlet" << _currentWatchlet->id(); + Q_ASSERT(watchlet->watch() == _watch); + watchlet->setNotificationsModel(0); +} + +void WatchServer::activateWatchlet(Watchlet *watchlet) +{ + Q_ASSERT(!_activeWatchlet); + + qDebug() << "activating watchlet" << watchlet->id(); + _activeWatchlet = watchlet; + _activeWatchlet->activate(); +} + +void WatchServer::deactivateActiveWatchlet() +{ + Q_ASSERT(_activeWatchlet); + + qDebug() << "deactivating watchlet" << _activeWatchlet->id(); + _activeWatchlet->deactivate(); + _activeWatchlet = 0; +} + +void WatchServer::activateCurrentWatchlet() +{ + Q_ASSERT(_currentWatchlet); + Q_ASSERT(!_activeWatchlet); + _watch->displayApplication(); - _currentWatchlet->activate(); - _currentWatchletActive = true; + activateWatchlet(_currentWatchlet); } void WatchServer::nextWatchlet() @@ -282,22 +335,13 @@ void WatchServer::removeNotification(Notification::Type type, Notification *n) disconnect(n, 0, this, 0); } -void WatchServer::setWatchletProperties(Watchlet *watchlet) -{ - Q_ASSERT(watchlet->watch() == _watch); - watchlet->setNotificationsModel(_notifications); -} - -void WatchServer::unsetWatchletProperties(Watchlet *watchlet) -{ - Q_ASSERT(watchlet->watch() == _watch); - watchlet->setNotificationsModel(0); -} - void WatchServer::goToIdle() { - Q_ASSERT(!_currentWatchletActive); + Q_ASSERT(!_currentWatchlet && !_activeWatchlet); _watch->displayIdleScreen(); + if (_idleWatchlet) { + activateWatchlet(_idleWatchlet); + } } void WatchServer::handleWatchConnected() @@ -306,7 +350,7 @@ void WatchServer::handleWatchConnected() if (!_pendingNotifications.isEmpty()) { nextNotification(); } else if (_currentWatchlet) { - reactivateCurrentWatchlet(); + activateCurrentWatchlet(); } else { goToIdle(); } @@ -316,8 +360,8 @@ void WatchServer::handleWatchConnected() void WatchServer::handleWatchDisconnected() { _syncTimeTimer->stop(); - if (_currentWatchlet && _currentWatchletActive) { - deactivateCurrentWatchlet(); + if (_activeWatchlet) { + deactivateActiveWatchlet(); } _pendingNotifications.clear(); emit watchDisconnected(); diff --git a/libsowatch/watchserver.h b/libsowatch/watchserver.h index 30f39c6..eafee7a 100644 --- a/libsowatch/watchserver.h +++ b/libsowatch/watchserver.h @@ -94,10 +94,10 @@ private: /** We store a currently live weather forecast. */ WeatherNotification* _weather; - /** Current watchlet. */ + /** Active watchlet is the one that has "focus" right now. */ + Watchlet* _activeWatchlet; + /** Current watchlet is the app watchlet (not idle, not notification) that is current in the carrousel. */ Watchlet* _currentWatchlet; - /** Is the current watchlet active? */ - bool _currentWatchletActive; /** The current watchlet index if any, for use by nextWatchlet() */ int _currentWatchletIndex; @@ -111,8 +111,9 @@ private: void setWatchletProperties(Watchlet *watchlet); void unsetWatchletProperties(Watchlet *watchlet); - void deactivateCurrentWatchlet(); - void reactivateCurrentWatchlet(); + void activateWatchlet(Watchlet *watchlet); + void deactivateActiveWatchlet(); + void activateCurrentWatchlet(); void goToIdle(); private slots: diff --git a/metawatch/metawatch.pro b/metawatch/metawatch.pro index bd6d9bc..536ccee 100644 --- a/metawatch/metawatch.pro +++ b/metawatch/metawatch.pro @@ -18,8 +18,7 @@ SOURCES += metawatchplugin.cpp \ metawatchanalog.cpp \ metawatchscanner.cpp \ metawatchdigitalsimulator.cpp \ - metawatchdigitalsimulatorform.cpp \ - metawatchfacewatchlet.cpp + metawatchdigitalsimulatorform.cpp HEADERS += metawatchplugin.h \ metawatchpaintengine.h \ @@ -28,15 +27,13 @@ HEADERS += metawatchplugin.h \ metawatchanalog.h \ metawatchscanner.h \ metawatchdigitalsimulator.h \ - metawatchdigitalsimulatorform.h \ - metawatchfacewatchlet.h + metawatchdigitalsimulatorform.h FORMS += \ metawatchdigitalsimulatorform.ui res_files.files += res/graphics res/fonts -qml_files.files += qml/com qml/metawatch-digital-config.qml \ - qml/metawatch-digital-watchface.qml +qml_files.files += qml/com qml/metawatch-digital-config.qml LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch @@ -54,6 +51,3 @@ DEPENDPATH += $$PWD/../libsowatch qml_files.path = /usr/share/sowatch/qml } INSTALLS += target res_files qml_files - -OTHER_FILES += \ - qml/metawatch-digital-watchface.qml diff --git a/metawatch/metawatchdigital.cpp b/metawatch/metawatchdigital.cpp index 9145336..d2de326 100644 --- a/metawatch/metawatchdigital.cpp +++ b/metawatch/metawatchdigital.cpp @@ -146,6 +146,7 @@ void MetaWatchDigital::clear(Mode mode, bool black) void MetaWatchDigital::renderIdleScreen() { +#if 0 QImage idle_call(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/idle_call.bmp")); QImage idle_msg(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/idle_msg.bmp")); QImage idle_mail(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/idle_mail.bmp")); @@ -169,10 +170,12 @@ void MetaWatchDigital::renderIdleScreen() renderIdleWeather(); renderIdleCounts(); +#endif } void MetaWatchDigital::renderIdleWeather() { +#if 0 _paintMode = IdleMode; QFont sf("MetaWatch Small caps 8pt"); QFont lf("MetaWatch Large 16pt"); @@ -201,6 +204,7 @@ void MetaWatchDigital::renderIdleWeather() } _paintMode = _currentMode; +#endif } QImage MetaWatchDigital::iconForWeather(WeatherNotification::WeatherType w) @@ -225,6 +229,7 @@ QImage MetaWatchDigital::iconForWeather(WeatherNotification::WeatherType w) void MetaWatchDigital::renderIdleCounts() { +#if 0 _paintMode = IdleMode; QFont f("MetaWatch Large caps 8pt"); QString s; @@ -248,6 +253,7 @@ void MetaWatchDigital::renderIdleCounts() p.drawText(QRect((32 * 2) + 4, y, w, h), s.sprintf("%d", mails), opt); _paintMode = _currentMode; +#endif } void MetaWatchDigital::renderNotification(Notification *n) diff --git a/metawatch/metawatchdigitalsimulator.cpp b/metawatch/metawatchdigitalsimulator.cpp index dabc0f3..dcd0f6f 100644 --- a/metawatch/metawatchdigitalsimulator.cpp +++ b/metawatch/metawatchdigitalsimulator.cpp @@ -16,10 +16,14 @@ MetaWatchDigitalSimulator::MetaWatchDigitalSimulator(ConfigKey *config, QObject _pixmap[IdleMode] = QPixmap(screenWidth, screenHeight); _pixmap[ApplicationMode] = QPixmap(screenWidth, screenHeight); _pixmap[NotificationMode] = QPixmap(screenWidth, screenHeight); - _form->showNormal(); + + // Connect form signals connect(_form, SIGNAL(buttonPressed(int)), SIGNAL(buttonPressed(int))); connect(_form, SIGNAL(buttonReleased(int)), SIGNAL(buttonReleased(int))); connect(_form, SIGNAL(destroyed()), SLOT(handleFormDestroyed())); + + // Show the form + _form->showNormal(); } MetaWatchDigitalSimulator::~MetaWatchDigitalSimulator() @@ -79,6 +83,13 @@ void MetaWatchDigitalSimulator::update(Mode mode, const QList &rects) p.drawImage(r, _image[mode], r); } + + if (mode == IdleMode) { + QRect systemArea(0, 0, screenWidth, systemAreaHeight); + p.fillRect(systemArea, Qt::BDiagPattern); + p.drawText(systemArea, Qt::AlignCenter, "System area"); + } + p.end(); int totalRows = rows.count(true); diff --git a/metawatch/metawatchfacewatchlet.cpp b/metawatch/metawatchfacewatchlet.cpp deleted file mode 100644 index 7e18988..0000000 --- a/metawatch/metawatchfacewatchlet.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "metawatchfacewatchlet.h" - -using namespace sowatch; - -MetaWatchFaceWatchlet::MetaWatchFaceWatchlet(Watch *watch) : - DeclarativeWatchlet(watch, "com.javispedro.sowatch.metawatch.watchface") -{ - setSource(QUrl(SOWATCH_QML_DIR "/metawatch/" + watch->model() + "-watchface.qml")); -} diff --git a/metawatch/metawatchfacewatchlet.h b/metawatch/metawatchfacewatchlet.h deleted file mode 100644 index 2895589..0000000 --- a/metawatch/metawatchfacewatchlet.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef METAWATCHFACEWATCHLET_H -#define METAWATCHFACEWATCHLET_H - -#include - -namespace sowatch -{ - -class MetaWatchFaceWatchlet : public DeclarativeWatchlet -{ - Q_OBJECT -public: - explicit MetaWatchFaceWatchlet(Watch* watch); -}; - -} - -#endif // METAWATCHFACEWATCHLET_H diff --git a/metawatch/metawatchscanner.cpp b/metawatch/metawatchscanner.cpp index 6abe4a6..0c1d88e 100644 --- a/metawatch/metawatchscanner.cpp +++ b/metawatch/metawatchscanner.cpp @@ -44,6 +44,8 @@ void MetaWatchScanner::handleDiscoveredService(const QBluetoothServiceInfo &info // For now, assume Digital metawatch. foundInfo["driver"] = QString("metawatch-digital"); foundInfo["next-watchlet-button"] = QString("A"); + foundInfo["idle-watchlet"] = QString("com.javispedro.sowatch.metawatch.watchface"); + foundInfo["notification-watchlet"] = QString("com.javispedro.sowatch.metawatch.notificationwatchlet"); emit watchFound(foundInfo); } } diff --git a/metawatch/qml/metawatch-digital-watchface.qml b/metawatch/qml/metawatch-digital-watchface.qml deleted file mode 100644 index d2abbf0..0000000 --- a/metawatch/qml/metawatch-digital-watchface.qml +++ /dev/null @@ -1,7 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 -import QtQuick 1.1 - -Rectangle { - width: 100 - height: 62 -} diff --git a/metawatchwatchlets/metawatch-digital-watchface.qml b/metawatchwatchlets/metawatch-digital-watchface.qml new file mode 100644 index 0000000..712dbeb --- /dev/null +++ b/metawatchwatchlets/metawatch-digital-watchface.qml @@ -0,0 +1,18 @@ +import QtQuick 1.0 +import com.javispedro.sowatch.metawatch 1.0 + +MWPage { + // Remember that firmware draws top 30 lines + + Connections { + target: watch + onActiveChanged: { + console.log("watchface is now " + (watch.active ? "active" : "inactive")) + } + } + + MWLabel { + anchors.centerIn: parent + text: "This is a test" + } +} diff --git a/metawatchwatchlets/metawatchfacewatchlet.cpp b/metawatchwatchlets/metawatchfacewatchlet.cpp new file mode 100644 index 0000000..5b03e42 --- /dev/null +++ b/metawatchwatchlets/metawatchfacewatchlet.cpp @@ -0,0 +1,11 @@ +#include "metawatchfacewatchlet.h" + +using namespace sowatch; + +const QLatin1String MetaWatchFaceWatchlet::myId("com.javispedro.sowatch.metawatch.watchface"); + +MetaWatchFaceWatchlet::MetaWatchFaceWatchlet(Watch *watch) : + DeclarativeWatchlet(watch, myId) +{ + setSource(QUrl(SOWATCH_QML_DIR "/metawatchwatchlets/" + watch->model() + "-watchface.qml")); +} diff --git a/metawatchwatchlets/metawatchfacewatchlet.h b/metawatchwatchlets/metawatchfacewatchlet.h new file mode 100644 index 0000000..4ef23df --- /dev/null +++ b/metawatchwatchlets/metawatchfacewatchlet.h @@ -0,0 +1,20 @@ +#ifndef METAWATCHFACEWATCHLET_H +#define METAWATCHFACEWATCHLET_H + +#include + +namespace sowatch +{ + +class MetaWatchFaceWatchlet : public DeclarativeWatchlet +{ + Q_OBJECT +public: + explicit MetaWatchFaceWatchlet(Watch* watch); + + static const QLatin1String myId; +}; + +} + +#endif // METAWATCHFACEWATCHLET_H diff --git a/metawatchwatchlets/metawatchwatchlets.pro b/metawatchwatchlets/metawatchwatchlets.pro new file mode 100644 index 0000000..f4393e4 --- /dev/null +++ b/metawatchwatchlets/metawatchwatchlets.pro @@ -0,0 +1,26 @@ +TARGET = metawatchwatchlets +TEMPLATE = lib +CONFIG += plugin + +SOURCES += metawatchwatchletsplugin.cpp metawatchfacewatchlet.cpp + +HEADERS += metawatchwatchletsplugin.h metawatchfacewatchlet.h + +qml_files.files = metawatch-digital-watchface.qml + +LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch +INCLUDEPATH += $$PWD/../libsowatch +DEPENDPATH += $$PWD/../libsowatch +QML_IMPORT_PATH += $$PWD/../metawatch/qml + +unix:!symbian { + !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 { + QMAKE_RPATHDIR += /opt/sowatch/lib + target.path = /opt/sowatch/lib/watchlets + qml_files.path = /opt/sowatch/qml/$$TARGET + } else { + target.path = /usr/lib/sowatch/watchlets + qml_files.path = /usr/share/sowatch/qml/$$TARGET + } + INSTALLS += target qml_files +} diff --git a/metawatchwatchlets/metawatchwatchletsplugin.cpp b/metawatchwatchlets/metawatchwatchletsplugin.cpp new file mode 100644 index 0000000..31b66ab --- /dev/null +++ b/metawatchwatchlets/metawatchwatchletsplugin.cpp @@ -0,0 +1,40 @@ +#include "metawatchfacewatchlet.h" +#include "metawatchwatchletsplugin.h" + +using namespace sowatch; + +MetaWatchWatchletsPlugin::MetaWatchWatchletsPlugin(QObject *parent) : + QObject(parent) +{ +} + +MetaWatchWatchletsPlugin::~MetaWatchWatchletsPlugin() +{ +} + +QStringList MetaWatchWatchletsPlugin::watchlets() +{ + QStringList l; + l << MetaWatchFaceWatchlet::myId; + return l; +} + +WatchletPluginInterface::WatchletInfo MetaWatchWatchletsPlugin::describeWatchlet(const QString &id) +{ + WatchletInfo info; + if (id == MetaWatchFaceWatchlet::myId) { + info.name = "MetaWatch Face Watchlet"; + info.hidden = true; + } + return info; +} + +Watchlet* MetaWatchWatchletsPlugin::getWatchlet(const QString& id, ConfigKey *settings, Watch *watch) +{ + Q_UNUSED(settings); + if (id == MetaWatchFaceWatchlet::myId) { + return new MetaWatchFaceWatchlet(watch); + } +} + +Q_EXPORT_PLUGIN2(notificationswatchlet, MetaWatchWatchletsPlugin) diff --git a/metawatchwatchlets/metawatchwatchletsplugin.h b/metawatchwatchlets/metawatchwatchletsplugin.h new file mode 100644 index 0000000..a7ba34b --- /dev/null +++ b/metawatchwatchlets/metawatchwatchletsplugin.h @@ -0,0 +1,25 @@ +#ifndef METAWATCHWATCHLETSPLUGIN_H +#define METAWATCHWATCHLETSPLUGIN_H + +#include + +namespace sowatch +{ + +class MetaWatchWatchletsPlugin : public QObject, public WatchletPluginInterface +{ + Q_OBJECT + Q_INTERFACES(sowatch::WatchletPluginInterface) + +public: + explicit MetaWatchWatchletsPlugin(QObject *parent = 0); + ~MetaWatchWatchletsPlugin(); + + QStringList watchlets(); + WatchletInfo describeWatchlet(const QString &id); + Watchlet* getWatchlet(const QString& id, ConfigKey *settings, Watch* watch); +}; + +} + +#endif // NEKOWATCHLETPLUGIN_H diff --git a/sowatch.pro b/sowatch.pro index 5a1e868..1233f46 100644 --- a/sowatch.pro +++ b/sowatch.pro @@ -4,7 +4,8 @@ TEMPLATE = subdirs # Core library # This is mandatory. Depends on Qt and GConf. -SUBDIRS = libsowatch +SUBDIRS = libsowatch \ + metawatchwatchlets # The MetaWatch driver plugin # Since this is the only watch plugin, it is mandatory. diff --git a/sowatchd/watchhandler.cpp b/sowatchd/watchhandler.cpp index bde68b4..a2ea76a 100644 --- a/sowatchd/watchhandler.cpp +++ b/sowatchd/watchhandler.cpp @@ -57,6 +57,22 @@ WatchHandler::WatchHandler(ConfigKey *config, QObject *parent) // Configure the server _server->setNextWatchletButton(_config->value("next-watchlet-button").toString()); + QString idle_watchlet_id = _config->value("idle-watchlet").toString(); + if (!idle_watchlet_id.isEmpty()) { + Watchlet *watchlet = createWatchlet(idle_watchlet_id); + if (watchlet) { + _server->setIdleWatchlet(watchlet); + } + } + + QString notif_watchlet_id = _config->value("notification-watchlet").toString(); + if (!notif_watchlet_id.isEmpty()) { + Watchlet *watchlet = createWatchlet(notif_watchlet_id); + if (watchlet) { + _server->setNotificationWatchlet(watchlet); + } + } + updateProviders(); updateWatchlets(); } diff --git a/sowatchui/watchletsmodel.cpp b/sowatchui/watchletsmodel.cpp index cdc3593..461a38b 100644 --- a/sowatchui/watchletsmodel.cpp +++ b/sowatchui/watchletsmodel.cpp @@ -149,7 +149,7 @@ void WatchletsModel::reload() if (_unadded) { qDebug() << "Listing unadded watchlets from" << all; foreach (const QString& s, all) { - if (!_enabled.contains(s)) { + if (!_info[s].hidden && !_enabled.contains(s)) { _list.append(s); } } -- cgit v1.2.3