Planet maemo: category "feed:a93f39245539231538463d349e184dd2"

Robin Burchell

Qt: open testing infrastructure

2010-06-02 23:47 UTC  by  Robin Burchell
0
0
I recently wrote a post about how Qt could become a more open project, but after writing it, I was left asking myself what more I could do to help further the process.

As a result, I'd like to introduce you to a project I lovingly title the Qt Community Integration System. Its aim: to automatically build, test, and publish community merge requests.

This is an important step in order to help streamline the process of community contribution and get feedback to individual developers quicker. Qt  internally use a similar system, but theirs is not (yet?) public.

How does it work? There are a number of components:

  • A community Qt repository (why not the 'official' one? read on - this is not a fork)
  • This repository is updated by an integration script, which pulls pristine Qt, applies designated merge requests over the top of it, and then pushes it to the master-proposed branch, if they all merge cleanly.

    These lists of merge requests are currently maintained by ..me.

    However, the intention is to give other trusted people, such as those in #qt-labs or who submit frequent merge requests, access to edit these lists and push to this community repository too, so it becomes possible to request integration of a change if you're experienced and trusted.
  • A BuildBot which pulls Qt from the master-proposed branch of this repository, and then proceeds to try to configure, compile, build, and run Qt's extensive test suite, with the help of a custom tool I have purpose-written for this task, unimaginatively called qtestrunner.

    The results of these tests are then published on a website, where they may be viewed by others.
  • This last bit of this puzzle isn't quite finished, but, assuming all of the above steps succeed with no regressions from the previous test run, the master-community branch is updated with the latest contents of the master-proposed branch, as a working snapshot of Qt+community patches.

(Of course, 'master' will eventually be 'all current Qt branches'. I just wanted to pick one to start with.)

So, after I've described all of the above utopia, what's the current status? Well, I've got a lot of the pieces in place, and now I'm fighting problems with Xvfb causing some of the Qt GUI tests to fail *sometimes*, (even though they don't when I run them manually). Once that is solved, I hope to start adding people's access to integration, and start test-integrating merge requests. :)

Hopefully, all this work will help to accelerate the time it takes to send merge requests back for review if they break something, and ease the burden on getting requests merged in (due to requiring a little less testing). Time will tell. But at least I'm doing my bit. Patches welcome. :)

(thanks to John Brooks for copy-editing my appalling English as usual)
Categories: oss
Robin Burchell

FaceBrick - GSOC

2010-06-02 22:29 UTC  by  Robin Burchell
0
0
FaceBrick reached a bit of a mini-milestone today, as it recieved its first external contribution. Kamilla Bremeraunet, FaceBrick's GSOC student, submitted her first merge request adding changing of font sizes based on volume keys.

I made a number of notes where it could be improved, but all in all, it is a fairly solid piece of work.

Here's hoping it continues to move onto bigger and better things.
Categories: oss
Robin Burchell
We've all written our own small toolkits, and the like in the past, and today I revisited my glory days: I made a button.

Actually, it was a bit more involved.

Some of you might have heard of a nifty thing called a QGraphicsScene (and friends), a fairly useful tool to allow for complex rendering/manipulating of 2D objects, animations, all the rest of the bling. It's been used for a lot of things over time, and recently I've been getting to know it in my copious "free time" over this weekend.

I decided to see how difficult it would be to create my own button inside a QGraphicsScene (yes, I know QGraphicsProxyWidget exists, but it is fairly slow, so using it isn't the best for many situations), so while I was at it, I decided to make it blend in with the rest of the widgets on my desktop too.

This is more a proof of concept than anything, but in case anyone else ever wants to write their own widgets and render them in a QGraphicsScene, here's a bit of a pointer in the right direction. ;)

#include <QApplication>
#include <QGraphicsWidget>
#include <QPainter>
#include <QStyleOptionGraphicsItem>

class AButton : public QGraphicsWidget
{
public:
AButton()
: QGraphicsWidget(),
m_isPressed(false)
{
}
QRectF boundingRect() const
{
// TODO: fetch QRectF from text() + icon() and cache
return QRectF(0, 0, 40, 40);
}

void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
{
QStyleOptionButton opt;
// TODO: QStyleOption::initFrom overload for QStyleOptionGraphicsItem would be nice
//opt.initFrom(this);

opt.state = (m_isPressed ? QStyle::State_Sunken : QStyle::State_Raised) | QStyle::State_Enabled;
opt.text = text();
opt.icon = icon();
opt.rect = option->rect;
opt.palette = option->palette;

QApplication::style()->drawControl(QStyle::CE_PushButton, &opt, painter);
}

QString text() const
{
return "hi";
}

QPixmap icon() const
{
return QPixmap();
}

void mousePressEvent(QGraphicsSceneMouseEvent *event)
{
m_isPressed = true;
update();
}

void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
m_isPressed = false;
update();
}

private:
bool m_isPressed;
};

#include <QApplication>
#include <QGraphicsView>

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

// set up scene
QGraphicsScene scene;
AButton button;
scene.addItem(&button);

// add a view
QGraphicsView view(&scene);
view.setRenderHint(QPainter::Antialiasing);
view.resize(200, 100);
view.setBackgroundBrush(QApplication::palette().background());
view.show();

return a.exec();
}

Categories: meego
Robin Burchell

Qt: how to love and embrace being open

2010-05-06 16:03 UTC  by  Robin Burchell
0
0
It's been quite a while since the Qt code was opened up now.
Click to read 1670 more words
Categories: oss
Robin Burchell

GSOC 2010 - Facebrick

2010-05-03 22:12 UTC  by  Robin Burchell
0
0
I've been meaning to write this up for a while, but (due to one thing and another) it's taken a little longer for me to write than I'd have liked. But, better late than never, eh? :)

This is a short note that Facebrick will have a pair of helping hands for 2010, in the form of Kamilla Bremeraunet, a keen Norwegian studying at the University of Hull, in the UK.

A brief list of what she'll be working on (possibly more, if I whip her enough!):
  • A more useful replacement for the Nokia Facebook Desktop widget, which is scrollable,and links to the individual items instead of to www.facebook.com
  • Inbox support: view, send and receive messages
  • Change text size using the volume buttons: at the moment FaceBrick’s font size can’t be changed, and some of the users from the Maemo Community have requested a way of doing so.
I'm sure she'll be a useful help, and that you, the Maemo/MeeGo and Facebrick user community will make her feel more than welcome. You'll be hearing more about her and her intentions in the near future once she finishes up the remainder of her coursework for this semester.
Categories: meego
Robin Burchell

Qt Unit Tests - you can help!

2010-05-03 17:28 UTC  by  Robin Burchell
0
0
Yes, they suck, we all know it. Yes, they're boring to write, and annoying when they break, and generally - the bane of every developer's existence.

But please, write them. A lot.

I've worked on a lot of projects during my life (especially if I count ones I just throw a patch at and never look at again), but one thing that often runs true is that they usually don't have enough unit tests written. This is of perhaps because they don't have enough anal-retentive people like me badgering other people to write unit tests.

Humour aside, unit testing is important, especially when you're working on a library. Bugs are natural, and will happen, but unit tests help to catch bugs (so you don't release horribly broken code), and to prevent the same bugs happening in the future, which is also quite possible.

I was wandering around Qt's code the other week, and was a bit astonished to notice just how few tests some of the base parts of Qt had (QList, QVector, etc.) Now, it's perfectly possible to argue that due to the very fundamental nature of those classes, any breakage would be caught pretty much immediately when compiling Qt itself, but I personally feel it's a lot nicer having proper tests that validate the way your API is supposed to function, *especially* when it's for something that low level and important.

So, I did something about it, and QList and QVector are now fully covered test-wise. Hoorah!

There are still plenty of other areas that could probably use some test loving, so why not check out Qt from git and lend a hand today? :)
Categories: meego
Robin Burchell
I've had a fun weekend.

Carsten Munk, of Mer and other fame got me interested in insane schemes (once again): this time playing around with libdui (or libmeegotouch, as it is now apparently known), as we had repeatedly heard from many sources that it relied on GL, which meant that it couldn't be used with devices that require software rendering. Having found the -software flag to widgetsgallery, and poked around the source of DUI in the past, I thought this was a bit of a funny claim to make, until we actually used it and found out how horribly slow it was. Maybe they had a point?

Why was it slow? Well, it happened again. Not completely the same, of course, but this is a very similar issue to one I wrote about recently in Qt on Maemo. Something that a lot of developers, particularly ones working in higher level libraries or languages like C# or Qt forget from time to time is that image (or pixmap) scaling - in particular, smooth scaling - is generally not a fast operation.

DUI did a lot of scaling.

DUI has a class called MScalableImage, the purpose of which is to draw (and scale) a pixmap as needed, which is a good enough reason to have a class. MScalableImage is passed a pixmap, and stores it.

So far, so good.

Now, onto the details of scaling. When being asked to draw, QPainter pointer is passed, as well as an x, y, width and height. The width and height are checked against the stored pixmap's width and height, and if they match, it's drawn instantly, no questions asked.

So far, so good.

What happens, though, in the case where they don't match?

Oops.

DUI currently copies and rescales the stored pixmap to the target width/height, and then proceeds to draw as normal.

This behaviour is obviously wasteful. In the (frequent) case of GL acceleration, this doesn't really matter so much, because scaling on GL hardware - abstracted away by Qt - isn't all that slow, which is why this problem was probably not noticed previously. In the case of software rendering, though, that's a whole different story.

Patching this away to use the application-wide QPixmapCache drastically improves the performance of software rendering. My laptop isn't exactly slow, and I still ended up with a boost from an (unusable) 5-6 FPS to around 170-180 FPS.

Hopefully this post serves as an educational warning to help prevent future such mistakes.

(Oh, and the conclusion? No, DUI doesn't require GL. It helps, obviously, but it's not required.)
Categories: meego
Robin Burchell
One thing which has increasingly become apparent to me - from wandering around some of the threads on talk.maemo.org - is that there is a very big difference between typical commercial software development, and open development.
Click to read 936 more words
Categories: meego
Robin Burchell

FaceBrick - a Facebook client for Maemo

2010-04-12 16:53 UTC  by  Robin Burchell
0
0
Another great example of how open source is all about 'scratch your own itch'. I started writing code for a Facebook client on Maemo (although once MeeGo is in a more usable state with regards to UI and application development, I'll be porting it to work there as well) a week or two ago now. I finally got tired of using the Nokia Facebook widget which is totally and utterly useless (if I wanted a link to facebook on my desktop, I'd make one. Ok, it's nice being able to see status updates - but come *on*. Let me click them at least.)

So, I started writing code after having found libqfacebookconnect, using Qt. Within a day or two I had something that could read newsfeeds, and post status updates. I found a Qt on Maemo bug along the way, and spent some time digging into that, but it's progressing nicely, and seems to have been quite popular with the folks in the Maemo community.
(facebrick, pre-v0.1)



A few weeks later, and it's growing really well. I'm happy with the progress (although I have a really long list of stuff I still want to do, including replacing that useless desktop widget).

It's going to keep me busy for a fair while to get it up to scratch, but I'm having fun, and the feedback and mini-community I'm forming around this are awesome.
(facebrick, first release)


I'd also like to take a moment to thank m165 (from talk.maemo.org) amongst others for their many ideas and feedback, lcuk (for his interesting discussion), and MohammadAG (from #maemo and TMO) for his help with packaging (though I still have *a lot* to learn in that department)
(facebrick, latest release)










As (I hope) is visible, it's evolving fairly rapidly, mostly through suggestions from the die-hard early adopters I've found, but it's got a long way to go yet.

Thankfully, most of the fun of software development comes from the ride. ;)
Categories: qt
Robin Burchell

Qt on Maemo: a warning

2010-04-06 15:22 UTC  by  Robin Burchell
0
0
Just a quick post to share a fairly important piece of information I found out today with the rest of the internets - hopefully this will help if someone is searching to find out why the list in their Qt application is so slow.
Click to read 1198 more words
Categories: qt
Robin Burchell
In the previous tutorial (http://blog.rburchell.com/2010/02/pyside-tutorial-model-view-programming.html), we covered the basics of how to create a read-only model, with multiple views presenting the data.
Click to read 2314 more words
Categories: pyside
Robin Burchell
The third PySide tutorial here (part two: signals and slots available at http://blog.rburchell.com/2010/02/simple-pyside-tutorial-2-signals-and.html and part one: basic introduction/hello world: http://blog.rburchell.com/2010/01/simple-pyside-pyqt-tutorial-aimed-at.html), we're going to delve into something a little more involved and unique than the last two tutorials.
Click to read 1874 more words
Categories: pyside