Saturday, February 11, 2012

Qml FileDialog for symbian anna and belle

I recently ported my Audiobook Reader app for symbian using symbian components. As there is no common QML based file dialog, I need to create my own.

I uploaded my implementation to Gitorious repository here. Currently this code works for only symbian as its used symbian components, but it can be easily ported to work on meego as well.

In this post I will try to explain how this file dialog can be used. Repository also include full working sample.

Lets start with main.cpp file. We need to create instance of FileModel and share it with QML and rest of code is to launch our mainl Qml file.

int main( int argc, char* argv[] ) {
    QApplication app(argc,argv);

    QDeclarativeView view;

    FileModel fileModel;
    QDeclarativeContext *ctxt = view.rootContext();
    ctxt->setContextProperty("fileModel", &fileModel);

    view.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    view.setResizeMode( QDeclarativeView::SizeRootObjectToView );
    view.setSource(QUrl("qrc:/main.qml"));
    view.show();

    return app.exec();
}
Now QML file which needs to use FileDialog, following code can be used. Here in openFile function, if you want to select Folder/Directory then dirMode should be set to true, if you want to select File than set it to false.
    Page{
        id:page

        function openFile( dirMode ) {
            var component = Qt.createComponent("FileDialog.qml");
            var dialog = component.createObject(page);
            if( dialog !== null ) {
                if( dirMode) {
                    dialog.dirMode = true;
                }
                dialog.fileSelected.connect(fileSelected);
                dialog.directorySelected.connect(directorySelected);
                dialog.open();
            }
        }

        function fileSelected( filePath ) {
            console.debug("File selected:" + filePath);
        }

        function directorySelected( dirPath ) {
            console.debug("Folder selected:" + dirPath);
        }

        tools: ToolBarLayout {
            ToolButton {
                iconSource: "toolbar-back";
                onClicked: {
                    Qt.quit();
                }
            }
            ToolButton {
                text: "File Selection"
                onClicked: {
                    page.openFile(false);
                }
            }
            ToolButton {
                text: "Folder Selection"
                onClicked: {
                    page.openFile(true);
                }
            }
        }
    }
Following are few snaps of FileDialog component running from my Audiobook reader application.

Here is demo of file dialog.

Audiobook Reader for symbian Belle and Anna



I recently ported my Audiobook Reader application to Symbian (supports Anna and Belle).

I struggled a lot while porting this to symbian. For example phonon has some problem with Qt 4.7 on symbian and I wested almost one day to find out solution. If you are also facing similar problem. Then visit this link and this.

Capturing volume key was another problem. I required to use native symbian remote control api to resolve this issue. Visit this link for more info.

And as I use ubuntu machine as development machine, debugging and compilation was another problem.

But finally I was able to port it successfully and now its available on Nokia Store.
Please download it from below.
- Fixed web browser: http://store.ovi.com/content/120217
- Nokia mobile browser: http://store.ovi.mobi/content/120217
Following is demo. Hope you will like it.


Friday, February 10, 2012

Unboxing Nokia Lumia 800

I recently received Nokia Lumia 800 from Nokia Launchpad program. Following are few unboxing snaps.

So far experiance is good, nice little box with accessory and phone cover.


Phone build quality is good and fealt solid while holding it.
I was not able to get beyound following screen, it stuck here and I was not able to boot phone. I can not understand if this screen meant to connect it to pc or it is asking for charging. I tried both but did not get success. Thus unboxing ends here and starts my struggle with my first windows phone.


Update: Now that I received replacement device, I was able to boot and use it for some time. Here are few snaps after power on. I used it only for some time, I prefer to use my meego device, but I liked this device a quite a lot, its animation is quite smooth and fluid. It's UI is quite refreshing and simple. App are lauhced in vary responsive manner and did not faced any hang. Office integration is good and I can easily access my skydrive account from it.

Thing I dont liked are, not able to upgrade it over the air, lack of mass storage, must use of zune( which is not availble for linux), and most dispressing I can not develop apps for it as tools are only for windows. Still device is good and I would like to try developing for it, someday when I have access to windows machine.



 


 





Friday, February 3, 2012

Qt SDK 1.1.4 installation problem on Ubuntu 11.10

Recently Qt SDK 1.1.4 got released and I was trying to install it on my ubuntu machine with Ubuntu 11.10.

All other previous version of Qt SDK were getting installed fine but when I try to install Qt SDK 1.1.4, I found that soon after starting installer, installer disappear and never shows it self again. Same problem also happens to SDK upgrader of Qt SDK 1.1.3.

But I was not having enough time to identify the problem so I continued using older Qt SDK. But now I found solution to this problem.

It looks like that GTK+ GUI style is not compatible with Qt on Ubuntu 11.10, so you need to change that to something else. I changed it to Motif and then new installer started working. To change GUI style you need to use "qtconfig-qt4"

Install it using following command, if you don't have it already.
sudo apt-get install qt4-qtconfig
More information can be found here.