maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [Help] QML DEB Packager (https://talk.maemo.org/showthread.php?t=88844)

flotron 2013-01-28 20:08

[Help] QML DEB Packager
 
1 Attachment(s)
I have the script that creates the deb file, and i want to know if someone knows how to execute the script from QML to the folder to be packaged. For example: The ui with a button "package" and a window that user select the folder to be packaged

The script is attached.

How to package with the script only (Themes packaging example):

1- Must have installed binutils on n9 (apt-get install binutils)
2- Must have the folder structure of your theme like: /themename/usr/share/themes/themename/meegotouch/etc...
3- inside the first structure (/themename) must be another folder called "DEBIAN", so it will be /themename/DEBIAN
4- Inside DEBIAN must be file called "control" with this inside:
Package: themename
Name: themename
Version: 0.1
Architecture: armel
Description: themename
Maintainer: you <you@hotmail.com>
Author: you <you@hotmail.com>
Section: user/Utilities+
5- Copy folder structure to /home/user and "make-deb.sh" script file to /home/user/Mydocs
6- From phone terminal write this: sh /home/user/MyDocs/make-deb.sh /home/user/themename

marxian 2013-01-28 20:42

Re: [Help] QML DEB Packager
 
You can execute scripts from QML via QProcess. To do this, you first have to write a wrapper class for QProcess and using the Q_PROPERTY macro to make properties available to QML. You can then either create an instance of this class from the C++ side and make it available via QDeclarativeContext::setContextProperty(), or register it as a QML type to allow instances of the class to be created in QML.

I have already written a QProcess wrapper class called QDeclarativeProcess for my Qt Components Hildon package. The source code is here: https://github.com/marx1an/qt-compon...components/src (qdeclarativesettings.h and qdeclarativesettings.cpp). If you include these two files in your project, you can use the QProcess API via QML as follows:

In your main.cpp file:

Code:

#include "qdeclarativesettings.h"
#include <qdeclarative.h> // you might not need this depending on your existing #includes

qmlRegisterType<QDeclarativeProcess>("com.components.processes", 1, 0, "Process");

qmlRegisterUncreatableType<QDeclarativeProcessEnums>("com.components.processes", 1, 0, "Processes");

The "com.components.processes" can be replaced with whatever import URI you prefer.

In QML:

Code:

import com.components.processes 1.0

Process {
    id: process

    command: // command to launch the script.
}

Button {
    id: button

    text: "Launch script"
    onClicked: process.start()
}

You can see a more detailed example of how it's used from QML here: https://github.com/marx1an/qt-compon...rocessPage.qml


All times are GMT. The time now is 20:55.

vBulletin® Version 3.8.8