Saturday, March 28, 2009

iPhone: Download and Display Gravatar

Back to the real iPhone for a while... Gravatar, or globally recognized avatar, is an interesting free service. It can be integrated with AddressBook app or other apps that can have a picture related to email address. Here an Objective-C Example to retrive the Gravatar. It's really simple!

The Source Code is Available Here: iPhone Gravatar Example.

The Apple Worldwide Developers Conference (WWDC) takes place June 8-12, 2009 held at Moscone Center West in San Francisco.

Qt4 iPhone Like App Prefs

Here a simple example on How to Customize an ItemView class, in this case a QTreeView, to be similar to the iPhone Application Preferences Panel.

All the look'n' feel magic is provided by the ItemDelegate that paint the right object using the specified type.

There're six different item types: Button, Link, Group, Value, Multi-Value, Info. Values are all string except boolean that are painted as On/Off Button. Double Tap on this item to change is value. For all the others item when you click on it a right event will be dispatched, and you'll have to handle it to load the right "Edit" page.

This is Just an Example, to use in an application you need, at least, to differentiate the Display Role Value and the real KeyName value.

The Source Code is Available Here: Qt4 iPhone Like App Prefs Source Code.

Tuesday, March 24, 2009

Qt4 Drawing Notification Badges

Wow a Couple of Minutes of Free Time, and here two lines of code example to answer at Dave's question "How to Draw iPhone Like Notification Badges".

Badges are used olso in Mac OS X in application like iTunes and in the DockBar, check this post "Cocoa Notification Badge" to see how to use it with cocoa.

Obviously Notification Badges will be a features of My OpenMoko Apps.

The Example is very simple, there's a method that draws the badge with specified text and Brush, you can put the badge where you want not only on top left as showed in the picture :)

The Source Code is Available here: Qt Draw Badges Source Code.

Sunday, March 22, 2009

OpenMoko: My Phone, Video Preview

We're gonna show you some of future plans. Before that, let me remind you of where we're at with the iPhone. (Greg Joswiak, March 2009 Apple Event)

Ok, the iPhone 3.0 is here (ok, still beta). There're some great features like the Push Notification Service, P2P networking capabilities, Hardware Access and so on... but for us? poor Linux developers?

Previously showed in this post OpenMoko "My iPhone", I'm working to make my Neo Freerunner similar to the iPhone. Yesterday I've switched to QtEmbedded 4.5 for Applications that doesn't require media or phone content, unfortunatly QtEmbedded doesn't have Phonon support.

Till now (Just 3 'days' of development), I've implemented some of the Touch Screen gesture, like sweep, scroll, double tap, zoom, rotation... and others nice features with the accelerometer like Shake and Screen orientation, Normal or Landscape automatically enabled without writing a line of code.

Now there's one more thing I want to show you, a video preview of my OpenMoko.

One more thing "Freerunner freely runs Gentoo", Gentoo Team have reached the first milestone for running Gentoo on the Freerunner.

I'm still an Apple iPhone Fan, but developing OpenMoko with Qt is fantastic! Thanks Trolls!

Sunday, March 15, 2009

OpenMoko: My "iPhone"

No Code Post Yesterday, No Code Post Today.

But for those that doesn't follow my Tweets, Yesterday I've updated the Cocoa SQLite Wrapper to support the NULL value.

I had in plan to post an Example of "Qt Animation", Moving Objects along a path, something like CoverFlow or other Effects. But my Moko needs to be more usable, and needs an iPhone like UI.

Sunday, March 8, 2009

Cocoa: Sidebar with Badges, Take 2

Do you remember the Cocoa Sidebar? No, Take a Look at this post Cocoa Sidebar with Badges.

Joel asked me to revise the Sidebar, allowing to add/remove and do other operation at any time.

I've rewritten all the code of the Sidebar, and I've added a couple of new features, like the default action handler and obviously the ability to add, remove items and badges at any time.

All the past features, like Drag & Drop are still present, but there's something else to do to improve it. If You've suggestions, patches or something else post a comment or send me a mail!

The Source Code is Available Here: Cocoa Sidebar 2 Source Code.

Update 10 March 2008 - Source Updated with Fixes.

Saturday, March 7, 2009

OpenMoko: NEO QtExtended Accelerometer

QtExtended doesn't have an accelerometer class, so I've decided to Write my on class with a simple Example. A Spot that moves around X and Y Axis using Accelerometer Information.

The Second NEO Freerunner Sensor, in contrast to the first sensor  is turned 45 degrees around the Z axis. See the attached image to get a clue about its orientation.

The information from both of the accelerometers is exported through two different input event based file mappings. These device nodes can be found at /dev/input/event2 and /dev/input/event3.

The QAccelerometer Class emit an Event called accelerate(qreal x, qreal y, qreal z) that gives you X, Y, Z axis values.

Each acceleration event relays the current acceleration readings along the three axes of the device. Therefore, a value of 1.0 represents a load of about +1g along a given axis while a value of -1.0 represents -1g.

You can find More information about OpenMoko Accelerometer here "Accelerometer Data Retrieval" and "Accelerometer Technical Fundamentals".
Keep in Mind this Simple Table of X, Y,  Z axis and Phone State:
( 0,  0,  1) = Front
( 0,  0, -1) = Back
( 1,  0,  0) = Vertical (Short Side), Right
(-1,  0,  0) = Vertical (Short Side), Left
( 0, -1,  0) = Vertical (Long  Side), Front
( 0,  1,  0) = Vertical (Long  Side), Back

The Source Code is Available Here: NEO QAccelerometer Test Source Code.

Qt4: Flickr and QtConcurrent

A couple of days ago, I've filled up a Qt Questionnaire and I've seen a couple of subjects that I need to revise. So, Here an Example of Flickr Downloader using QtConcurrent, High Level Network Operations (QNetworkManager), QGraphicsView and QDomElement.

The Flickr Service Class implements, only a couple of Methods. Request of Recently added and Interesting Photos, and the Search Photos Methods.

The Source Code is Available Here: QFlickr Test Source Code. (You Must Set your Flickr Key!)

PS: Starting Today, All the Qt4 Examples/Libraries will be released under LGPL license while the Cocoa Examples/Libraries will be released under BSD license.

Sunday, March 1, 2009

Qt4 Black Bar and Buttons

Today I've written a couple of Widgets for my next Qt4 Application. And below you can see an Example of UI using Two widget, the BlackBar and the BlackButton.

The BlackBar looks like the iTunes bar of Podcast page. Is something like a TabBar. The Black Buttons has a SetRadius Methods that allow you to modify the Button Shape.

The Source Code is Available Here: Qt4 THLibrary Preview Source Code.