QtComponents/Butaca

Butaca is an application to fetch movie-related information. You could see a more detailed description at its home page.

Contents

[edit] Fetch sources

Get master code from git repository located at butaca repo

[edit] Remove unsupported libraries

Check control file to see deps of this apps. At first shight, it dependends of applauncherd and ShareUI. Right now, theres no replacement for this on Fremantle, so functionality provided should be removed.

[edit] Applauncherd

Provides a boost at instantiation time for apps that link with it. You could see more info at Harmmatan API Docs Besides that, provides invoker a tool to launch programs and add splashscreen while application is starting.

We are going to loose splash screen

To remove this library, lookup for MDeclarativeCache inside code. Once again grep is your friend. Once located, replace it by standard QApplication and QDeclarativeView classes.

<syntaxhighlight lang="diff"> diff --git a/src/main.cpp b/src/main.cpp index f27f608..8f1c989 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,24 +22,21 @@

#include <QtGui/QApplication>
#include <QtDeclarative>
#include <QDeclarativeContext>

-#include <MDeclarativeCache>

Q_DECL_EXPORT int main(int argc, char *argv[])
{

- QApplication *app = MDeclarativeCache::qApplication(argc, argv); - QDeclarativeView *view = MDeclarativeCache::qDeclarativeView(); + QApplication app(argc, argv); + QDeclarativeView view;

- QDeclarativeContext *context = view->rootContext(); + QDeclarativeContext *context = view.rootContext();

    ButacaController *controller = new ButacaController(context);

- view->setSource(QUrl("qrc:/qml/main.qml")); - view->showFullScreen(); + view.setSource(QUrl("qrc:/qml/main.qml")); + view.showFullScreen();

- int result = app->exec(); + int result = app.exec();

    delete controller;

- delete view; - delete app;

    return result;
}

</syntaxhighlight>

Remove boostable deps from project files.

<syntaxhighlight lang=diff> diff --git a/butaca.pro b/butaca.pro index 465a010..a493faf 100644 --- a/butaca.pro +++ b/butaca.pro @@ -55,14 +55,8 @@ OTHER_FILES += \

RESOURCES += \
    res.qrc

-# enable booster -CONFIG += qt-boostable qdeclarative-boostable \ - shareuiinterface-maemo-meegotouch \ +CONFIG += shareuiinterface-maemo-meegotouch \

          mdatauri

-QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -QMAKE_LFLAGS += -pie -rdynamic - -LIBS += -lmdeclarativecache

butacascript.files = butaca
butacascript.path = /usr/bin/

</syntaxhighlight>

And invoker from desktop file

<syntaxhighlight lang="diff"> diff --git a/butaca.desktop b/butaca.desktop index 4623ef8..d0af6f4 100644 --- a/butaca.desktop +++ b/butaca.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8

Version=1.0
Type=Application
Name=Butaca

-Exec=/usr/bin/invoker --single-instance --splash /usr/share/butaca/butaca-splash.jpg --type=d /usr/bin/butaca +Exec=/usr/bin/butaca

Icon=/usr/share/icons/hicolor/64x64/apps/butaca.png
Categories=Network;

</syntaxhighlight>

commit

[edit] ShareUI

Share UI is a set of libraries and executables that implements platform-wide selection of destinations to share content. See project README for details.

Right now, we are going to support for this library (By the way, it seems portable to maemo5 without LMT. Any volunteers ?). Butacas defines a ButacaController class to share user preferences with others. So, we follow a 2 step approach

[edit] Hide ShareUI from C++ Code

Easy. we Just use Q_WS_MAEMO_5 and Q_WS_SIMULATOR to get this code compilable on Maemo5 and QtSimulator.

<syntaxhighlight lang="diff"> diff --git a/src/butacacontroller.cpp b/src/butacacontroller.cpp index edba60a..ea58198 100644 --- a/src/butacacontroller.cpp +++ b/src/butacacontroller.cpp @@ -4,8 +4,11 @@

#include "sortfiltermodel.h"

#include <QDeclarativeContext>

+ +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)

#include <maemo-meegotouch-interfaces/shareuiinterface.h>

-#include <MDataUri> +# include <MDataUri> +#endif

ButacaController::ButacaController(QDeclarativeContext *context) :
    QObject(),

@@ -36,6 +39,7 @@ ButacaController::~ButacaController()

void ButacaController::share(QString title, QString url)
{

+#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)

    // See https://meego.gitorious.org/meego-sharing-framework/share-ui/blobs/master/examples/link-share/page.cpp
    // and http://forum.meego.com/showthread.php?t=3768
    MDataUri dataUri;

@@ -52,6 +56,10 @@ void ButacaController::share(QString title, QString url)

    } else {
        qCritical() << "Invalid interface";
    }

+#else + Q_UNUSED(title); + Q_UNUSED(url); +#endif

}

void ButacaController::fetchTheaters(QString location)

</syntaxhighlight>

And disable config requirements on butaca.pro

<syntaxhighlight lang="diff"> diff --git a/butaca.pro b/butaca.pro index a493faf..268b85a 100644 --- a/butaca.pro +++ b/butaca.pro @@ -55,8 +55,10 @@ OTHER_FILES += \

RESOURCES += \
    res.qrc

+!maemo5:!simulator {

CONFIG += shareuiinterface-maemo-meegotouch \
          mdatauri

+}

</syntaxhighlight>

[edit] Disable functionality on QML land

Disable share button on butaca toolbar

<syntaxhighlight lang="diff"> diff --git a/qml/ButacaToolBar.qml b/qml/ButacaToolBar.qml index a57bbcb..a7d2ebe 100644 --- a/qml/ButacaToolBar.qml +++ b/qml/ButacaToolBar.qml @@ -83,7 +83,7 @@ ToolBarLayout {

            when: content !== undefined
            PropertyChanges {
                target: shareIcon

- enabled: true + enabled: false

                visible: true
            }
            PropertyChanges {

</syntaxhighlight>

commit

[edit] Refactor QML files

As on [QtComponents/Miniature], we need to replace namespace by the fremantle one. In this case we need to go a bit further.

[edit] Update namespace

Use [QtComponents/migrateTo], sed or an app like regexxer. See [QtComponents/Miniature] for required changes

[edit] Hardcoded Paths

Butaca fetch Properties directly from UIConstants.js js library. This library is private to QtComponents, so it uses a file://point/to/uiConstants.js schemas that we should also change.

See QtComponents/ThemeHowto for a better (and non upstream portable) way of doing this.

[edit] Remove QtQuick 1.1 code

Reached this point. Project should be runnable on QtSimulator. Use QtSimulator 1.1. If we get console.log errors, it would be produced by unsupported QtQuick 1.1 code.

<syntaxhighlight lang="bash"> PATH/TO/QTSIMULATOR 1.1/Qt/gcc/bin/qmake butaca.pro && make && ./butaca </syntaxhighlight>

See QtComponents/QtSimulator for hints about how to get QtComponents running on it

After a trial and error process we get: <syntaxhighlight lang="diff"> diff --git a/qml/MultipleMoviesDelegate.qml b/qml/MultipleMoviesDelegate.qml index 03b5a05..df468de 100644 --- a/qml/MultipleMoviesDelegate.qml +++ b/qml/MultipleMoviesDelegate.qml @@ -107,7 +107,9 @@ Item {

                    font.weight: movieDelegate.titleWeight
                    font.pixelSize: movieDelegate.titleSize
                    color: movieDelegate.titleColor

- maximumLineCount: 3 + //{QTQUICK1.1 + //maximumLineCount: 3 + //}

                    wrapMode: Text.WordWrap
                    text: title
                }

</syntaxhighlight>

commit.

[edit] Handle Close events

This is easy in this case.

<syntaxhighlight lang="diff"> diff --git a/src/main.cpp b/src/main.cpp index 8f1c989..2fef2c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])

    ButacaController *controller = new ButacaController(context);

    view.setSource(QUrl("qrc:/qml/main.qml"));

+ QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &app, SLOT(quit()));

    view.showFullScreen();

    int result = app->exec();

</syntaxhighlight>

commit

[edit] Adapt deployment to Fremantle

Some changes on how Butaca is deployed are needed to match Fremantle requirements.

[edit] Deployment

Add minimal changes to fit fremantle

[edit] Optify

Point binary to /opt and adapt paths to Fremantle

<syntaxhighlight lang="diff"> diff --git a/butaca.desktop b/butaca.desktop index d0af6f4..6b552de 100644 --- a/butaca.desktop +++ b/butaca.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8

Version=1.0
Type=Application
Name=Butaca

-Exec=/usr/bin/butaca -Icon=/usr/share/icons/hicolor/64x64/apps/butaca.png +Exec=/opt/bin/butaca +Icon=butaca

Categories=Network;

diff --git a/butaca.pro b/butaca.pro index 268b85a..a7b1fa8 100644 --- a/butaca.pro +++ b/butaca.pro @@ -61,15 +61,15 @@ CONFIG += shareuiinterface-maemo-meegotouch \

}

butacascript.files = butaca

-butacascript.path = /usr/bin/ +butacascript.path = /opt/bin/

desktop.files = butaca.desktop

-desktop.path = /usr/share/applications/ +desktop.path = /usr/share/applications/hildon/

icon.files = butaca.png
icon.path  = /usr/share/icons/hicolor/64x64/apps/

splash.files = butaca-splash.jpg

-splash.path = /usr/share/butaca/ +splash.path = /opt/share/butaca/

INSTALLS += butacascript desktop icon splash

</syntaxhighlight>

commit

[edit] Update packing scripts

Now that all required changes are commited. generate patches with <syntaxhighlight lang="bash">git format-patch origin/master</syntaxhighlight> and copy generated files into debian/patches directory.

Finally, modify rules file at debian directory to merge patches. At cdbs rules definition add: <syntaxhighlight lang="make">include /usr/share/cdbs/1/rules/simple-patchsys.mk </syntaxhighlight>

[edit] Adapt Packing files

Set debhelper from 7 to 5 and remove unused deps

<syntaxhighlight lang="diff"> diff --git a/debian/compat b/debian/compat index 7f8f011..7ed6ff8 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +5 diff --git a/debian/control b/debian/control index 374197b..d1711dd 100644 --- a/debian/control +++ b/debian/control @@ -2,9 +2,8 @@ Source: butaca

Section: user/network
Priority: extra
Maintainer: Simon Pena <spena@igalia.com>

-Build-Depends: debhelper (>= 7), applauncherd-dev, cdbs, - libqt4-dev, maemo-meegotouch-interfaces-dev, libmdatauri-dev, - libqtwebkit-dev +Build-Depends: debhelper (>= 5), cdbs, + libqt4-dev, libqt4-webkit-dev, quilt

Standards-Version: 3.8.4
XB-Maemo-Flags: visible
XB-Homepage: https://projects.developer.nokia.com/butaca/

</syntaxhighlight>

And thats all. You have Butaca working on Maemo5