<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dragly &#187; Qt</title>
	<atom:link href="http://dragly.org/category/programming/qt/feed/" rel="self" type="application/rss+xml" />
	<link>http://dragly.org</link>
	<description>It was about time I started writing my own tutorials to share some of the knowledge I&#039;ve picked up from around.</description>
	<lastBuildDate>Mon, 14 May 2012 22:32:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Developing MPI applications in Qt Creator</title>
		<link>http://dragly.org/2012/03/14/developing-mpi-applications-in-qt-creator/</link>
		<comments>http://dragly.org/2012/03/14/developing-mpi-applications-in-qt-creator/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 15:43:08 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=643</guid>
		<description><![CDATA[I have grown very fond of the ease and usability of Qt Creator lately, making it my main tool for developing anything in C and C++. Recently I started learning the MPI framework for doing large scale parallel programming and &#8230; <a href="http://dragly.org/2012/03/14/developing-mpi-applications-in-qt-creator/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have grown very fond of the ease and usability of Qt Creator lately, making it my main tool for developing anything in C and C++. Recently I started learning the MPI framework for doing large scale parallel programming and figured I wanted to try to make MPI play along with Qt Creator.</p>
<p>The first thing I noticed is that there is no problem using Qt Creator as an editor while compiling the MPI executable and running it from the command line. However, for the quick and easy testing of minor changes, running by pressing Ctrl + R in Qt Creator quickly came to a high place on my wish list.</p>
<p>After a quick search around the Internet, I found the necessary adjustments to make this exact thing happen. The steps are as follows:</p>
<h3>Make Qt Creator use mpicxx instead of g++</h3>
<p>To change the compiler in Qt Creator, you simply have to edit the .pro file of your project. Add the following lines, and Qt Creator will call mpicxx instead of g++:</p>
<pre class="brush:shell"># MPI Settings
QMAKE_CXX = mpicxx
QMAKE_CXX_RELEASE = $$QMAKE_CXX
QMAKE_CXX_DEBUG = $$QMAKE_CXX
QMAKE_LINK = $$QMAKE_CXX
QMAKE_CC = mpicc

QMAKE_CFLAGS = $$system(mpicc --showme:compile)
QMAKE_LFLAGS = $$system(mpicxx --showme:link)
QMAKE_CXXFLAGS = $$system(mpicxx --showme:compile) -DMPICH_IGNORE_CXX_SEEK
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS</pre>
<p>This also sets the correct compile and link flags in addition to changing the linker to mpicxx as well. The DMPICH_IGNORE_CXX_SEEK flag is added to avoid some errors I experienced on Red Hat Linux 5.</p>
<h3>Running the application with mpirun</h3>
<p>Usually Qt Creator will simply run the generated executable after compiling, but to make use of multiple processors (which kind of is the whole point with MPI), you have to change the run settings of your project to a custom executable. This is done in the project configuration in Qt Creator under the Run tab for your project.</p>
<p>Add a Custom Executable run configuration and set the executable to /usr/bin/mpirun or any other path where mpirun resides on your system (run &#8216;which mpirun&#8217; in a terminal to find it if you don&#8217;t know where it is). Then, set the arguments to</p>
<pre class="brush:shell">-n 2 yourexecutable</pre>
<p>to run yourexecutable with 2 processors. Of course you&#8217;ll have to change <em>yourexecutable</em> to whatever your executable is named.</p>
<h3>Adding a GUI to your MPI program</h3>
<p>I advice you to not use MPI together with Qt GUI libraries. The reasons for this is that Qt has its own threading classes that are easier to use together with GUI elements in your application if you need them and the fact that if you want to run your app on any large scale cluster you might not be able to use Qt at all, depending on what packages are available on this cluster. A much better solution is to load config settings from a file in the INI format, using for instance the lightweight <a href="http://code.google.com/p/inih/">inih</a> library and make this settings file writable from a Qt GUI application using QSettings to write this file.</p>
<p>The downside of this approach is that you won&#8217;t be able to implement any communication directly with the MPI process, but this could be worked around by for instance reading and writing to a progress status file if this is what you need.</p>
<p>However, it is not impossible to make Qt GUI applications play along with MPI, even though you might have to juggle a bit around with stuff to make it work flawlessly. Passing MPI broadcasts and such to all the other processes is definitely possible, and a relatively small example of how to do this is shown in <a href="http://www.velvet-star.com/qt/">this post</a> by Tiffany Chong and Valencia Hare.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2012/03/14/developing-mpi-applications-in-qt-creator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nanoparticles available for Android and Mac OS X</title>
		<link>http://dragly.org/2012/01/18/nanoparticles-available-for-android-and-mac-os-x/</link>
		<comments>http://dragly.org/2012/01/18/nanoparticles-available-for-android-and-mac-os-x/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 06:58:40 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=618</guid>
		<description><![CDATA[As mentioned in the post about Nanoparticles for Android being just around the corner, I have been able to port Nanoparticles by using the Qt port for Android enabled by the Necessitas project. That&#8217;s why you can download Nanoparticles from &#8230; <a href="http://dragly.org/2012/01/18/nanoparticles-available-for-android-and-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://dragly.org/wp-content/uploads/2011/05/Screenshot-1.png" rel="lightbox[618]"><img class="alignright size-medium wp-image-501" title="Screenshot-1" src="http://dragly.org/wp-content/uploads/2011/05/Screenshot-1-300x212.png" alt="" width="300" height="212" /></a><br />
As mentioned in the post about Nanoparticles for Android <a title="Nanoparticles for Android is just around the corner" href="http://dragly.org/2012/01/07/nanoparticles-for-android-is-just-around-the-corner/">being just around the corner</a>, I have been able to port Nanoparticles by using the Qt port for Android enabled by the <a href="http://sourceforge.net/p/necessitas/home/">Necessitas</a> project.</p>
<p>That&#8217;s why you can download Nanoparticles from Android market right now:</p>
<p><a href="https://market.android.com/details?id=org.dragly.nanoparticles">Download Nanoparticles from Android Market</a></p>
<p>In addition, I have been working on a Mac OS X port. This is still somewhat in an early stage, but should work on most machines. You can <a href="http://dragly.org/source/nanoparticles/download/">download the Mac OS X port for free here</a>.</p>
<p>Both these version include the new party mode with new particles and new game rules. This should give you many more hours of fun particle-based gameplay.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2012/01/18/nanoparticles-available-for-android-and-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Deploy Qt applications for Mac OS X</title>
		<link>http://dragly.org/2012/01/13/deploy-qt-applications-for-mac-os-x/</link>
		<comments>http://dragly.org/2012/01/13/deploy-qt-applications-for-mac-os-x/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 11:55:08 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[dmg]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[qmake]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=606</guid>
		<description><![CDATA[This turned out to be really simple. I was trying to create a Mac OS X version of my game, Nanoparticles, and was having trouble with some flicker when running a QGraphicsView with OpenGL. The solution turned out to simply &#8230; <a href="http://dragly.org/2012/01/13/deploy-qt-applications-for-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This turned out to be really simple. I was trying to create a Mac OS X version of my game, Nanoparticles, and was having trouble with some flicker when running a QGraphicsView with OpenGL. The solution turned out to simply be to <a href="https://bugreports.qt.nokia.com/browse/QTBUG-23619">disable some style sheet settings</a> that I didn&#8217;t need.</p>
<p>After this I wanted to create a nice .dmg file for easy deployment on Mac OS X. Thankfully, this process is not hard either. I found this through the <a href="http://developer.qt.nokia.com/doc/qt-4.8/deployment-mac.html">Qt Documentation</a>, but it is actually simpler than it seems thanks to the macdeployqt tool. This is mentioned on the page, but I decided to give a more thorough walk through on how to use the tool here:</p>
<ol>
<li>Build your application</li>
<li>In the build directory, run
<pre class="brush:shell">macdeployqt yourappname.app -dmg</pre>
<p>macdeployqt is found in the ~/Library/QtSDK/Desktop/Qt/474/gcc/bin folder (if that is where you installed Qt)</li>
<li>You should now have a nice yourappname.dmg file in the build directory. Open this up and check that your application runs from there.</li>
<li>If everything is working fine, you can do some prettifying of your .dmg file by opening it up using the Disk Utility and converting it to a Read/Write disk image.</li>
<li>Open your Read/Write disk image and create a shortcut to your Applications folder. This could either be done by dragging the Applications folder while holding the command key or by creating a symbolic link in terminal:
<pre class="brush:shell">ln -s /Applications ./Applications</pre>
</li>
<li>Edit the icon size, background image, etc. by clicking Command + J to open the View Options. Also, use View -&gt; Hide Toolbar and Hide Sidebar to hide the excessive toolbars from the disk image.</li>
<li>Close the image and use Disk Utility to convert it back to a compressed disk image.</li>
<li>Distribute your .dmg file.</li>
</ol>
<p>If you need more details about the process and how deployment is performed, have a look in the <a href="http://developer.qt.nokia.com/doc/qt-4.8/deployment-mac.html">Qt Docs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2012/01/13/deploy-qt-applications-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nanoparticles for Android is just around the corner</title>
		<link>http://dragly.org/2012/01/07/nanoparticles-for-android-is-just-around-the-corner/</link>
		<comments>http://dragly.org/2012/01/07/nanoparticles-for-android-is-just-around-the-corner/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 02:41:30 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=593</guid>
		<description><![CDATA[Thanks to the great work of Bogdan Vatra and the Qt Developers working on Lighthouse, I have finally been able to create a running version of Nanoparticles on Android. Their efforts have led to the Necessitas project, a very user &#8230; <a href="http://dragly.org/2012/01/07/nanoparticles-for-android-is-just-around-the-corner/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Thanks to the great work of <a href="http://www.behindkde.org/node/925">Bogdan Vatra</a> and the <a href="http://qt.nokia.com">Qt Developers working on Lighthouse</a>, I have finally been able to create a running version of <a title="Nanoparticles" href="http://dragly.org/source/nanoparticles/">Nanoparticles</a> on Android. Their efforts have led to the <a href="http://sourceforge.net/p/necessitas/home/necessitas/">Necessitas project</a>, a very user friendly and working port of Qt to Android.</p>
<p>I&#8217;ve only had a HTC Magic with no OpenGL capabilities available for testing, but still the game is running pretty good. This is giving me perhaps too high hopes about how it will perform on a stronger device, such as a Samsung Galaxy SII. I&#8217;ll try to get hold of a device like that soon.</p>
<p>In addition I&#8217;ve moved almost all the UI code in Nanoparticles over to QML. This finally makes the menus and game logic separated and also has made it a lot easier to add some transitions and user feedback to the UI elements.</p>
<p>I&#8217;ve only got a early alpha version ready at the moment, but I&#8217;ll probably need a lot of help testing how the game runs on different devices and setups. I will post back here as soon as I&#8217;ve got something for you to play with. Maybe I&#8217;ll even push it to Android Market in a not so distant future for early testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2012/01/07/nanoparticles-for-android-is-just-around-the-corner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling locked screen event in Qt for Maemo</title>
		<link>http://dragly.org/2011/05/30/handling-locked-screen-event-in-qt-for-maemo/</link>
		<comments>http://dragly.org/2011/05/30/handling-locked-screen-event-in-qt-for-maemo/#comments</comments>
		<pubDate>Mon, 30 May 2011 11:07:28 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[N900]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[dbus]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[pause]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[state]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=482</guid>
		<description><![CDATA[If you want to pause an application to save battery power when the screen is turned off, you can do this by listening for the locked screen event in Qt for Maemo. However, this is not made easily available through &#8230; <a href="http://dragly.org/2011/05/30/handling-locked-screen-event-in-qt-for-maemo/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you want to pause an application to save battery power when the screen is turned off, you can do this by listening for the locked screen event in Qt for Maemo. However, this is not made easily available through a wrapper function (that I know of), so in this case we&#8217;ll need to resort to listening for the right DBus call. (Thanks to Diph from Maemo.org for <a href="http://talk.maemo.org/showthread.php?p=791167">providing the recipe to make this possible</a>.)</p>
<p>First of all, you&#8217;ll need to enable dbus in your project (.pro) file:</p>
<pre class="brush:shell">maemo5 {
    CONFIG += qdbus
}</pre>
<p>Next up, in your .h file you should add the following to import the DBus headers:</p>
<pre class="brush:shell">#ifdef Q_WS_MAEMO_5
#include &lt;QtDBus/QtDBus&gt;
#endif</pre>
<p>And you&#8217;ll need to add a slot for the screen state change:</p>
<p><span id="more-482"></span></p>
<pre class="brush:cpp">class GameView : public QGraphicsView
{
    Q_OBJECT
public:
    explicit GameView();

public slots:
#ifdef Q_WS_MAEMO_5
    void screenChange(const QDBusMessage &amp;message);
#endif

...

}</pre>
<p>Then, in your .cpp file you&#8217;ll need to load the Maemo DBus definitions and create a connection. Do this outside any function to have it statically available.</p>
<pre class="brush:cpp">#ifdef Q_WS_MAEMO_5
#include &lt;mce/dbus-names.h&gt;
#include &lt;mce/mode-names.h&gt;

static QDBusConnection dBusConnection = QDBusConnection::systemBus();
#endif</pre>
<p>Next up, in the constructor of your class, we&#8217;ll set up the necessary DBus connection and interface:</p>
<pre class="brush:cpp">GameView::GameView()
{
#ifdef Q_WS_MAEMO_5
    dBusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH,
                                       MCE_REQUEST_IF, dBusConnection, this);

    dBusConnection.connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF,
                           MCE_DISPLAY_SIG, this, SLOT(screenChange(const QDBusMessage &amp;)));
#endif
}</pre>
<p>And finally, we&#8217;ll need to fill the function screenChange with something useful. The example below is from my <a title="Nanoparticles" href="http://dragly.org/source/nanoparticles/">Nanoparticles game</a> and simply pauses the game whenever the screen is locked.</p>
<pre class="brush:cpp">#ifdef Q_WS_MAEMO_5
void GameView::screenChange(const QDBusMessage &amp;message)
{
    QString state = message.arguments().at(0).toString();
    if (!state.isEmpty()) {
        if (state == MCE_DISPLAY_OFF_STRING)
            gameScene.pauseGame();
    }
}
#endif</pre>
<p>If you need to check the screen state during startup, have a look at the extra functions <a href="http://talk.maemo.org/showthread.php?p=791167">that Diph mentions</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2011/05/30/handling-locked-screen-event-in-qt-for-maemo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling application minimization in Maemo with Qt</title>
		<link>http://dragly.org/2011/05/26/handling-application-minimization-in-maemo-with-qt/</link>
		<comments>http://dragly.org/2011/05/26/handling-application-minimization-in-maemo-with-qt/#comments</comments>
		<pubDate>Thu, 26 May 2011 11:47:41 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[N900]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[maemo5]]></category>
		<category><![CDATA[minimize]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=476</guid>
		<description><![CDATA[When you are developing with Qt on Maemo you might want to minimize or detect minimization of your application to the dashboard. Qt lacks clean functions for these use cases, but thankfully it&#8217;s still very easy to accomplish them. Minimizing &#8230; <a href="http://dragly.org/2011/05/26/handling-application-minimization-in-maemo-with-qt/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When you are developing with Qt on Maemo you might want to minimize or detect minimization of your application to the dashboard. Qt lacks clean functions for these use cases, but thankfully it&#8217;s still very easy to accomplish them.</p>
<h3>Minimizing the application</h3>
<p>First of all, to minimize your application you&#8217;ll need to add the following CONFIG line to your project file (the .pro file):</p>
<pre class="brush:shell">maemo5 {
    CONFIG += qdbus
}</pre>
<p>Then, in your .cpp or .h file, you&#8217;ll need to include the QtDBus headers:</p>
<pre class="brush:cpp">#ifdef Q_WS_MAEMO_5
#include &lt;QtDBus/QtDBus&gt;
#endif</pre>
<p>You may of course skip the #ifdef statements if you&#8217;d like DBus for other systems as well, but here I&#8217;d like to make this exception only for Maemo. Now, anywhere in your application you may add the following lines to minimize to Maemo&#8217;s dashboard:</p>
<p><span id="more-476"></span></p>
<pre class="brush:cpp">QDBusConnection connection = QDBusConnection::sessionBus();
QDBusMessage message = QDBusMessage::createSignal("/","com.nokia.hildon_desktop","exit_app_view");
connection.send(message);</pre>
<p>This could for example be placed inside a signal that is emitted when the users pushes a dashboard button.</p>
<h3>Detecting minimization</h3>
<p>If you&#8217;d like to detect if the user pressed CTRL + Backspace or any other button to minimize the application, you may do so by adding a changeEvent function to your top-most window. Inside you check the event-&gt;type() against QEvent::ActivationChange and test the isActiveWindow() at the same time. Here is an example from the Nanoparticles game:</p>
<pre class="brush:cpp">void GameView::changeEvent(QEvent *event) {
#ifdef Q_WS_MAEMO_5
    if(event-&gt;type()==QEvent::ActivationChange) {
        if(!isActiveWindow()) {
            gameScene.pauseGame();
        }
    }
#endif
}</pre>
<p>Whenever the game is minimized now, the game is automatically paused to avoid background rendering. The game uses OpenGL to render everything, so this saves the battery drastically.</p>
<p>Enjoy your minimized applications!</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2011/05/26/handling-application-minimization-in-maemo-with-qt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trafikanten on Maemo</title>
		<link>http://dragly.org/2010/09/21/trafikanten-on-maemo/</link>
		<comments>http://dragly.org/2010/09/21/trafikanten-on-maemo/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 18:42:54 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[N900]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=354</guid>
		<description><![CDATA[Update: The package was pushed to Extras testing on 2nd of October. It was delayed because Maemo&#8217;s package repository would not import the new package due to some trouble with the version numbering. There has been missing a native application &#8230; <a href="http://dragly.org/2010/09/21/trafikanten-on-maemo/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://dragly.org/wp-content/uploads/2010/09/Screenshot-20100921-202228.png" rel="lightbox[354]"><img class="size-medium wp-image-355 alignright" title="Screenshot-20100921-202228" src="http://dragly.org/wp-content/uploads/2010/09/Screenshot-20100921-202228-300x180.png" alt="" width="300" height="180" /></a><strong>Update:</strong> <span style="font-style: italic">The package was pushed to Extras testing on 2nd of October. It was delayed because Maemo&#8217;s package repository would not import the new package due to some trouble with the version numbering.</span></p>
<p>There has been missing a native application to access information from Trafikanten on the Nokia N900. Instead it has been necessary to use the mobile version of their websites or maybe even the full version. Even though this is a pretty quick and workable solution, there are several benefits of having a native application available. One that becomes very obvious is the use of GPS to find all nearest bus stops or train stations.</p>
<p>I decided to give it a try in June this year and started by releasing some early versions of what is now named &#8220;Journey Planner for Norway&#8221; (which is &#8220;Reiseplanlegger&#8221; in Norwegian). During the summer of 2010 I have been trying to improve the application over several iterations, and feel that it has now come to a point where it is usable and stable enough to get the infamous &#8220;Version 1.0&#8243; attached to it.</p>
<p>The application is now finding its way through to the Extras-devel catalogue for Maemo and will be pushed upwards through Extras-testing before it hopefully hits Extras within two or three weeks. In the meantime you might either be a bit careless and enable Extras-devel to use the bleeding edge 1.0 version or head over to <a href="http://maemo.org/downloads/product/Maemo5/trafikanten/">Maemo Downloads to fetch the beta</a> which will be automatically updated to 1.0 whenever it is ready.</p>
<p>Below you can check out some more screenshots of the application in action:</p>

<a href='http://dragly.org/2010/09/21/trafikanten-on-maemo/screenshot-20100921-202228/' title='Screenshot-20100921-202228'><img width="150" height="150" src="http://dragly.org/wp-content/uploads/2010/09/Screenshot-20100921-202228-150x150.png" class="attachment-thumbnail" alt="Screenshot-20100921-202228" title="Screenshot-20100921-202228" /></a>
<a href='http://dragly.org/2010/09/21/trafikanten-on-maemo/screenshot-20100921-202446/' title='Screenshot-20100921-202446'><img width="150" height="150" src="http://dragly.org/wp-content/uploads/2010/09/Screenshot-20100921-202446-150x150.png" class="attachment-thumbnail" alt="Screenshot-20100921-202446" title="Screenshot-20100921-202446" /></a>
<a href='http://dragly.org/2010/09/21/trafikanten-on-maemo/screenshot-20100921-202853-2/' title='Screenshot-20100921-202853'><img width="150" height="150" src="http://dragly.org/wp-content/uploads/2010/09/Screenshot-20100921-2028531-150x150.png" class="attachment-thumbnail" alt="Screenshot-20100921-202853" title="Screenshot-20100921-202853" /></a>
<a href='http://dragly.org/2010/09/21/trafikanten-on-maemo/screenshot-20100921-203030/' title='Screenshot-20100921-203030'><img width="150" height="150" src="http://dragly.org/wp-content/uploads/2010/09/Screenshot-20100921-203030-150x150.png" class="attachment-thumbnail" alt="Screenshot-20100921-203030" title="Screenshot-20100921-203030" /></a>
<a href='http://dragly.org/2010/09/21/trafikanten-on-maemo/screenshot-20100921-203038/' title='Screenshot-20100921-203038'><img width="150" height="150" src="http://dragly.org/wp-content/uploads/2010/09/Screenshot-20100921-203038-150x150.png" class="attachment-thumbnail" alt="Screenshot-20100921-203038" title="Screenshot-20100921-203038" /></a>
<a href='http://dragly.org/2010/09/21/trafikanten-on-maemo/screenshot-20100921-203304/' title='Screenshot-20100921-203304'><img width="150" height="150" src="http://dragly.org/wp-content/uploads/2010/09/Screenshot-20100921-203304-150x150.png" class="attachment-thumbnail" alt="Screenshot-20100921-203304" title="Screenshot-20100921-203304" /></a>

<p>The application is developed in C++ using <a href="http://qt.nokia.com">Qt</a> with the Qt Mobility libraries. It should not be too hard to port it to Symbian as well, so I will give that a shot in the future. Symbian users does however already have an option to use the Java application &#8220;<a href="http://tegelsrud.com/trafikantenjava/">Trafikanten Sanntid</a>&#8221; made by Håvard Tegelsrud.</p>
<p>And of course, you can <a href="http://github.com/dragly/trafikanten-maemo">check out the source code here</a>. The application is licensed with the GNU GPLv3 license.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/09/21/trafikanten-on-maemo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Skip the packaging step in Qt Creator 2.0</title>
		<link>http://dragly.org/2010/07/19/skip-the-packaging-step-in-qt-creator-2-0/</link>
		<comments>http://dragly.org/2010/07/19/skip-the-packaging-step-in-qt-creator-2-0/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 22:11:10 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[N900]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=266</guid>
		<description><![CDATA[Qt Creator finally has support for packages, but now it is lacking the support to disable them instead. <a href="http://dragly.org/2010/07/19/skip-the-packaging-step-in-qt-creator-2-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just figured that Qt Creator is now packaging every Maemo application whenever you tell it to run one. This might be annoying if <a href="http://bugreports.qt.nokia.com/browse/QTCREATORBUG-1637">packaging fails</a> and will in any case slow down the whole process of debugging. However, if you want to skip the packaging step, this is not an option in Qt Creator 2.0(!).</p>
<p>Luckily the Qt developers over at Nokia are aware of this and have released a fix in the latest builds of Qt Creator. To acquire these, go to <a href="http://qt.nokia.com/developer/qt-snapshots/">Qt&#8217;s snapshot homepage</a> or just download the <a href="ftp://ftp.qt.nokia.com/qtcreator/snapshots/2010-07-16/qtcreator-linux-x86-opensource-2.0.80-201007160104-setup.bin">32-bit</a> or <a href="ftp://ftp.qt.nokia.com/qtcreator/snapshots/2010-07-12/qtcreator-linux-x86_64-opensource-2.0.80-201007120237-setup.bin">64-bit</a> versions for Linux directly from the build made on 12th of July.</p>
<p>Now you may select to skip the packaging by editing the build steps in Qt Creator.</p>
<p>Be aware that the snapshot versions are in development and may have bugs causing irrevocable data loss. That&#8217;s the risk you&#8217;ve got to take these days to avoid those bloated packages.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/07/19/skip-the-packaging-step-in-qt-creator-2-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Connect to your N900 while developing via usb</title>
		<link>http://dragly.org/2010/07/18/connect-to-your-n900-while-developing-via-usb/</link>
		<comments>http://dragly.org/2010/07/18/connect-to-your-n900-while-developing-via-usb/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 17:16:43 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[N900]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Network Manager]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=251</guid>
		<description><![CDATA[Sometimes it feels good to be a bit lazy and let your OS do that boring terminal-typing for you whenever you connect a new device. <a href="http://dragly.org/2010/07/18/connect-to-your-n900-while-developing-via-usb/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are developing for Nokia N900 using the Nokia Qt SDK, you are most likely following <a href="http://doc.qt.nokia.com/nokia-qtsdk-1.0/creator-developing-maemo.html">this guide</a> to set up your environment. This is all nice and easy, but if you are connecting using usb you have to open a terminal each time you plug in your N900 and write</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> usb0 192.168.2.14 up</pre></div></div>

<p>If you, like me, get tired of doing this you may instead let Network Manager in Gnome do the work for you. First of all, connect your N900 via an available USB port. Next, right click the Network Manager icon and hit &#8220;Edit Connections&#8230;&#8221;.</p>
<p><span id="more-251"></span></p>
<p><a href="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Network-Connections.png" rel="lightbox[251]"><img class="size-full wp-image-252 alignnone" title="Screenshot-Network Connections" src="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Network-Connections.png" alt="" width="436" height="300" /></a></p>
<p>This window will pop up. Press the &#8220;Add&#8221; button.</p>
<p><a href="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Editing-N900-via-usb.png" rel="lightbox[251]"><img class="alignnone size-full wp-image-253" title="Screenshot-Editing N900 via usb" src="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Editing-N900-via-usb.png" alt="" width="361" height="471" /></a></p>
<p>Type in a useful name, such as &#8220;N900 via usb&#8221;, and leave everything under &#8220;Wired&#8221; as is. Select the &#8220;IPv4 Settings&#8221; tab.</p>
<p><a href="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Editing-N900-via-usb-1.png" rel="lightbox[251]"><img class="alignnone size-full wp-image-254" title="Screenshot-Editing N900 via usb-1" src="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Editing-N900-via-usb-1.png" alt="" width="403" height="471" /></a></p>
<p>Set the Method to &#8220;Manual&#8221; and click &#8220;Add&#8221;.</p>
<p>Type in 192.168.2.14 as the address and 255.255.255.0 as the netmask. Leave the gateway blank.</p>
<p>Hit &#8220;Apply&#8221; and you are good to go!</p>
<p>Next, just click the Network Manager icon and select &#8220;N900 via usb&#8221;. If nothing went wrong, you should now be connected to your device, enabling you to use Qt Creator to its full extent. The next time you plug in your N900, Network Manager will do the work for you automatically.</p>
<p><strong>Update: </strong>Note that if you already have a wired connection, Network Manager might try to connect to this so-called &#8220;Auto Ethernet&#8221; connection when you plug in. If this happens, just click the network manager icon and select the correct connection.</p>
<p>This might also happen the other way around, connecting to your USB connection with your Ethernet card, which of course won&#8217;t work. To avoid this completely, you might want to disable auto-connection for you N900 USB.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/07/18/connect-to-your-n900-while-developing-via-usb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing &#8220;undefined reference to `vtable for &#8230;&#8221;</title>
		<link>http://dragly.org/2010/01/03/fixing-undefined-reference-to-vtable-for/</link>
		<comments>http://dragly.org/2010/01/03/fixing-undefined-reference-to-vtable-for/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 23:00:23 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[cplusplus]]></category>
		<category><![CDATA[errors]]></category>

		<guid isPermaLink="false">http://svenni.dragly.com/v7/?p=148</guid>
		<description><![CDATA[These annoying errors have been haunting me the last couple of days, so I figured I should share the most common reason for their occurrence. That is in my projects at least. This error is caused because the linker in &#8230; <a href="http://dragly.org/2010/01/03/fixing-undefined-reference-to-vtable-for/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>These annoying errors have been haunting me the last couple of days, so I figured I should share the most common reason for their occurrence. That is in my projects at least.</p>
<p>This error is caused because the linker in gcc is unable to find the functions you have defined in your headers in your actual code. So if you have a header which looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp-qt" style="font-family:monospace;"><span style="color: #006E28;">#ifndef MESH_H</span>
<span style="color: #006E28;">#define MESH_H</span>
&nbsp;
<span style="color: #0057AE;">class</span> Mesh
<span style="color: #006E28;">&#123;</span>
<span style="color: #0057AE;">public</span><span style="color: #006E28;">:</span>
    Mesh<span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span>
    ~Mesh<span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span>
    <span style="color: #0057AE;">virtual</span> <span style="color: #0057AE;">void</span> draw<span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span>
<span style="color: #006E28;">&#125;</span><span style="color: #006E28;">;</span>
&nbsp;
<span style="color: #006E28;">#endif // MESH_H</span></pre></div></div>

<p>You must at least have these functions defined in your .cpp file:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp-qt" style="font-family:monospace;"><span style="color: #006E28;">#include &quot;mesh.h&quot;</span>
&nbsp;
Mesh<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Mesh</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&#123;</span>
<span style="color: #006E28;">&#125;</span>
&nbsp;
Mesh<span style="color: #006E28;">::</span><span style="color: #2B74C7;">~Mesh</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&#123;</span>
<span style="color: #006E28;">&#125;</span>
&nbsp;
<span style="color: #0057AE;">void</span> Mesh<span style="color: #006E28;">::</span><span style="color: #2B74C7;">draw</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&#123;</span>
<span style="color: #006E28;">&#125;</span></pre></div></div>

<p>After this, make sure you clean your compile environment to make sure no object files are being misinterpreted by the compiler. If you are using Qt or a project with a Makefile, you could just run these three commands (the first only applies to Qt projects).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">qmake
<span style="color: #c20cb9; font-weight: bold;">make</span> clean
<span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/01/03/fixing-undefined-reference-to-vtable-for/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

