diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2022-02-11 17:05:40 +0200 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2022-02-18 12:58:06 +0200 |
commit | fd578508fe8f59a0bf11916ea99561125dcfc4ba (patch) | |
tree | 09c9adcf3e45a6828ec56b93a8889a0c1233a431 /launcher/src | |
parent | cd7744af494a3399eca3e19fe6d0e134f36c21e7 (diff) |
launcher: Enable scrolling for the GridView to display more appsneedlefish_13.93.0needlefish/13.93.013.93.0
This enables the GridView to allow scrolling and implicitly be able to
display more than a dozen of applications. The interactive mode controls
whether this is enabled or not, if the items is higher than what the grid
can contain (which is 4x3 in our current item cell dimension). If
interactive is enabled we use vertical scrolling, with some commented
out examples on how to enable horizontal scrolling. In tests,
horizontal scrolling caused some animation artefacts while vertical
seemed to behave much more reliable.
With it, we simplify the QML considerably by removing IconItem. Most of
the functionality has been retained, being copy-pasted from IconItem
like displaying icons, or using the first letter of the application name
in case there's no icon.
Note that this change removes The icon movement entirely, which seemed
to cause quite a bit of issues while draging/dropping scrolling in the
the grid itself. This seems to remove one feature for another, but by
just enabling interactive resulted in a jerky inconsistent animation.
Bug-AGL: SPEC-3028
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I64810dbd7ef014ed0473fd92df67807d10cc36ba
Diffstat (limited to 'launcher/src')
-rw-r--r-- | launcher/src/homescreenhandler.cpp | 24 | ||||
-rw-r--r-- | launcher/src/homescreenhandler.h | 1 | ||||
-rw-r--r-- | launcher/src/main.cpp | 2 |
3 files changed, 25 insertions, 2 deletions
diff --git a/launcher/src/homescreenhandler.cpp b/launcher/src/homescreenhandler.cpp index 9cf7e61..33987dd 100644 --- a/launcher/src/homescreenhandler.cpp +++ b/launcher/src/homescreenhandler.cpp @@ -47,10 +47,30 @@ void HomescreenHandler::tapShortcut(QString application_id) } } +int HomescreenHandler::getRunnablesCount(void) +{ + int apps = 0; + + QDBusPendingReply<QVariantList> reply = applaunch_iface->listApplications(true); + reply.waitForFinished(); + + if (reply.isError()) { + HMI_ERROR("Launcher","Unable to retrieve application list: %s", + reply.error().message().toStdString().c_str()); + return apps; + } else { + QVariantList applist_variant = reply.value(); + for (auto &v: applist_variant) + apps++; + } + + return apps; +} + void HomescreenHandler::getRunnables(void) { - struct json_object *json_applist; - QString applist; + struct json_object *json_applist; + QString applist; QStringList apps; QDBusPendingReply<QVariantList> reply = applaunch_iface->listApplications(true); diff --git a/launcher/src/homescreenhandler.h b/launcher/src/homescreenhandler.h index 616f816..7392992 100644 --- a/launcher/src/homescreenhandler.h +++ b/launcher/src/homescreenhandler.h @@ -38,6 +38,7 @@ public: Q_INVOKABLE void tapShortcut(QString application_id); Q_INVOKABLE void getRunnables(void); + int getRunnablesCount(void); void onRep(struct json_object* reply_contents); diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp index 563e883..77dee27 100644 --- a/launcher/src/main.cpp +++ b/launcher/src/main.cpp @@ -44,7 +44,9 @@ int main(int argc, char *argv[]) // mail.qml loading QQmlApplicationEngine engine; + int apps = homescreenHandler->getRunnablesCount(); engine.rootContext()->setContextProperty(QStringLiteral("homescreenHandler"), homescreenHandler); + engine.rootContext()->setContextProperty(QStringLiteral("apps_len"), apps); engine.load(QUrl(QStringLiteral("qrc:/Launcher.qml"))); homescreenHandler->getRunnables(); |