on xenial help sign in
fix issues from review
9118c5fMichael Zanetti
CMakeLists.txt+1−1
@@ -70,7 +70,7 @@ find_package(Qt5DBus 5.6 REQUIRED)
70find_package(Qt5Concurrent 5.6 REQUIRED)
70find_package(Qt5Concurrent 5.6 REQUIRED)
71find_package(Qt5Sql 5.6 REQUIRED)
71find_package(Qt5Sql 5.6 REQUIRED)
72
72
73−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=26)
73+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=27)
74pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
74pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
75pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
75pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
76pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
76pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
debian/control+1−1
@@ -38,7 +38,7 @@ Build-Depends: cmake,
38 libubuntugestures5-private-dev (>= 1.3.2030),
38 libubuntugestures5-private-dev (>= 1.3.2030),
39 libudev-dev,
39 libudev-dev,
40 libudm-common-dev,
40 libudm-common-dev,
41− libunity-api-dev (>= 8.5),
41+ libunity-api-dev (>= 8.6),
42 libusermetricsoutput1-dev,
42 libusermetricsoutput1-dev,
43# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
43# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
44 libx11-dev[!arm64 !armhf],
44 libx11-dev[!arm64 !armhf],
plugins/Unity/Launcher/CMakeLists.txt+2
@@ -30,6 +30,8 @@ set(QMLLAUNCHERPLUGIN_SRC
30 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
30 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
31 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
31 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
32 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceListInterface.h
32 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceListInterface.h
33+ ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceInterface.h
34+ ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/Mir.h
33 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherItemInterface.h
35 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherItemInterface.h
34 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherModelInterface.h
36 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherModelInterface.h
35 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/QuickListModelInterface.h
37 ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/QuickListModelInterface.h
plugins/Unity/Launcher/launchermodel.cpp+27−5
@@ -23,6 +23,7 @@
23
23
24#include <unity/shell/application/ApplicationInfoInterface.h>
24#include <unity/shell/application/ApplicationInfoInterface.h>
25#include <unity/shell/application/MirSurfaceListInterface.h>
25#include <unity/shell/application/MirSurfaceListInterface.h>
26+#include <unity/shell/application/MirSurfaceInterface.h>
26
27
27#include <QDesktopServices>
28#include <QDesktopServices>
28#include <QDebug>
29#include <QDebug>
@@ -540,15 +541,29 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
540 m_list.append(item);
541 m_list.append(item);
541 endInsertRows();
542 endInsertRows();
542 }
543 }
543− connect(app, &ApplicationInfoInterface::surfaceCountChanged, this, &LauncherModel::applicationSurfaceCountChanged);
544+ connect(app, &ApplicationInfoInterface::surfaceCountChanged, this, &LauncherModel::updateSurfaceList);
544 m_asAdapter->syncItems(m_list);
545 m_asAdapter->syncItems(m_list);
545 Q_EMIT dataChanged(index(itemIndex), index(itemIndex), {RoleRunning});
546 Q_EMIT dataChanged(index(itemIndex), index(itemIndex), {RoleRunning});
546}
547}
547
548
548−void LauncherModel::applicationSurfaceCountChanged(int count)
549+void LauncherModel::updateSurfaceList()
549{
550{
550− Q_UNUSED(count)
551 ApplicationInfoInterface *app = static_cast<ApplicationInfoInterface*>(sender());
551 ApplicationInfoInterface *app = static_cast<ApplicationInfoInterface*>(sender());
552+ updateSurfaceListForApp(app);
553+}
554+
555+void LauncherModel::updateSurfaceListForSurface()
556+{
557+ MirSurfaceInterface *iface = static_cast<MirSurfaceInterface*>(sender());
558+ ApplicationInfoInterface* app = m_appManager->findApplication(iface->appId());
559+ if (!app) {
560+ return;
561+ }
562+ updateSurfaceListForApp(app);
563+}
564+
565+void LauncherModel::updateSurfaceListForApp(ApplicationInfoInterface* app)
566+{
552 int idx = findApplication(app->appId());
567 int idx = findApplication(app->appId());
553 if (idx < 0) {
568 if (idx < 0) {
554 qWarning() << "Received a surface count changed event from an app that's not in the Launcher model";
569 qWarning() << "Received a surface count changed event from an app that's not in the Launcher model";
@@ -558,7 +573,14 @@ void LauncherModel::applicationSurfaceCountChanged(int count)
558 QList<QPair<QString, QString> > surfaces;
573 QList<QPair<QString, QString> > surfaces;
559 for (int i = 0; i < app->surfaceList()->count(); ++i) {
574 for (int i = 0; i < app->surfaceList()->count(); ++i) {
560 MirSurfaceInterface* iface = app->surfaceList()->get(i);
575 MirSurfaceInterface* iface = app->surfaceList()->get(i);
576+ // Avoid duplicate connections, so let's just disconnect first to be sure
577+ disconnect(iface, &MirSurfaceInterface::nameChanged, this, &LauncherModel::updateSurfaceListForSurface);
578+ connect(iface, &MirSurfaceInterface::nameChanged, this, &LauncherModel::updateSurfaceListForSurface);
579+ QString name = iface->name();
580+ if (name.isEmpty()) {
581+ name = app->name();
582+ }
561− surfaces.append({iface->persistentId(), iface->name()});
583+ surfaces.append({iface->persistentId(), name});
562 }
584 }
563 item->setSurfaces(surfaces);
585 item->setSurfaces(surfaces);
564 Q_EMIT dataChanged(index(idx), index(idx), {RoleSurfaceCount});
586 Q_EMIT dataChanged(index(idx), index(idx), {RoleSurfaceCount});
@@ -582,7 +604,7 @@ void LauncherModel::applicationRemoved(const QModelIndex &parent, int row)
582 return;
604 return;
583 }
605 }
584
606
585− disconnect(app, &ApplicationInfoInterface::surfaceCountChanged, this, &LauncherModel::applicationSurfaceCountChanged);
607+ disconnect(app, &ApplicationInfoInterface::surfaceCountChanged, this, &LauncherModel::updateSurfaceList);
586
608
587 LauncherItem * item = m_list.at(appIndex);
609 LauncherItem * item = m_list.at(appIndex);
588
610
plugins/Unity/Launcher/launchermodel.h+3−1
@@ -75,7 +75,9 @@ private Q_SLOTS:
75 void applicationAdded(const QModelIndex &parent, int row);
75 void applicationAdded(const QModelIndex &parent, int row);
76 void applicationRemoved(const QModelIndex &parent, int row);
76 void applicationRemoved(const QModelIndex &parent, int row);
77 void focusedAppIdChanged();
77 void focusedAppIdChanged();
78− void applicationSurfaceCountChanged(int);
78+ void updateSurfaceList();
79+ void updateSurfaceListForApp(ApplicationInfoInterface *app);
80+ void updateSurfaceListForSurface();
79
81
80private:
82private:
81 QList<LauncherItem*> m_list;
83 QList<LauncherItem*> m_list;
qml/Launcher/LauncherPanel.qml+1
@@ -841,6 +841,7 @@ Rectangle {
841 fontSize: index == 0 ? "medium" : "small"
841 fontSize: index == 0 ? "medium" : "small"
842 font.weight: index == 0 ? Font.Medium : Font.Light
842 font.weight: index == 0 ? Font.Medium : Font.Light
843 color: model.clickable ? theme.palette.normal.backgroundText : theme.palette.disabled.backgroundText
843 color: model.clickable ? theme.palette.normal.backgroundText : theme.palette.disabled.backgroundText
844+ elide: Text.ElideRight
844 }
845 }
845
846
846 onClicked: {
847 onClicked: {
tests/plugins/Unity/Launcher/launchermodeltest.cpp+4−2
@@ -42,10 +42,11 @@ class MockSurface: public unity::shell::application::MirSurfaceInterface
42{
42{
43 Q_OBJECT
43 Q_OBJECT
44public:
44public:
45− MockSurface(const QString &id, QObject* parent): unityapi::MirSurfaceInterface(parent), m_id(id) {}
45+ MockSurface(const QString &id, const QString &appId, QObject* parent): unityapi::MirSurfaceInterface(parent), m_id(id), m_appId(appId) {}
46 Mir::Type type() const override { return Mir::NormalType;}
46 Mir::Type type() const override { return Mir::NormalType;}
47 QString name() const override { return QStringLiteral("mock surface"); }
47 QString name() const override { return QStringLiteral("mock surface"); }
48 QString persistentId() const override { return m_id; }
48 QString persistentId() const override { return m_id; }
49+ QString appId() const override { return m_appId; }
49 QPoint position() const override { return QPoint(); }
50 QPoint position() const override { return QPoint(); }
50 QSize size() const override { return QSize(); }
51 QSize size() const override { return QSize(); }
51 void resize(const QSize &size) override { Q_UNUSED(size) }
52 void resize(const QSize &size) override { Q_UNUSED(size) }
@@ -77,6 +78,7 @@ public:
77
78
78private:
79private:
79 QString m_id;
80 QString m_id;
81+ QString m_appId;
80};
82};
81
83
82class MockSurfaceList: public unity::shell::application::MirSurfaceListInterface
84class MockSurfaceList: public unity::shell::application::MirSurfaceListInterface
@@ -811,7 +813,7 @@ private Q_SLOTS:
811 QCOMPARE(launcherModel->get(0)->surfaceCount(), 0);
813 QCOMPARE(launcherModel->get(0)->surfaceCount(), 0);
812 MockApp *app = qobject_cast<MockApp*>(appManager->findApplication(appId));
814 MockApp *app = qobject_cast<MockApp*>(appManager->findApplication(appId));
813 MockSurfaceList* surfaces = new MockSurfaceList(appManager);
815 MockSurfaceList* surfaces = new MockSurfaceList(appManager);
814− surfaces->append(new MockSurface("foobar", surfaces));
816+ surfaces->append(new MockSurface("foobar", "foobar", surfaces));
815 app->setSurfaces(surfaces);
817 app->setSurfaces(surfaces);
816 QCOMPARE(launcherModel->get(0)->surfaceCount(), 1);
818 QCOMPARE(launcherModel->get(0)->surfaceCount(), 1);
817
819