Re: Portrait Maemo app

2008-06-13 Thread Vladislav Grinchenko
David,

 Also, I've just written my first app in gtk/C.
 After sobbing quietly and trying to avoid getting tears on my N800 I'm looking
 forward to getting back to Qt!!
 
 Apologies to any gtk fans out there - I just have a hard time with all the
 pointer casting and trying to bludgeon the OO api into C. Qt was so much more
 elegant.
 

If you are looking for an OO wrapper, then I would highly recommend
official Gtk+ C++ binding - Gtkmm [1]. It's SDK is fully integrated with
maemo (thanks to the relentless work done by good people of Openismus
[2]).

You can install all necessary libraries with one simple meta-package
[3], [4].

There are several Gtkmm applications ported to and integrated with Maemo
UI you can use as an example: glom [5], granule [6] to name a few.



On Thu, 2008-06-12 at 10:51 +0100, David Greaves wrote:
 Lorn Potter wrote:
  Qt's rotation is not done on the hardware level, it is done in Qt's
  software. It can be done, if the transformed driver is being used.
 OK - given no tilt sensor, I'd put buttons in the corners that do the same 
 thing.
 

Same goes for Gtk - all you do is have 2 Views of MVC pattern [7] - one
for landscape, another for portrait. Gtk+ supports text rotation. You
would need to rotate labels of all buttons, reorient toolbars, and
rotate your text/graphics as well. But it is doable. As a good starting
point, look at FBReader source code - the venerable e-books reader does
software rotation without a hitch [8].

 check = (GtkCheckButton*) gtk_check_button_new_with_label(aargh);
 Since when does a constructor need type casting?
 

More like this in Gtkmm:

Gtk::CheckButton cb = Gtk::manage (new Gtk::CheckButton (foobar));

and you don't have to worry about memory management ever again.

 So when can I
   maemo-rootstrap diablo50_Qt_armel
 ? grin
 

I don't think so [9], but I guess, after all, it is a matter of personal
taste. Take a look at Ardour [10] as a good example of separating
functionality from a GUI toolkit.

hope this helps,
--vlg

[1] http://maemomm.garage.maemo.org/docs/index.html
[2] http://www.openismus.com/
[3] http://maemo.org/development/documentation/programming_languages/
[4] http://home.comcast.net/~3rdshift/articles/Nokia770/Maemo-Gtkmm.html
[5] http://www.glom.org/
[6] http://granule.sourceforge.net/
[7] http://en.wikipedia.org/wiki/Model-view-controller
[8] http://www.fbreader.org/
[9]
http://www.gtkmm.org/docs/gtkmm-2.4/docs/FAQ/html/index.html#id2504429
[10] http://ardour.org/development



___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread David Greaves
Lorn Potter wrote:
 Qt's rotation is not done on the hardware level, it is done in Qt's
 software. It can be done, if the transformed driver is being used.
OK - given no tilt sensor, I'd put buttons in the corners that do the same 
thing.

Also, I've just written my first app in gtk/C.
After sobbing quietly and trying to avoid getting tears on my N800 I'm looking
forward to getting back to Qt!!

Apologies to any gtk fans out there - I just have a hard time with all the
pointer casting and trying to bludgeon the OO api into C. Qt was so much more
elegant.

check = (GtkCheckButton*) gtk_check_button_new_with_label(aargh);
Since when does a constructor need type casting?

So when can I
  maemo-rootstrap diablo50_Qt_armel
? grin

gary liquid wrote:
 David,
 
 There are a number of options available to you, but each will depend
 upon your requirements.
 On the nokia device its not lack of options, but graphical bandwidth:
 the display cannot update fast enough to render full screen RGB graphics
 at fullspeed without some sort of tearing.
Ok - not a huge deal; the app is (currently) a simple gtk app; no requirement
for high refresh etc.

 However if you are willing to try, you could look at the following
 options and you may find something which suits you.
 
 The simplest if you are producing an application which just needs to be
 on its side is to rotate your assets:
 Load in the images at 90degrees and translate coordinates around, but
 basically keep the system working as standard on stock hardware.
 Depending upon the performance level you hope to achieve this method may
 not produce desirable results, but will at least be round the corner.
 You should be able to prove pretty quickly if this approach will work
 for you with just a quick hunt through your program.
It's the gtk+ ui that needs to be sideways; tickboxes aren't a huge problem (!)
but labels, scrollbars etc are.

 The second is to actually bite the bullet and install a kernel patch to
 rotate the display.
I'll certainly investigate that. Sounds fun. links? (I'm lost - I think I'm in
maemo.org/twisty passage#341)

 A deeper more outlandish method would be to work around the graphics
 bandwidth problem by coding yourself a graphics library which is based
 on YUV (full resolution greyscale, lower resolution color) and see where
 it gets you..
Ummm, or not. grin
I was raised on perl - I pride myself on my laziness.

 Much like I've started to do:  http://www.youtube.com/watch?v=PUPp_mE7rwI
Hmm - that looks rather nice - are you sharing the code anywhere?
It's nothing like what I'm doing but looks fascinating and I'd be interested in
having a look.

(OK, nice is an understatement. I'd buy another N800 just to play with that!)

How about having non-linear display of the graphics? Ie scaling at the top is
x1, then gradually up to x2, linear for a while and then back down...

David

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread Eero Tamminen
Hi,

ext David Greaves wrote:
 Lorn Potter wrote:
 Qt's rotation is not done on the hardware level, it is done in Qt's
 software. It can be done, if the transformed driver is being used.
 OK - given no tilt sensor, I'd put buttons in the corners that do the same 
 thing.
 
 Also, I've just written my first app in gtk/C.
 After sobbing quietly and trying to avoid getting tears on my N800 I'm looking
 forward to getting back to Qt!!
 
 Apologies to any gtk fans out there - I just have a hard time with all the
 pointer casting and trying to bludgeon the OO api into C. Qt was so much more
 elegant.

You could try pygtk (www.pygtk.org) if performance or memory usage
is not an issue for you.


 check = (GtkCheckButton*) gtk_check_button_new_with_label(aargh);
 Since when does a constructor need type casting?

The Gtk idiom is:
GtkWidget *window;
...
 window = hildon_window_new();
 hildon_program_add_window(HILDON_PROGRAM(program),
   HILDON_WINDOW(window));

 g_signal_connect(G_OBJECT(window), delete_event,
  G_CALLBACK(delete_event_cb), NULL);

I.e. you do the casts when using the object, not when creating it.
And you don't use C casts but appropriate Gtk (or in above Hildon and
Glib) casts which also assert that the casted object is of suitable
type for that cast.


 So when can I
   maemo-rootstrap diablo50_Qt_armel
 ? grin

There's a garage project for Qt:
http://qt4.garage.maemo.org/

Just click the Click to install! button.

There's now supposed to be (somewhere) Qt support for the N8x0
device input method too which was a problem earlier.


- Eero

PS. I don't see much difference between how Gtk and Qt work.
The difference between C and C++ is IMHO much larger. :-)
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread Dave Neary
Hi,

David Greaves wrote:
 Also, I've just written my first app in gtk/C.
 After sobbing quietly and trying to avoid getting tears on my N800 I'm looking
 forward to getting back to Qt!!
 
 Apologies to any gtk fans out there - I just have a hard time with all the
 pointer casting and trying to bludgeon the OO api into C. Qt was so much more
 elegant.
 
 check = (GtkCheckButton*) gtk_check_button_new_with_label(aargh);
 Since when does a constructor need type casting?

Actually, it (usually) doesn't.

 GtkWidget *frame = gtk_frame_new(Checkbox);
 GtkWidget *check = gtk_check_button_new_with_label(aargh);

 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
 gtk_container_add(GTK_CONTAINER(frame),check);

 gtk_widget_show(check);
 gtk_widget_show(frame);

Cheers,
Dave.

-- 
maemo.org docsmaster
Email: [EMAIL PROTECTED]
Jabber: [EMAIL PROTECTED]

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread David Greaves
Eero Tamminen wrote:
 Hi,
 
 ext David Greaves wrote:
 You could try pygtk (www.pygtk.org) if performance or memory usage
 is not an issue for you.
It is.
Not a huge one, but I wanted an app that was as quick as I could reasonably make
it. Plus I wanted to play lower down the stack...

 check = (GtkCheckButton*) gtk_check_button_new_with_label(aargh);
 Since when does a constructor need type casting?
 
 I.e. you do the casts when using the object, not when creating it.
OK - so when I want to do something 'objecty' with it I cast it to that kind of
object.

 And you don't use C casts but appropriate Gtk (or in above Hildon and
 Glib) casts which also assert that the casted object is of suitable
 type for that cast.
Not clear from the docs..
http://library.gnome.org/devel/gtk/stable/GtkToggleButton.html
says:
  gbooleangtk_toggle_button_get_active(GtkToggleButton
*toggle_button);

Which is technically correct but not best practice then?
Ah, I now see that it's mentioned in passing in the example. But it's not clear
in the api _specification_

Ah, I've also seen where it's declared when you make your own widgets... OK.
I'll do some rejigging and see how it turns out - thanks :)

 So when can I
   maemo-rootstrap diablo50_Qt_armel
 ? grin
 
 There's a garage project for Qt:
 http://qt4.garage.maemo.org/
 
 Just click the Click to install! button.
OK

This is still the old scratchbox1 SDK?
(I was hoping to be late enough to the game to miss the migration - I guess not
grin)
I'm using sdk+ on a Debian desktop for the other app.
If there's any interest then I'd be happy to help test the Qt4.
I've also just started throwing up Xen domains so I can have a few SDK vboxes..

Anyhow - downloading...

 There's now supposed to be (somewhere) Qt support for the N8x0
 device input method too which was a problem earlier.
Yell if you find it...

 
 
 - Eero
 
 PS. I don't see much difference between how Gtk and Qt work.
 The difference between C and C++ is IMHO much larger. :-)

I think perhaps that is the issue - OO gui toolkits and C have a bit of an
impedance mismatch.
  http://www.gtkmm.org/
??

gtk_button_set_text(GTK_BUTTON(button), sometext);
=
button.set_text(sometext);

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread David Greaves
Dave Neary wrote:
 Hi,
 
 David Greaves wrote:
 Also, I've just written my first app in gtk/C.
 After sobbing quietly and trying to avoid getting tears on my N800 I'm 
 looking
 forward to getting back to Qt!!

 Apologies to any gtk fans out there - I just have a hard time with all the
 pointer casting and trying to bludgeon the OO api into C. Qt was so much more
 elegant.

 check = (GtkCheckButton*) gtk_check_button_new_with_label(aargh);
 Since when does a constructor need type casting?
 
 Actually, it (usually) doesn't.
 
  GtkWidget *frame = gtk_frame_new(Checkbox);
  GtkWidget *check = gtk_check_button_new_with_label(aargh);
 
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
  gtk_container_add(GTK_CONTAINER(frame),check);
 
  gtk_widget_show(check);
  gtk_widget_show(frame);

Ta - I hadn't picked up that idiom from the api docs I found.

It does make things a bit better - the principle then becomes to cast the Widget
as far down the tree as you need for any type specific functionality.
So I could call new_checkbox and actually cast to a toggle_button to do toggles.

I think my discomfort comes from the weak run-time type checking and the 
verbiage...
  check.set_active(TRUE);
seems so much less error prone; especially for people who have to pick up this
new toolkit (and that's got to be important for attracting developers to Maemo
and making their early experience pleasant).

I mentioned gtkmm (hopefully not a sensitive topic) a moment ago - what are
peoples thoughts on that?

David

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread Marius Gedminas
On Thu, Jun 12, 2008 at 05:36:02PM +0100, David Greaves wrote:
 I think my discomfort comes from the weak run-time type checking and the 
 verbiage...
   check.set_active(TRUE);
 seems so much less error prone; especially for people who have to pick up this
 new toolkit (and that's got to be important for attracting developers to Maemo
 and making their early experience pleasant).
 
 I mentioned gtkmm (hopefully not a sensitive topic) a moment ago - what are
 peoples thoughts on that?

Vala is very interesting to me because (1) it's a high-level language
that is (2) compiled to C.  You ought to get all the benefits of, say,
PyGtk (high-levelness, intuitive syntax, no repetetive mucking around
with typecasts) without the disadvantages (high memory usage).

Marius Gedminas
-- 
Beware of bugs in the above code; I have only proved it correct, not tried it.
-- Donald Knuth


signature.asc
Description: Digital signature
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread Dave Neary

Hi,

David Greaves wrote:
 I think my discomfort comes from the weak run-time type checking and the 
 verbiage...
   check.set_active(TRUE);
 seems so much less error prone; especially for people who have to pick up this
 new toolkit (and that's got to be important for attracting developers to Maemo
 and making their early experience pleasant).
 
 I mentioned gtkmm (hopefully not a sensitive topic) a moment ago - what are
 peoples thoughts on that?

Looks like that's what you need :)

Cheers,
Dave.

-- 
Dave Neary
GNOME Foundation member
[EMAIL PROTECTED]
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread Dave Neary
Hi,

David Greaves wrote:
 I mentioned gtkmm (hopefully not a sensitive topic) a moment ago - what are
 peoples thoughts on that?

For reference, here's the same snippet in gtkmm:

Gtk::Frame frame(Checkbox)
Gtk::CheckButton check(aargh);

check.set_active(TRUE);

frame.add(check);
frame.show_all_children();

Cheers,
Dave.

-- 
maemo.org docsmaster
Email: [EMAIL PROTECTED]
Jabber: [EMAIL PROTECTED]

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-12 Thread Antonio Aloisio
Hi,

On 6/12/08, David Greaves [EMAIL PROTECTED] wrote:

  This is still the old scratchbox1 SDK?
  (I was hoping to be late enough to the game to miss the migration - I guess 
 not
  grin)
Yes, it is.

  I'm using sdk+ on a Debian desktop for the other app.
  If there's any interest then I'd be happy to help test the Qt4.
You are welcome!
Actually Qt is not well integrated, but we are working on it.
I personally invite everyone to use Qt for maemo to develop new
applications for maemo.


   There's now supposed to be (somewhere) Qt support for the N8x0
   device input method too which was a problem earlier.

 Yell if you find it...
Qt applications can use the Hildon Input method via plugin.
(http://andrunko.blogspot.com/2008/05/maemo-keyboard-on-qt4-applications.html)
And this is not the only code available for the input method.
Kate Alhoa annunced some time ago that the code for KDE3 is available,
and now it will ported to KDE4.
I had a look on it the last week, and it will be integrated in Qt soon.
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-08 Thread gary liquid
David,

There are a number of options available to you, but each will depend upon
your requirements.
On the nokia device its not lack of options, but graphical bandwidth: the
display cannot update fast enough to render full screen RGB graphics at
fullspeed without some sort of tearing.

Even before rotating, you may want to examine ways to reduce bandwidth
(lowering resolution is primary).

However if you are willing to try, you could look at the following options
and you may find something which suits you.

The simplest if you are producing an application which just needs to be on
its side is to rotate your assets:
Load in the images at 90degrees and translate coordinates around, but
basically keep the system working as standard on stock hardware.
Depending upon the performance level you hope to achieve this method may not
produce desirable results, but will at least be round the corner.
You should be able to prove pretty quickly if this approach will work for
you with just a quick hunt through your program.


The second is to actually bite the bullet and install a kernel patch to
rotate the display.
This has been seen working by lots of people and whilst requires deeper
system changes makes your coding much simpler (your assets are still laid
out logically)
http://sse2.net/rotate/

A deeper more outlandish method would be to work around the graphics
bandwidth problem by coding yourself a graphics library which is based on
YUV (full resolution greyscale, lower resolution color) and see where it
gets you..

Much like I've started to do:  http://www.youtube.com/watch?v=PUPp_mE7rwI

Obviously there are other options available, but that pretty much covers
what I have heard about people doing recently.

Have fun

Gary (lcuk on #maemo)







On Sun, Jun 8, 2008 at 7:19 PM, David Greaves [EMAIL PROTECTED] wrote:

 Hi
 I'm writing an app that would be best presented in portrait mode - can this
 be done?

 I don't mind jumping through a few hoops but I'd like to share it at some
 point
 so it needs to be done inside my app. Also it would need to scroll down
 (well,
 sideways) a fair few pages.

 I have it mocked up in gtk+ at the moment and it's begging to be turned
 through
 90deg.
 It's a touch based app so there are no typing issues.

 What if I use the new Qt4 port? (The Zaurus Qtopia port introduced rotation
 but
 I think that was at the fb level)

 David
 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://lists.maemo.org/mailman/listinfo/maemo-developers

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Portrait Maemo app

2008-06-08 Thread Lorn Potter
David Greaves wrote:
 Hi
 I'm writing an app that would be best presented in portrait mode - can this 
 be done?
 
 I don't mind jumping through a few hoops but I'd like to share it at some 
 point
 so it needs to be done inside my app. Also it would need to scroll down (well,
 sideways) a fair few pages.
 
 I have it mocked up in gtk+ at the moment and it's begging to be turned 
 through
 90deg.
 It's a touch based app so there are no typing issues.
 
 What if I use the new Qt4 port? (The Zaurus Qtopia port introduced rotation 
 but
 I think that was at the fb level)

Qt's rotation is not done on the hardware level, it is done in Qt's 
software. It can be done, if the transformed driver is being used.



-- 
Lorn 'ljp' Potter
Software Engineer, Systems Group, MES, Trolltech
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers