52 lines
1.1 KiB
Markdown
52 lines
1.1 KiB
Markdown
---
|
|
permalink: /posts/writeups/3
|
|
title: Ubunbu Touch Development - Getting About Page Informations from Manifest
|
|
categories:
|
|
- Write Up
|
|
tags:
|
|
- write up
|
|
- utpass
|
|
- ubuntu touch
|
|
- qt/qml
|
|
layout: default.liquid
|
|
is_draft: true
|
|
---
|
|
## Ubunbu Touch Development - Getting About Page Informations from Manifest
|
|
|
|
|
|
|
|
```js
|
|
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;
|
|
}
|
|
```
|
|
|
|
|
|
|
|
```cpp
|
|
// 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;
|
|
}
|
|
``` |