@@ -25,7 +25,7 @@ Q_LOGGING_CATEGORY(UNITY_TOPSURFACELIST, "unity.topsurfacelist")
2525
2626#define DEBUG_MSG qCDebug(UNITY_TOPSURFACELIST).nospace().noquote() << __func__
2727
28−namespace unityapi = unity::shell::application;
28+using namespace unity::shell::application;
2929
3030TopLevelSurfaceList::TopLevelSurfaceList(QObject *parent) :
3131 QAbstractListModel(parent)
@@ -49,7 +49,7 @@ QVariant TopLevelSurfaceList::data(const QModelIndex& index, int role) const
4949 return QVariant();
5050
5151 if (role == SurfaceRole) {
52− unityapi::MirSurfaceInterface *surface = m_surfaceList.at(index.row()).surface;
52+ MirSurfaceInterface *surface = m_surfaceList.at(index.row()).surface;
5353 return QVariant::fromValue(surface);
5454 } else if (role == ApplicationRole) {
5555 return QVariant::fromValue(m_surfaceList.at(index.row()).application);
@@ -60,7 +60,7 @@ QVariant TopLevelSurfaceList::data(const QModelIndex& index, int role) const
6060 }
6161}
6262
63−void TopLevelSurfaceList::raise(unityapi::MirSurfaceInterface *surface)
63+void TopLevelSurfaceList::raise(MirSurfaceInterface *surface)
6464{
6565 if (!surface)
6666 return;
@@ -73,13 +73,13 @@ void TopLevelSurfaceList::raise(unityapi::MirSurfaceInterface *surface)
7373 }
7474}
7575
76−void TopLevelSurfaceList::prependPlaceholder(unityapi::ApplicationInfoInterface *application)
76+void TopLevelSurfaceList::prependPlaceholder(ApplicationInfoInterface *application)
7777{
7878 DEBUG_MSG << "(" << application->appId() << ")";
7979 prependSurfaceHelper(nullptr, application);
8080}
8181
82−void TopLevelSurfaceList::prependSurface(unityapi::MirSurfaceInterface *surface, unityapi::ApplicationInfoInterface *application)
82+void TopLevelSurfaceList::prependSurface(MirSurfaceInterface *surface, ApplicationInfoInterface *application)
8383{
8484 Q_ASSERT(surface != nullptr);
8585
@@ -101,7 +101,7 @@ void TopLevelSurfaceList::prependSurface(unityapi::MirSurfaceInterface *surface,
101101 }
102102}
103103
104−void TopLevelSurfaceList::prependSurfaceHelper(unityapi::MirSurfaceInterface *surface, unityapi::ApplicationInfoInterface *application)
104+void TopLevelSurfaceList::prependSurfaceHelper(MirSurfaceInterface *surface, ApplicationInfoInterface *application)
105105{
106106 beginInsertRows(QModelIndex(), 0 /*first*/, 0 /*last*/);
107107 int id = generateId();
@@ -115,14 +115,14 @@ void TopLevelSurfaceList::prependSurfaceHelper(unityapi::MirSurfaceInterface *su
115115 Q_EMIT listChanged();
116116}
117117
118−void TopLevelSurfaceList::connectSurface(unityapi::MirSurfaceInterface *surface)
118+void TopLevelSurfaceList::connectSurface(MirSurfaceInterface *surface)
119119{
120− connect(surface, &unityapi::MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
120+ connect(surface, &MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
121121 if (focused) {
122122 this->raise(surface);
123123 }
124124 });
125− connect(surface, &unityapi::MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
125+ connect(surface, &MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
126126 if (!live) {
127127 onSurfaceDied(surface);
128128 }
@@ -130,7 +130,7 @@ void TopLevelSurfaceList::connectSurface(unityapi::MirSurfaceInterface *surface)
130130 connect(surface, &QObject::destroyed, this, [this, surface](){ this->onSurfaceDestroyed(surface); });
131131}
132132
133−void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
133+void TopLevelSurfaceList::onSurfaceDied(MirSurfaceInterface *surface)
134134{
135135 int i = indexOf(surface);
136136 if (i == -1) {
@@ -140,9 +140,9 @@ void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
140140 auto application = m_surfaceList[i].application;
141141
142142 // can't be starting if it already has a surface
143− Q_ASSERT(application->state() != unityapi::ApplicationInfoInterface::Starting);
143+ Q_ASSERT(application->state() != ApplicationInfoInterface::Starting);
144144
145− if (application->state() == unityapi::ApplicationInfoInterface::Running) {
145+ if (application->state() == ApplicationInfoInterface::Running) {
146146 m_surfaceList[i].removeOnceSurfaceDestroyed = true;
147147 } else {
148148 // assume it got killed by the out-of-memory daemon.
@@ -153,7 +153,7 @@ void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
153153 }
154154}
155155
156−void TopLevelSurfaceList::onSurfaceDestroyed(unityapi::MirSurfaceInterface *surface)
156+void TopLevelSurfaceList::onSurfaceDestroyed(MirSurfaceInterface *surface)
157157{
158158 int i = indexOf(surface);
159159 if (i == -1) {
@@ -179,7 +179,7 @@ void TopLevelSurfaceList::removeAt(int index)
179179 Q_EMIT listChanged();
180180}
181181
182−int TopLevelSurfaceList::indexOf(unityapi::MirSurfaceInterface *surface)
182+int TopLevelSurfaceList::indexOf(MirSurfaceInterface *surface)
183183{
184184 for (int i = 0; i < m_surfaceList.count(); ++i) {
185185 if (m_surfaceList.at(i).surface == surface) {
@@ -208,7 +208,7 @@ void TopLevelSurfaceList::moveSurface(int from, int to)
208208 }
209209}
210210
211−unityapi::MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
211+MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
212212{
213213 if (index >=0 && index < m_surfaceList.count()) {
214214 return m_surfaceList[index].surface;
@@ -217,7 +217,7 @@ unityapi::MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
217217 }
218218}
219219
220−unityapi::ApplicationInfoInterface *TopLevelSurfaceList::applicationAt(int index) const
220+ApplicationInfoInterface *TopLevelSurfaceList::applicationAt(int index) const
221221{
222222 if (index >=0 && index < m_surfaceList.count()) {
223223 return m_surfaceList[index].application;
@@ -296,15 +296,15 @@ QString TopLevelSurfaceList::toString()
296296 return str;
297297}
298298
299−void TopLevelSurfaceList::addApplication(unityapi::ApplicationInfoInterface *application)
299+void TopLevelSurfaceList::addApplication(ApplicationInfoInterface *application)
300300{
301301 DEBUG_MSG << "(" << application->appId() << ")";
302302 Q_ASSERT(!m_applications.contains(application));
303303 m_applications.append(application);
304304
305− unityapi::MirSurfaceListInterface *surfaceList = application->surfaceList();
305+ MirSurfaceListInterface *surfaceList = application->surfaceList();
306306
307− if (application->state() != unityapi::ApplicationInfoInterface::Stopped) {
307+ if (application->state() != ApplicationInfoInterface::Stopped) {
308308 if (surfaceList->count() == 0) {
309309 prependPlaceholder(application);
310310 } else {
@@ -323,12 +323,12 @@ void TopLevelSurfaceList::addApplication(unityapi::ApplicationInfoInterface *app
323323 });
324324}
325325
326−void TopLevelSurfaceList::removeApplication(unityapi::ApplicationInfoInterface *application)
326+void TopLevelSurfaceList::removeApplication(ApplicationInfoInterface *application)
327327{
328328 DEBUG_MSG << "(" << application->appId() << ")";
329329 Q_ASSERT(m_applications.contains(application));
330330
331− unityapi::MirSurfaceListInterface *surfaceList = application->surfaceList();
331+ MirSurfaceListInterface *surfaceList = application->surfaceList();
332332
333333 disconnect(surfaceList, 0, this, 0);
334334
@@ -401,23 +401,22 @@ void TopLevelSurfaceList::setApplicationsModel(QAbstractListModel* value)
401401 endResetModel();
402402}
403403
404−unityapi::ApplicationInfoInterface *TopLevelSurfaceList::getApplicationFromModelAt(int index)
404+ApplicationInfoInterface *TopLevelSurfaceList::getApplicationFromModelAt(int index)
405405{
406406 QModelIndex modelIndex = m_applicationsModel->index(index);
407407
408408 QVariant variant = m_applicationsModel->data(modelIndex, m_applicationRole);
409409
410− // variant.value<unityapi::ApplicationInfoInterface*>() returns null for some reason.
411− return static_cast<unityapi::ApplicationInfoInterface*>(variant.value<QObject*>());
410+ // variant.value<ApplicationInfoInterface*>() returns null for some reason.
411+ return static_cast<ApplicationInfoInterface*>(variant.value<QObject*>());
412412}
413413
414414void TopLevelSurfaceList::findApplicationRole()
415415{
416416 QHash<int, QByteArray> namesHash = m_applicationsModel->roleNames();
417− QHash<int, QByteArray>::iterator i;
418417
419418 m_applicationRole = -1;
420− for (i = namesHash.begin(); i != namesHash.end() && m_applicationRole == -1; ++i) {
419+ for (auto i = namesHash.begin(); i != namesHash.end() && m_applicationRole == -1; ++i) {
421420 if (i.value() == "application") {
422421 m_applicationRole = i.key();
423422 }