windowsrunner: Reuse QVariantMap object
This commit is contained in:
parent
e3ab09dbd3
commit
11d813625a
1 changed files with 10 additions and 16 deletions
|
@ -250,11 +250,7 @@ RemoteMatch WindowsRunner::desktopMatch(const VirtualDesktop *desktop, const Win
|
||||||
match.iconName = QStringLiteral("user-desktop");
|
match.iconName = QStringLiteral("user-desktop");
|
||||||
match.text = desktop->name();
|
match.text = desktop->name();
|
||||||
match.relevance = relevance;
|
match.relevance = relevance;
|
||||||
|
match.properties.insert(QStringLiteral("subtext"), i18n("Switch to desktop %1", desktop->name()));
|
||||||
QVariantMap properties;
|
|
||||||
|
|
||||||
properties[QStringLiteral("subtext")] = i18n("Switch to desktop %1", desktop->name());
|
|
||||||
match.properties = properties;
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +262,6 @@ RemoteMatch WindowsRunner::windowsMatch(const Window *window, const WindowsRunne
|
||||||
match.iconName = window->icon().name();
|
match.iconName = window->icon().name();
|
||||||
match.relevance = relevance;
|
match.relevance = relevance;
|
||||||
match.categoryRelevance = categoryRelevance;
|
match.categoryRelevance = categoryRelevance;
|
||||||
QVariantMap properties;
|
|
||||||
|
|
||||||
const QList<VirtualDesktop *> desktops = window->desktops();
|
const QList<VirtualDesktop *> desktops = window->desktops();
|
||||||
bool allDesktops = window->isOnAllDesktops();
|
bool allDesktops = window->isOnAllDesktops();
|
||||||
|
@ -288,38 +283,37 @@ RemoteMatch WindowsRunner::windowsMatch(const Window *window, const WindowsRunne
|
||||||
8, // bitsPerSample
|
8, // bitsPerSample
|
||||||
4, // channels
|
4, // channels
|
||||||
QByteArray(reinterpret_cast<const char *>(convertedImage.constBits()), convertedImage.sizeInBytes())};
|
QByteArray(reinterpret_cast<const char *>(convertedImage.constBits()), convertedImage.sizeInBytes())};
|
||||||
properties.insert(QStringLiteral("icon-data"), QVariant::fromValue(remoteImage));
|
match.properties.insert(QStringLiteral("icon-data"), QVariant::fromValue(remoteImage));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString desktopName = targetDesktop->name();
|
const QString desktopName = targetDesktop->name();
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case CloseAction:
|
case CloseAction:
|
||||||
properties[QStringLiteral("subtext")] = i18n("Close running window on %1", desktopName);
|
match.properties[QStringLiteral("subtext")] = i18n("Close running window on %1", desktopName);
|
||||||
break;
|
break;
|
||||||
case MinimizeAction:
|
case MinimizeAction:
|
||||||
properties[QStringLiteral("subtext")] = i18n("(Un)minimize running window on %1", desktopName);
|
match.properties[QStringLiteral("subtext")] = i18n("(Un)minimize running window on %1", desktopName);
|
||||||
break;
|
break;
|
||||||
case MaximizeAction:
|
case MaximizeAction:
|
||||||
properties[QStringLiteral("subtext")] = i18n("Maximize/restore running window on %1", desktopName);
|
match.properties[QStringLiteral("subtext")] = i18n("Maximize/restore running window on %1", desktopName);
|
||||||
break;
|
break;
|
||||||
case FullscreenAction:
|
case FullscreenAction:
|
||||||
properties[QStringLiteral("subtext")] = i18n("Toggle fullscreen for running window on %1", desktopName);
|
match.properties[QStringLiteral("subtext")] = i18n("Toggle fullscreen for running window on %1", desktopName);
|
||||||
break;
|
break;
|
||||||
case ShadeAction:
|
case ShadeAction:
|
||||||
properties[QStringLiteral("subtext")] = i18n("(Un)shade running window on %1", desktopName);
|
match.properties[QStringLiteral("subtext")] = i18n("(Un)shade running window on %1", desktopName);
|
||||||
break;
|
break;
|
||||||
case KeepAboveAction:
|
case KeepAboveAction:
|
||||||
properties[QStringLiteral("subtext")] = i18n("Toggle keep above for running window on %1", desktopName);
|
match.properties[QStringLiteral("subtext")] = i18n("Toggle keep above for running window on %1", desktopName);
|
||||||
break;
|
break;
|
||||||
case KeepBelowAction:
|
case KeepBelowAction:
|
||||||
properties[QStringLiteral("subtext")] = i18n("Toggle keep below running window on %1", desktopName);
|
match.properties[QStringLiteral("subtext")] = i18n("Toggle keep below running window on %1", desktopName);
|
||||||
break;
|
break;
|
||||||
case ActivateAction:
|
case ActivateAction:
|
||||||
default:
|
default:
|
||||||
properties[QStringLiteral("subtext")] = i18n("Activate running window on %1", desktopName);
|
match.properties[QStringLiteral("subtext")] = i18n("Activate running window on %1", desktopName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
match.properties = properties;
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue