I have made the following changes intended for : CE:UX:MTF / lipstick Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.pub.meego.com//request/show/6985 Thank You, Marko Saukko [This message was auto-generated] --- Request # 6985: Messages from BOSS: State: review at 2012-10-12T13:51:33 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: Project:MTF:UX / lipstick -> CE:UX:MTF / lipstick changes files: -------------- --- lipstick.changes +++ lipstick.changes @@ -0,0 +1,7 @@ +* Fri Oct 12 2012 Robin Burchell <[email protected]> - 0.4.0 +- Link notification tool against the correct liblipstick (from Vesa) +- Don't show a notification if there is no summary or body (from Vesa) +- Handle differencing of switcher content instead of doing full model resets (from Robin) +- Remove unnecessary QGLWidget viewport (from Robin) +- Remove unnecessary repaint requests for homescreen window (from Robin) + old: ---- lipstick-0.3.6.tar.bz2 new: ---- lipstick-0.4.0.tar.bz2 spec files: ----------- --- lipstick.spec +++ lipstick.spec @@ -9,7 +9,7 @@ # << macros Summary: QML toolkit for homescreen creation -Version: 0.3.6 +Version: 0.4.0 Release: 1 Group: System/Libraries License: LGPLv2.1 @@ -20,7 +20,6 @@ Requires(postun): /sbin/ldconfig BuildRequires: pkgconfig(QtCore) BuildRequires: pkgconfig(QtDeclarative) -BuildRequires: pkgconfig(QtOpenGL) BuildRequires: pkgconfig(QtSensors) BuildRequires: pkgconfig(contentaction-0.1) BuildRequires: pkgconfig(mlite) @@ -59,7 +58,7 @@ %prep -%setup -q -n %{name}-%{version} +%setup -q -n %{name} # >> setup # << setup other changes: -------------- ++++++ lipstick-0.3.6.tar.bz2 -> lipstick-0.4.0.tar.bz2 --- .gitignore +++ .gitignore @@ -0,0 +1,18 @@ +Makefile +*.o +*gen_*.h +*gen_*.cpp +*gen_*.o +*moc_*.h +*moc_*.cpp +*moc_*.o +*~ +*.log +*.log.xml +*.gcno +*.gcda +*.pro.user +configure-stamp +build-stamp +.project +.cproject --- plugin/.gitignore +++ plugin/.gitignore @@ -0,0 +1 @@ +liblipstickplugin.so --- src/.gitignore +++ src/.gitignore @@ -0,0 +1,2 @@ +liblipstick.* +pkgconfig --- src/components/switchermodel.cpp +++ src/components/switchermodel.cpp @@ -87,17 +87,34 @@ return; SWITCHER_DEBUG("Read list of " << numWindowItems << " windows"); - QList<WindowInfo*> *windowList = new QList<WindowInfo*>(); + QSet<WindowInfo *> oldWindowSet; + QSet<WindowInfo *> newWindowSet; + + QList<WindowInfo *> *temporaryList = getList<WindowInfo>(); + oldWindowSet.reserve(temporaryList->size()); + for (int i = 0; i < temporaryList->count(); ++i) + oldWindowSet.insert(temporaryList->at(i)); + + newWindowSet.reserve(numWindowItems); + Window *wins = (Window *)windowData; for (unsigned int i = 0; i < numWindowItems; i++) { WindowInfo *wi = WindowInfo::windowFor(wins[i]); if (wi->visibleInSwitcher()) - windowList->append(wi); + newWindowSet.insert(wi); } XFree(windowData); - setList(windowList); + QSet<WindowInfo *> closedWindows = oldWindowSet - newWindowSet; + QSet<WindowInfo *> openedWindows = newWindowSet - oldWindowSet; + + foreach (WindowInfo *wi, closedWindows) + delete wi; + + foreach (WindowInfo *wi, openedWindows) + addItem(wi); + emit itemCountChanged(); } --- src/homeapplication.cpp +++ src/homeapplication.cpp @@ -21,7 +21,6 @@ #include <QX11Info> #include <QDebug> #include <QEvent> -#include <QGLWidget> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -65,7 +64,7 @@ { setApplicationName("Lipstick"); // TODO: autogenerate this from tags - setApplicationVersion("0.3.4"); + setApplicationVersion("0.4.0"); XDamageQueryExtension(QX11Info::display(), &xDamageEventBase, &xDamageErrorBase); @@ -126,13 +125,18 @@ // only after ready signal is sent. mainWindowInstance()->showFullScreen(); + // Visibility change messages are required to make the appVisible() signal work + XWindowAttributes attributes; + XGetWindowAttributes(QX11Info::display(), _mainWindowInstance->winId(), &attributes); + XSelectInput(QX11Info::display(), _mainWindowInstance->winId(), attributes.your_event_mask | VisibilityChangeMask); + + // Excluding it from the task bar + XWindowManager::excludeFromTaskBar(_mainWindowInstance->winId()); + // Tell X that changes in the properties and the substructure of the root // window are interesting. These are used to get the list of windows and // for getting window close events. XSelectInput(QX11Info::display(), DefaultRootWindow(QX11Info::display()), PropertyChangeMask | SubstructureNotifyMask); - - // TODO: why do we need damage on the desktop window? and is this ever destroyed? - XDamageCreate(QX11Info::display(), mainWindowInstance()->winId(), XDamageReportNonEmpty); } bool HomeApplication::x11EventFilter(XEvent *event) @@ -140,12 +144,6 @@ bool eventHandled = false; iteratorActiveForEventListenerContainer = true; - if (event->xany.window == mainWindowInstance()->winId()) - { - HOME_DEBUG("received event for main window!"); - mainWindowInstance()->viewport()->repaint(); - } - if (event->type == xDamageEventBase + XDamageNotify) { HOME_DEBUG("Processing damage event"); XDamageNotifyEvent *xevent = (XDamageNotifyEvent *) event; @@ -200,22 +198,6 @@ _mainWindowInstance = new QDeclarativeView(); _mainWindowInstance->setAttribute(Qt::WA_X11NetWmWindowTypeDesktop); - // Visibility change messages are required to make the appVisible() signal work - XWindowAttributes attributes; - XGetWindowAttributes(QX11Info::display(), _mainWindowInstance->winId(), &attributes); - XSelectInput(QX11Info::display(), _mainWindowInstance->winId(), attributes.your_event_mask | VisibilityChangeMask); - - // Excluding it from the task bar - XWindowManager::excludeFromTaskBar(_mainWindowInstance->winId()); - - // Setting up OpenGL - QGLFormat fmt; - fmt.setSamples(0); - fmt.setSampleBuffers(false); - - QGLWidget *glw = new QGLWidget(fmt, _mainWindowInstance); - _mainWindowInstance->setViewport(glw); - // Setting optimalization flags _mainWindowInstance->setOptimizationFlag(QGraphicsView::DontSavePainterState); _mainWindowInstance->setResizeMode(QDeclarativeView::SizeRootObjectToView); --- src/notifications/.gitignore +++ src/notifications/.gitignore @@ -0,0 +1 @@ +notificationmanageradaptor.* --- src/notifications/notificationlistmodel.cpp +++ src/notifications/notificationlistmodel.cpp @@ -34,9 +34,9 @@ void NotificationListModel::updateNotification(uint id) { Notification *notification = NotificationManager::instance()->notification(id); - if (indexOf(notification) < 0 && notification->hints().value(NotificationManager::HINT_CLASS).toString() != "system") { + if (indexOf(notification) < 0 && notificationShouldBeShown(notification)) { addItem(notification); - } else if (indexOf(notification) >= 0 && notification->hints().value(NotificationManager::HINT_CLASS).toString() == "system") { + } else if (indexOf(notification) >= 0 && !notificationShouldBeShown(notification)) { removeItem(notification); } } @@ -45,3 +45,8 @@ { removeItem(NotificationManager::instance()->notification(id)); } + +bool NotificationListModel::notificationShouldBeShown(Notification *notification) +{ + return notification->hints().value(NotificationManager::HINT_CLASS).toString() != "system" && !notification->body().isEmpty() && !notification->summary().isEmpty(); +} --- src/notifications/notificationlistmodel.h +++ src/notifications/notificationlistmodel.h @@ -19,6 +19,8 @@ #include "utilities/qobjectlistmodel.h" #include "lipstickglobal.h" +class Notification; + class LIPSTICK_EXPORT NotificationListModel : public QObjectListModel { Q_OBJECT @@ -32,6 +34,16 @@ void removeNotification(uint id); private: + /*! + * Checks whether the given notification should be shown. A notification + * should be shown when it's class is not system and it has a body and a + * summary. + * + * \param notification the notification to check + * \return \c true if the notification should be shown, \c false otherwise + */ + static bool notificationShouldBeShown(Notification *notification); + Q_DISABLE_COPY(NotificationListModel) #ifdef UNIT_TEST --- src/src.pro +++ src/src.pro @@ -88,7 +88,6 @@ dbus \ xml \ declarative \ - opengl \ sql QMAKE_CXXFLAGS += \ --- tests/ut_categorydefinitionstore/.gitignore +++ tests/ut_categorydefinitionstore/.gitignore @@ -0,0 +1 @@ +ut_categorydefinitionstore --- tests/ut_notification/.gitignore +++ tests/ut_notification/.gitignore @@ -0,0 +1 @@ +ut_notification --- tests/ut_notificationlistmodel/.gitignore +++ tests/ut_notificationlistmodel/.gitignore @@ -0,0 +1 @@ +ut_notificationlistmodel --- tests/ut_notificationlistmodel/ut_notificationlistmodel.cpp +++ tests/ut_notificationlistmodel/ut_notificationlistmodel.cpp @@ -51,7 +51,7 @@ QCOMPARE(gQObjectListModelStub->stubCallCount("addItem"), 0); } -void Ut_NotificationListModel::testNotificationIsOnlyAddedIfClassIsNotSystem() +void Ut_NotificationListModel::testNotificationIsNotAddedIfClassIsSystem() { QVariantHash hints; hints.insert(NotificationManager::HINT_CLASS, "system"); @@ -63,6 +63,26 @@ QCOMPARE(gQObjectListModelStub->stubCallCount("addItem"), 0); } +void Ut_NotificationListModel::testNotificationIsNotAddedIfSummaryIsEmpty() +{ + Notification notification("appName", "appIcon", "", "body", QStringList() << "action", QVariantHash(), 1); + gNotificationManagerStub->stubSetReturnValue("notificationIds", QList<uint>() << 1); + gNotificationManagerStub->stubSetReturnValue("notification", ¬ification); + gQObjectListModelStub->stubSetReturnValue("indexOf", -1); + NotificationListModel model; + QCOMPARE(gQObjectListModelStub->stubCallCount("addItem"), 0); +} + +void Ut_NotificationListModel::testNotificationIsNotAddedIfBodyIsEmpty() +{ + Notification notification("appName", "appIcon", "summary", "", QStringList() << "action", QVariantHash(), 1); + gNotificationManagerStub->stubSetReturnValue("notificationIds", QList<uint>() << 1); + gNotificationManagerStub->stubSetReturnValue("notification", ¬ification); + gQObjectListModelStub->stubSetReturnValue("indexOf", -1); + NotificationListModel model; + QCOMPARE(gQObjectListModelStub->stubCallCount("addItem"), 0); +} + void Ut_NotificationListModel::testAlreadyAddedNotificationIsRemovedIfClassChangesToSystem() { QVariantHash hints; @@ -71,6 +91,28 @@ gNotificationManagerStub->stubSetReturnValue("notificationIds", QList<uint>() << 1); gNotificationManagerStub->stubSetReturnValue("notification", ¬ification); gQObjectListModelStub->stubSetReturnValue("indexOf", 0); + NotificationListModel model; + QCOMPARE(gQObjectListModelStub->stubCallCount("removeItem"), 1); + QCOMPARE(gQObjectListModelStub->stubCallsTo("removeItem").at(0)->parameter<QObject *>(0), ¬ification); +} + +void Ut_NotificationListModel::testAlreadyAddedNotificationIsRemovedIfSummaryChangesToEmpty() +{ + Notification notification("appName", "appIcon", "", "body", QStringList() << "action", QVariantHash(), 1); + gNotificationManagerStub->stubSetReturnValue("notificationIds", QList<uint>() << 1); + gNotificationManagerStub->stubSetReturnValue("notification", ¬ification); + gQObjectListModelStub->stubSetReturnValue("indexOf", 0); + NotificationListModel model; + QCOMPARE(gQObjectListModelStub->stubCallCount("removeItem"), 1); + QCOMPARE(gQObjectListModelStub->stubCallsTo("removeItem").at(0)->parameter<QObject *>(0), ¬ification); +} + +void Ut_NotificationListModel::testAlreadyAddedNotificationIsRemovedIfBodyChangesToEmpty() +{ + Notification notification("appName", "appIcon", "summary", "", QStringList() << "action", QVariantHash(), 1); + gNotificationManagerStub->stubSetReturnValue("notificationIds", QList<uint>() << 1); + gNotificationManagerStub->stubSetReturnValue("notification", ¬ification); + gQObjectListModelStub->stubSetReturnValue("indexOf", 0); NotificationListModel model; QCOMPARE(gQObjectListModelStub->stubCallCount("removeItem"), 1); QCOMPARE(gQObjectListModelStub->stubCallsTo("removeItem").at(0)->parameter<QObject *>(0), ¬ification); --- tests/ut_notificationlistmodel/ut_notificationlistmodel.h +++ tests/ut_notificationlistmodel/ut_notificationlistmodel.h @@ -26,8 +26,12 @@ void cleanup(); void testModelPopulatesOnConstruction(); void testNotificationIsOnlyAddedIfNotAlreadyAdded(); - void testNotificationIsOnlyAddedIfClassIsNotSystem(); + void testNotificationIsNotAddedIfClassIsSystem(); + void testNotificationIsNotAddedIfSummaryIsEmpty(); + void testNotificationIsNotAddedIfBodyIsEmpty(); void testAlreadyAddedNotificationIsRemovedIfClassChangesToSystem(); + void testAlreadyAddedNotificationIsRemovedIfSummaryChangesToEmpty(); + void testAlreadyAddedNotificationIsRemovedIfBodyChangesToEmpty(); void testNotificationRemoval(); }; --- tests/ut_notificationmanager/.gitignore +++ tests/ut_notificationmanager/.gitignore @@ -0,0 +1 @@ +ut_notificationmanager --- tools/notificationtool/.gitignore +++ tools/notificationtool/.gitignore @@ -0,0 +1,2 @@ +notificationmanagerproxy.* +notificationtool --- tools/notificationtool/notificationtool.pro +++ tools/notificationtool/notificationtool.pro @@ -10,7 +10,8 @@ DEPENDPATH += "../../src" INCLUDEPATH += "../../src" "../../src/notifications" -LIBS = -L"../../src" -llipstick +QMAKE_LIBDIR = ../../src +LIBS = -llipstick HEADERS += \ notificationmanagerproxy.h ++++++ lipstick.yaml --- lipstick.yaml +++ lipstick.yaml @@ -1,6 +1,6 @@ Name: lipstick Summary: QML toolkit for homescreen creation -Version: 0.3.6 +Version: 0.4.0 Release: 1 Group: System/Libraries License: LGPLv2.1 @@ -12,7 +12,6 @@ PkgConfigBR: - QtCore - QtDeclarative - - QtOpenGL # TODO: remove - QtSensors - contentaction-0.1 - mlite
