Using QDeclarativeImageProvider for speeding up Symbian QML app installation

truf | 16 December, 2011 21:40

Yeah, that's not a mistake. I've just faced with one special (probably rare) case where the installation time of Symbian QML application had been reduced from 8 min to 30 sec.

How much time do you think could take an installation of 15Mb symbian sis package file without SmartInstaller wrapping? A minute, two? Actually, the right answer depends mostly not on the sis file size but on the number of files in sis package. In general, sis package is just a zip archive with installation script inside. Script execution and file I/O operations took most of the time. In my case I had a QML application with a bit more than 500 image files inside. And it tooks 8 min for my N8-00 to install it on embedded memory card and 3,5 to uninstall. Yeah, there might be applications that require so many graphic files, for example ebooks and card-learning systems as well as games.

To make sure the problem is not sis size dependent I replaced all image files (~19Mb) with only 2 files 10Mb each. And installation proceeds 10 times faster.

So, could we put all application resources in one big file to speed up the installation process? Sure we can with help of The Qt resource system. But there is one big disadvantage: whole resource file have to be loaded into process memory before you can access anything inside it. That means if you can't split your data between resource files and switch between them during application execution (most probably application logic doesn't allow that) you have to load all files in memory when application starts. In my case that was impossible to do because even EPOCSIZE tweaks couldn't help me to avoid *out of memory* crash.

Fortunately I had a deal with image files and found out that QML architects providently took care about overloading image providers in QML. Qt 4.7 contains a nice class called QDeclarativeImageProvider. It provides an interface for supporting pixmaps and threaded image requests in QML. In other words you can derive from that class, create own object from the derived class and attach it to QML engine with certain key (qstring) value. Every time QML engine try to resolve image source "image://you_key/somefile_id.jpg" it will invoke your object's method with somefile_id.jpg as parameter and will expect QImage or QPixmap in return.

So, the solution is obvious. All i need is to put all my image files in zip and implement my QDeclarativeImageProvider-derived class that could read images from the zip. I chose QuaZip library for reading zip's. Some code snippets are below. Also you can find sample project in the attachment.

Declaring our ImageReader class:

 

Its implementation:

Then it could be attached to the QML declarative engine (that should be done before you open any qml file in it):

Here images.zip is our data file and myzip - our keyword.

Now we can use any image from that zip in our qml file like that:

Normal 0 false false false RU X-NONE X-NONE

File 01_sdk_download_v4.jpg will be retrieved from the images.zip when necessary.

Sample project: ZIPDeclarativeImageProvider.zip

Direct launch of Store client with parameters from Qt

truf | 16 November, 2011 18:17

Many Nokia Store distributed applications have "Buy full version" or "Check our other apps" functionality which require opening of Nokia Store client app on certain page. Usually such functions could be implemented by opening store url in system browser. Browser will automatically redirect user to Nokia Store client and open required content or author page in it. But that approach has some disadvantages: (More)

Displaying a landmark in Maps app via AIW API from Qt application

truf | 30 September, 2011 11:55

Under cut you can find a video demonstration and source code of the small Qt app which is able to launch preinstalled Nokia Maps application and display a landmark with custom description in it. Tested with Maps 3.06 and N8-00. Sample can be easely ported back to Symbian C++.

 (More)

Some findings on application orientation in MeeGo 1.2 Harmattan

truf | 13 August, 2011 22:40

Few days ago I had a chance to play for a wile with my Nokia N950. I've tried to port some Qt application from Symbian to Harmattan and unfortunately faced with lack of support of QWidget and QGraphicsView based applications in that platform. Some of my findings are below: (More)

Launching symbian media player for video streaming in Qt project

truf | 14 February, 2011 19:03

Hello,

Sometimes when you are working with video streaming in Qt usage of symbian realplayer for playing it might be the optimal solution.

There are 3 ways for launching system player with custom URL as a parameter in Qt: the right approach, the working approach and the new (for me) approach.

  1. Right approach is to launch URL with QDesktopServices::openUrl() as described here. Thats how things should be done by Qt framework design. In fact QDesktopServices passing its parameter to system handler and system should decide what to do with it. So, "rtsp://" url schema should be opened in realplayer, "mailto:://" schema should launch the email service, "tel://" should launch phone dialer etc. But in Symbian^3 its not working as expected for most of URL schemas. For ex., "rtsp://" is not working. That should be fixed in Qt 4.7.2 - i already posted a bug in qt bugtracker for that (QTBUG-15136).

    But for URL schema (http://) it works. With one disadvantage: default "http://" handler is the system browser. So your URL will be opened in Web Browser and only after that browser will launch a system player. Same things can be achieved with better UX.
  2. Working approach is to launch system media player directly and pass URL to it as parameter. That can be done from Symbian C++ code as described here. Instructions and sample Qt application are attached. Disadvantage of that approach is SwEvent capability requirement. That mean you'll need a DevCert certificate or pass Open Signed Online to try your app.
  3. Recently i found 3rd way for launching URLs in system player from Qt: "Simply create a .ram file, for example foo.ram into file system. The file must contain nothing but the url of the video stream. Then simply open that file with QDesktopServices::openUrl(QUrl::fromLocalFile("c:\test.ram")) The source is on DiBo.Its really working at least for S^3 devices with both rtsp:// and http:// transports. I guess this is a preferable solution nowadays.  


P.S. For soultion for mailto:// schema take a look on QTBUG-15136.

instructions.txt

RTSPTest1.zip

headers.zip

UIQ SDK Download link

truf | 02 March, 2009 09:15

Since developer.uiq.com is down for a long time, and there is no UIQ 3.x SDK copy on Sony Ericsson Developer World, i make bold to upload it to devmobile.ru

 (More)

Symbian Foundation: Calling all developers

truf | 24 February, 2009 18:59

Looks yesterday Symbian Foundation website was updated. As you can see in About:

This is an interim, placeholding website for the Symbian Foundation. We will be launching a full-scale online presence very shortly.

Much more interesting is a registration form in a Developers tab:

Interested in being among the very first developers to join the new Symbian Foundation developer program? Register your interest here and you'll be the first to hear as soon as we have news.

I'm very intrigued by that note. Does anybody know somehing about Symbian Foundation developer program?

 P.S. Today i got notification email about my reselection as FNC for that year. Thank you!

The Future of Mobile Devices

truf | 11 February, 2009 21:15

This January many participants of Forum Nokia and some other communities make forecasts on mobile technologies development in 2009. So, I deside to post my own version for a rather long period. Thats more interesting for me. All the following is just my own ponit of view. It is based on my ideas of IT evolution ways and ideal mobile device. (More)

Bridge between C/C++ and ActionScript 3.0

truf | 23 November, 2008 19:47

Today I find out very interesting project: Adobe Alchemy - "A research project that allows users to compile C and C++ code into ActionScript libraries (AVM2).". It's in a preview state. Published on 17 Nov. There are some quotes from Adobe webpage:

"With Alchemy, Web application developers can now reuse hundreds of millions of lines of existing open source C and C++ client or server-side code on the Flash Platform.  Alchemy brings the power of high performance C and C++ libraries to Web applications with minimal degradation on AVM2.  The C/C++ code is compiled to ActionScript 3.0 as a SWF or SWC that runs on Adobe Flash Player 10 or Adobe AIR 1.5.

Alchemy is primarily intended to be used with C/C++ libraries that have few operating system dependencies. Ideally suited for computation-intensive use cases, such as audio/video transcoding, data manipulation, XML parsing, cryptographic functions or physics simulation, performance can be considerably faster than ActionScript 3.0 and anywhere from 2-10x slower than native C/C++ code. Alchemy is not intended for general development of SWF applications using C/C++.

With Alchemy, it is easy bridge between C/C++ and ActionScript 3.0 to expand the capabilities of applications on the Flash Platform, while ensuring that the generated SWCs and SWFs cannot bypass existing Flash Player security protections."

You can find out more here.

There are video: "Branden Hall, CTO of Automata Studios, discuss his experience working on the Ogg Vorbis porting project using Alchemy", Alchemy toolkit preview, Getting Started instructions and sample libraries. Adobe looking for feedback.

"Project Capuchin"-like solution for Symbian C++

truf | 30 September, 2008 16:21

Hi

I'm not a Flash Lite expert. And never write even one line of Flash code. But i really think Flash is a excellent solution for GUI designing if it can be used as a part of other technology. I'm always looking on SE Project Capuchin with hope what one time such functionality will be aviable for Symbian C++ developers.

Some time ago i read a good news about MobiFLV project:

MobiFLV is Open Source FLV Player for Symbian ported from libavcodec, video decoder part of ffmpeg. MobiFLV is written in C and Symbian C++ language.

MobiFLV is licensed under the GNU Lesser General Public License (LGPL).

Read more about MobiFLV... 

Sittiphol Phanvilai's Forum Nokia Blog "MobiFLV : Open Source FLV Player for Symbian!"

 

But thats Flash Video, what about swf?

I found some old SWF players for S60 2nd ed. So i think SWF player implementation is possible on S60.

Moreother, there is Game SWF project:

gameswf (pronounced "game swiff") is an open source Public Domain library for parsing and rendering SWF movies, using 3D hardware APIs for rendering. It is designed to be used as a UI library for computer and console games.

It is written in C++, and compiles under Windows, Mac OSX and Linux, using GCC and MSVC. It includes code for rendering with OpenGL. The rendering module is factored out so that you can port to other APIs.

Sure its functionality enouth to use Flash instead of GUI as Project Capuchin allow to do.

And there lots of other opensource Flash utilities

I'm sure SWF Player algorithm is not top secret, bcs even Delphi have component to play SWF in applications. And perhaps if i spend more time on google, i will find a better framework which can be easy ported to OpenC or even Symbian C++.

With help of Adobe Open Project we will not have any problem with licensing.

I'm I wrong? As I say, i'm not a Flash Lite coder and want clarify that.

Can Flash support be implemented in native Symbian C++? If yes, then what are we waiting for? Sure, Capuchin-like solution for Symbian C++ is much more valuable then many others OpenSource projects and thats be a best Christmas present for me and hundreds other SC++ developers. I'm ready to take part in such project. So, if thats possible to do, why community still not make it?

Virtual GPS from Skyhook Wireless

truf | 07 May, 2008 21:16

I just check updated Skyhook SDK and find very nice tool:

"Virtual GPS - Developers of GPS-enabled applications can now simply plug into the WPS engine using the NMEA standard interface with no additional code changes" 

Thats just great news. Frankly, using OpenC based Skyhook API in pure Symbian C++ application is a bit ugly for me. Thats great what now user can just install Virtual GPS service on the phone, and any application can get Location from it without any changes in its code!

One problem: i wonder how it can work on device, which already have GPS onboard. Becouse some applications can use both GPS and WPS in one time... or switching then GPS not aviable (perhaps user drive into tunnel).

I cant check Virtual GPS for s60 yet - its still unaviable, bcs it under Symbian Signed process..

Other features of updated Skyhook SDK can be found there

ROMPatcher

truf | 25 April, 2008 15:03

Hi,

Sorry for the short post. I just whant to attract your attention to following blogs: 

ROMPatcher - S60 finally and truly open to anything!

S60 ROM Patcher 

"The technique maps ROM into RAM and then modifies it." "This is not a permanent change; that could only be achieved through the firmware update."

Sounds great. Looks like it's emulate ROM for hacking purposes. Checking it..

May Express Signing become free for freeware?

truf | 13 April, 2008 09:14

 I think about one possibility to improve Symbian Signed process.

 All we know, what Symbian Signed support freeware developer’s community with Submit freeware. Frankly, I never use it, but that process definitely has lots of issues, so developers prefer to publish unsigned applications. What Cellmania do? It's provided access to Cellmania PubId and performs testing (taking risks to sign spyware etc). That's all.

 Now let's see on PubId owners. That’s privileged and controllable category of developers completely hasn’t support for freeware development.  PubId owners don’t need Cellmania, because they can take risks for signed app for self.

 So if I’m a freeware coder,  then I haven’t any reason even try to get PubId, because it's not give me any benefits, and I still have to use Cellmania process. On other side, if I’m PubId owner and I want to sign freeware application for free, then I have no any advantages of owning PubId, and forced to use Cellmania process again. Of course, thats force to publish unsigned applications.

 That’s kind of *supporting* freeware development looks a bit ugly.
 I think Symbian Signed can make it better. Symbian Signed can make Express Signed free for freeware applications.

 
 That will have some advantages and disadvantages. Let’s clear up what that give to us:

  1. Real freeware development support at least for PubId owners. That allows developer to sign freeware application immediately. So PubId owners get more motivation to publish their apps as freeware.
  2. That can help with unsigned applications distribution problem.
  3. That’s make PubId more desired for developers. So freeware developer may prefer to buy PubId.

 Issues:

  1. Who know, is it really freeware application? User can trick Symbian Signed to save 20$.
  2. Risk to sign malware.

 Let’s look closely at our issues. First one is a biggest problem. But it's can be solved well. First of all — PubId owners is vulnerable in compare with other developers. Symbian Signed have good way to penalty irresponsible developer — block its PubId or write off its TC Ids.  And as more desired PubId looks for developer as more he don't want to lose it. That’s why PubId owners more responsible. Second — developer should mark it's submission as freeware before signing, so that kind of submissions is easy to track. Then Symbian Signed can use old technique of submissions random checking to find shareware apps which signed as freeware. If that still looks risky for Symbian Signed, they can implement more severe method: Developer should have enough TC TrustCenter IDs before signing freeware. Those IDs can be locked until Symbian Signed will check submission and confirm its freeware.

 What about malware? 20$ is not a big price for signing malware. Moreover, if someone try to sign malware for free, he's prefer to send it to CellMania then to use PubId which allow to find his real name and firm details. So making Open Signed free for freeware doesn’t open the door for malware.

 Now let's be honest: Symbian Signed will lose some profit (TC Id's), but such kind of freeware support looks much better then existing one.

Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2012 All rights reserved