QtComponents/Butaca
(→ShareUI) |
|||
Line 100: | Line 100: | ||
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 | 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 | ||
- | === Hide ShareUI from C++ Code === | + | ==== 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. | Easy. we Just use Q_WS_MAEMO_5 and Q_WS_SIMULATOR to get this code compilable on Maemo5 and QtSimulator. | ||
Line 159: | Line 159: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
- | === Disable functionality on QML land === | + | ==== Disable functionality on QML land ==== |
Disable share button on butaca toolbar | Disable share button on butaca toolbar | ||
Revision as of 17:50, 13 September 2011
Butaca is an application to fetch movie-related information. You could see a more detailed description at its home page.
Contents |
Fetch sources
Get master code from git repository located at butaca repo
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.
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 = QApplication(argc, argv); + QDeclarativeView view = QDeclarativeView();
- 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(); 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
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
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>
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
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 use migrateTo for this task.
Update hardcoded paths
Remove QtQuick 1.1 code
commit.
Handle Close events
This is easy in this case.
<syntaxhighlight lang="diff"> </syntaxhighlight>
commit
Adapt deployment to Fremantle
Some changes on how Butaca is deployed are needed to match Fremantle requirements.
Optify code
Update Desktop file
And finally, update desktop file. There's no applauncerd on fremantle, so remove invoker from Exec. With this action we loose splash-screen.
commit
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 config-stamp rule add: <syntaxhighlight lang="make">for p in debian/patches/*; do patch -p1 < $$p; done </syntaxhighlight>
And thats all. You have Butaca working on Maemo5