Monday, June 29, 2009

Qt 4.5.2 and Qt Creator 1.2 were released

In last Thursday, Qt 4.5.2 and Qt Creator 1.2 were released. I download and install Qt 4.5.2 SDK (LGPL) from here. It contains Qt 4.5.2 and Qt Creator 1.2 both.
#./qt-sdk-linux-x86_64-opensource-2009.03.bin
Release of Qt Creator 1.2 includes many UI changes like
  • Characters in menus and windows are well-translated.
  • Welcome screen indicates each Qt SDK samples.
  • and more...
Installation instructions of QtRuby are below:
>cmake \
> -DCMAKE_INSTALL_PREFIX=/opt/ruby-1.9.1 \
> -DRUBY_EXECUTABLE=/opt/ruby-1.9.1/bin/ruby \
> -DRUBY_LIBRARY=/opt/ruby-1.9.1/lib/libruby.so.1.9.1 \
> -DRUBY_INCLUDE_PATH=/opt/ruby-1.9.1/include/ruby-1.9.1 \
> -DQT_QMAKE_EXECUTABLE=/opt/qtsdk-2009.03/qt/bin/qmake \
> -DQT_MKSPECS_DIR=/opt/qtsdk-2009.03/qt/mkspecs \
> -Wno-dev \
> -DENABLE_SMOKE=on \
> -DENABLE_QTRUBY=on \
> -DENABLE_QTWEBKIT_SMOKE=on \
> -DENABLE_QTSCRIPT_SMOKE=on \
> -DENABLE_QTUITOOLS_SMOKE=on \
> -DENABLE_QTTEST_SMOKE=off \
> -DENABLE_PHONON_SMOKE=off \
> -DENABLE_QSCI_SMOKE=off \
> -DENABLE_QWT_SMOKE=off \
> -DENABLE_KDE_SMOKE=off \
> -DENABLE_KDEVPLATFORM_SMOKE=off \
> -DENABLE_KHTML_SMOKE=off \
> -DENABLE_KTEXTEDITOR_SMOKE=off \
> -DENABLE_SOLID_SMOKE=off \
> -DENABLE_PLASMA_SMOKE=off \
> -DENABLE_QTWEBKIT_RUBY=on \
> -DENABLE_QTUITOOLS_RUBY=on \
> -DENABLE_QTSCRIPT=on \
> -DENABLE_QTTEST=off \
> -DENABLE_PHONON_RUBY=off \
> -DENABLE_QSCINTILLA_RUBY=off \
> -DENABLE_QWT_RUBY=off \
> -DENABLE_SOPRANO_RUBY=off \
> -DENABLE_KDEVPLATFORM_RUBY=off \
> -DENABLE_KORUNDUM_RUBY=off \
> -DENABLE_KHTML_RUBY=off \
> -DENABLE_KTEXTEDITOR_RUBY=off \
> -DENABLE_SOLID_RUBY=off \
> -DENABLE_KROSSRUBY=off \
> -DENABLE_PLASMA_RUBY=off \
> -DENABLE_QIMAGEBLITZ_SMOKE=off
Then check QtRuby commands.
>/opt/ruby-1.9.1/bin/rbrcc -version
Ruby Resource Compiler for Qt version 4.5.2
>/opt/ruby-1.9.1/bin/rbuic4 -v
Qt User Interface Compiler version 4.5.2
>/opt/ruby-1.9.1/bin/rbqtapi -v
QtRuby 2.0.3 using Qt-4.5.2

Friday, June 26, 2009

Timetables of RubyKaigi2009 are revealed

2 days ago, timetables of RubyKaigi2009 are revealed.
In my opinion, it's unsatisfactory that ko1(Ruby 1.9 VM)'s session and Yehuda Katz(Merb/Rails3)'s one overlap.

Wednesday, June 24, 2009

QtWebkit HTML5 practice

At phosphorescence: QtWebKit practice and phosphorescence: QtWebkit practice with QtRuby, I wrote QtWebKit sample program with Qt and QtRuby. And I also mentioned QtWebkit suports HTML5 in the phosphorescence: HTML5 support in QtWebkit. Then, can HTML5 be rendered with QtWebKit?

First, access to the HTML5 demo: Canvas | Drawing Board by Qt program.
#include <QApplication>
#include <QUrl>
#include <QWebView>
int main(int argc, char *argv[]){
QApplication a(argc, argv);
QUrl url("http://htmlfive.appspot.com/static/draw.html");
QWebView* webView = new QWebView();
webView->load(url);
webView->show();
return a.exec();
}

This runs successfully:
and can draw lines in canvas by mouse successfully, too.

Second, access to the HTML5 demo: Canvas | 1st-Person Gifter by QtRuby program.
require 'Qt4'
require 'qtwebkit'

Qt::Application.new(ARGV) do
  Qt::WebView.new do
    self.load Qt::Url.new('http://htmlfive.appspot.com/static/gifter.html')
    show
  end
  exec
end

Of course. this runs successfully too and move in maze with arrow keys:

Note that canvas tag is rendered easily, but that video tag depends on environment like video format and codec in client. At least, in my environment (on openSUSE 11.1), video tag isn't rendered not only with QtWebkit but also with HTML5 support browsers(Firefox, Opera, Konqueror).

Monday, June 22, 2009

FizzBuzz with Object#tap

From Ruby 1.9.1, Object#tap is added. What's this? Let's train by FizzBuzz.

fizz_buzz = ->(i) do
case 0
when i % 15
puts 'FizzBuzz'
when i % 5
puts 'Buzz'
when i % 3
puts 'Fizz'
else
puts i
end
end
(1..40).collect do |i|
i.tap(&fizz_buzz)
end

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
Fizz
22
23
Fizz
Buzz
26
Fizz
28
29
FizzBuzz
31
32
Fizz
34
Buzz
Fizz
37
38
Fizz
Buzz
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]

Object#tap evaluates block with self as block-argument, and then return self.

Friday, June 19, 2009

HTML5 support in QtWebkit

A few weeks ago, each developer conference was held by Google and Apple. In each conference, most impressive topic is about HTML5. Google announces Google Wave and recommends Google Chrome 2. And Apple annoucnes Safari 4. All technologies are related with HTML5.

On the other, how Qt supports HTML5? The answer is... already! Several features of Webkit(As you know, it's original program of Google Chrome and Safari) were supported in Qt 4.4, Qt improves its support level in Qt 4.5. See the movie from here:



Of course, API is opened.