DevBlog/drafts/writeup-3-utpass-about-manifest.md
2025-03-24 18:12:44 +01:00

1.1 KiB

permalink, title, categories, tags, layout, is_draft
permalink title categories tags layout is_draft
/posts/writeups/3 Ubunbu Touch Development - Getting About Page Informations from Manifest
Write Up
write up
utpass
ubuntu touch
qt/qml
default.liquid true

Ubunbu Touch Development - Getting About Page Informations from Manifest

Component.onCompleted: {
    var xhr = new XMLHttpRequest();
    xhr.open("GET", Utils.manifestPath(), false);
    xhr.send();
    var mJson = JSON.parse(xhr.responseText);
    manifestTitle.text = "<b>" + mJson.title + "</b>";
    manifestVersion.text = mJson.version + "<br>" + mJson.framework + "@" + mJson.architecture;
    manifestMaintener.text = mJson.maintainer;
}
// utils.h
...
/**
* @brief Retrieves the path to the manifest data.
*
* This function returns the full path to the manifest file used by the application.
*
* @return A QString containing the manifest file path.
*/
Q_INVOKABLE QString manifestPath();
...

// utils.cpp
QString Utils::manifestPath()
{
    auto path = QDir(QDir::currentPath()).filePath("manifest_.json");
    qInfo() << "Manifest path : " << path;
    return path;
}