This chapter describes how to use kdevelop 2.1.5 with integrated cross compiling features and QT-Designer. If you have an older version, you should update to 2.1.5. QT-Designer has to be a 2.x version. QT-Designer 3.x delivers different outputs which are not compilable by uic2.
We will explain the usage of kdevelop using a standard kdevelop project as an example. This may not be very usefull first, but guarantees the correct creation of all kdevelop relevant scripts / files.
After the first steps are compilable (x11, emb, arm), we will extend that standard project with some new Dialog Elements using QT-Designer.
This chapter will close with the description of automated ipkg-creation. For that I use a set of bash/perl-scripts to create the ipkg. I will describe the usage and installation of that scripts (and the ipkg-build tool).
Least but not last the next chapter OPIE Tutorial will explain how to go on with
the kdevelop sources to get them OPIE-ready.
Hint
I did not really test Gideon (3.x). Min. under Debian it seems to conflict with kdevelop 2.1.5,
which is the reason I did not test it yet. Beside that I did not yet find an easy way to
transfer 2.1.x projects to 3.x. As I want to wok on my projects, I still stay on 2.1.5.
In principle kdevelop uses the already known environmentscripts from above for
crosscompilation. Some of the environment variables have to be fead into kdevelops setup
entries to create different targets.
Configured with that environment scripts, kdevelop is able to use crosscompilers and create output for different targets. We will handle qt-embedded (x11) as a cross-target as well, as it uses a different qte version (and different opie).
The menu options/kdevelop setup/compiler allows the user to define the cross compilation tools.
Assuming you have a i386 as the host, you can choose the build system as i386, linux and the target
compile system as an arm, linux.
I have the following entries filled in (is this way installed as standard).
Attention
Dont use special characters to name your target system (e.g. blanks, ... ), because kdevelop
works, but destroys the *.kdevses file. I did not do this my own, but got an email
from a user who went into this trap. I am not sure, whether this bug is still existing.
Just in case ;-).
We know will create a test application called testopie. Leave kdevelop, open an x-terminal and
change to qtx11 environment. Start kdevelop from here kdevelop &. The environment guarantees that
kdevelop finds all needed libs/paths.
Enter the menu project/new and select Qt-SDI from the upcoming list. Select
Next, enter the Project-Name testopie and press Create (dont care for
the other options and CSV for the moment).
KDevelop will create a subdir called testopie in your development (home) dir, which contains all relevant
data. (The source files are found in testopie/testopie dir). You maybe will get an error like shown below.
Ignore that for now. KDevelop will try to create its templates using QT3. In my case this is not reachable by the normal QTDIR entry. So I (and maybe also you) will get that error.
Press Exit to finalize your project. Before we are able to compile the X version, we have to setup some more config entries.
For this enter the menu project/options and select Configure-Settings from the upcoming list. Enter QT/KDE-Version 2 in the appropriate field. Select Compiler-Options now from the list and choose the tab-entry Configure. Insert (overwrite) /usr/lib/qt2 into the --with-qt-dir field. The other entries may stay, as they are for now. Press OK and confirm the configure regeneration. Wait until that process has finished. Press <F9> now to build and start your application.
Here we have the result.
Just switch to qtemb environment and start kdevelop from the shell.
To prepare for emb crosscompiling, follow the steps below.
void TestopieApp::slotFileOpen()
{
statusBar()->message(tr("Opening file..."));
/*
QString fileName = QFileDialog::getOpenFileName(0,0,this);
if (!fileName.isEmpty())
{
doc->load(fileName);
setCaption(fileName);
QString message=tr("Loaded document: ")+fileName;
statusBar()->message(message, 2000);
}
else
{
statusBar()->message(tr("Opening aborted"), 2000);
}
*/
}
void TestopieApp::slotFileSaveAs()
{
statusBar()->message(tr("Saving file under new filename..."));
/*
QString fn = QFileDialog::getSaveFileName(0, 0, this);
if (!fn.isEmpty())
{
doc->saveAs(fn);
}
else
{
statusBar()->message(tr("Saving aborted"), 2000);
}
*/
statusBar()->message(tr("Ready."));
}
void TestopieApp::slotFilePrint()
{
statusBar()->message(tr("Printing..."));
/*
QPrinter printer;
if (printer.setup(this))
{
QPainter painter;
painter.begin(&printer);
///////////////////////////////////////////////////////////////////
// TODO: Define printing by using the QPainter methods here
painter.end();
};
*/
statusBar()->message(tr("Ready."));
}
/***************************************************************************
main.cpp - description
-------------------
begin : Sam Aug 30 10:13:44 CEST 2003
copyright : (C) 2003 by Werner Schulte
email : werner@schulte-ac.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <qapplication.h>
#include <qfont.h>
#include <qstring.h>
#include <qtextcodec.h>
#include <qtranslator.h>
#include "testopie.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setFont(QFont("helvetica", 12));
QTranslator tor( 0 );
// set the location where your .qm files are in load() below as the last parameter instead of "."
// for development, use "/" to use the english original as
// .qm files are stored in the base project directory.
tor.load( QString("testopie.") + QTextCodec::locale(), "." );
a.installTranslator( &tor );
/* uncomment the following line, if you want a Windows 95 look*/
// a.setStyle(WindowsStyle);
TestopieApp *testopie=new TestopieApp();
a.setMainWidget(testopie);
testopie->show();
return a.exec();
}
The next paragraph shows the modified main.cpp.
Modified lines are embraced by
/**------...-----**/
lines.
/***************************************************************************
main.cpp - description
-------------------
begin : Sam Aug 30 10:13:44 CEST 2003
copyright : (C) 2003 by Werner Schulte
email : werner@schulte-ac.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/** --------------------------------------- **/
#ifndef QWS
#include <qapplication.h>
#else
#include <qpe/qpeapplication.h>
#endif
// #include <qapplication.h>
/** --------------------------------------- **/
#include <qfont.h>
#include <qstring.h>
#include <qtextcodec.h>
#include <qtranslator.h>
#include "testopie.h"
int main(int argc, char *argv[])
{
/** --------------------------------------- **/
#ifdef QWS
QPEApplication a(argc, argv);
#else
QApplication a(argc, argv);
#endif
// QApplication a(argc, argv);
// a.setFont(QFont("helvetica", 12)); // Dont use font and scaling for embedded use
// You never know, how large the display is.
/** --------------------------------------- **/
QTranslator tor( 0 );
// set the location where your .qm files are in load() below as the last parameter instead of "."
// for development, use "/" to use the english original as
// .qm files are stored in the base project directory.
tor.load( QString("testopie.") + QTextCodec::locale(), "." );
a.installTranslator( &tor );
/* uncomment the following line, if you want a Windows 95 look*/
// a.setStyle(WindowsStyle);
TestopieApp *testopie=new TestopieApp();
/** --------------------------------------- **/
#ifdef QWS_OPIE
a.showMainWidget(testopie);
#else
a.setMainWidget(testopie);
#endif
// a.setMainWidget(testopie);
/** --------------------------------------- **/
testopie->show();
return a.exec();
}
/usr/local/bin/qfvb &. This should start your qvfb application. You will see
a 240x320 Window with a black background.
Congratulations !!!
You finally made it ...
The result binary can be found in the directory $HOME/testopie/emb/testopie.
To go to real opie (ipaq / sharp) from here is easy. Stop kdevelop, exit your qtopieemb environment and switch to qtopiesharp environment instead. Restart kdevelop from the shell.
Note that we do the preparation for arm here, but call the kdevelop target opie, as the resulting ipks are usable for ipaq and sharp .
To prepare for arm crosscompiling, follow the steps below.
Congratulations !!!
You finally made it ...
The result binary can be found in the directory $HOME/testopie/opie/testopie. Transfer the binary to your
handheld and try it starting it from a shell. It should work out of the box. Here is the screenshot from
my ipaq.
to be done ...
NOT ACTUAL - Will be subject of change
This section describes the tools I prepared to create automated ipkgs out of kdevelop arm(opie) project.
Some shell- and perlscripts copied into the project dir of your project and adopted to you needs will allow you to create an ipkg mostly automated. This is not helpfull (or only partly) for Opie integration, as opie creates its own ipk package. But the user may want to use his project as a standalone ipkg. In this case follown the instructions below. If you are behind Opie integration, you may want to use the automatic created *.desktop and *.pro file.
Again we use our above created testopie project as an example.
Unpack tha tar ball ipkg_kdev_x.y.z.tgz in $HOME/testopie. The result will be two additional files _postinst and _xtrarc and a subdir ipkg.
The following itemlist describes the different files and how to manipulate them.
my $VERSION="0.4";
my $PALMTOP="QtPalmtop";
my $ipk_destipk="/home/sc/project/scipkgs";
my $ipk_shortinfo =
"QTravel is a program for travel expenses\n".
" overview. Additinally it allows the organization\n".
" of group expenses and the sampling of tips (e.g. Restaurant\n".
" quality, etc ...)\n";
my $ipk_depends = "opie-base,libuvdebug,libuvqtutil";
###############################################
# erzeugt den SourceString #
###############################################
sub setSoureString
{
my $ipk_srcdest = "http://www.uv-av.de/".$ipk_project."/".$ipk_project."-SRC-".$ipk_version.".tgz";
}
And here the modified ones ( changed lines marked with
# ---------------------------
my $VERSION="0.4";
my $PALMTOP="QtPalmtop";
my $ipk_destipk="/home/sc/project/scipkgs";
my $ipk_shortinfo =
"Testopie is an example program for \n".
" Opiedevelopment using kdevelop 2.1.5\n";
my $ipk_depends = "opie-base";
###############################################
# erzeugt den SourceString #
###############################################
sub setSoureString
{
my $ipk_srcdest = "http://www.uv-av.de/".$ipk_project."/".$ipk_project."-SRC-".$ipk_version.".tgz";
}
qtopie_arm environment.cpipk.rc copies non specific files and executes a project specific shellscript
called _xtrarx located in your project dir (not in admin).
ipk_opie.pl.
It creates the ipk, which finally can be found in the destination dir.
ipk_opie.pl is a helpfull script to automize the ipkbuild process and all
related stuff using kdevelop. Grab the download file (see
download section),
unpack it and copy the resulted content of subdir ipkg_kdev into your project directory (cd ipkg_dev;cp -r * /where/your/project/is).
The result are the scripts located into the ipkg dir and the two scripts _xtrarc and _postinst
in your project dir. Edit that both files to your needs (Like descibde above).
To build the ipkg just cd to your project dir and enter the following line (assuming that the kdevelop arm build process is finished).
qtopiesharp;ipkg/ipk_opie.pl package opie testopie $PWD
This will create everything you need assuming, that package is the destination dir and opie the kdevelop build dir. The result can be found in $PWD/package.
The perl script of me also copies the result to my local ipk-dir, which at the moment is /home/sc/project/scipkgs. The path to there is actually defined in the script ipk_opie.pl ( variable is $ipk_destipk ). It also manipulates the Package file there to be able to install the ipk via ipkg install testopie on the handheld.
This section prints the perl scripts main calls to show how it works.
getArgs(); # get the program arguments and check whether OK
startPrepScript(); # starts prepipk.rc with appropriate parameters
startCpScript(); # starts cpipk.rc with appropriate parameters
grabPrjFile(); # grabs all necessary information from the project file
setShortInfo(); # set the short info (desktop info)
createControlFile(); # creates the ipk CONTROL file
createPackageFile(); # creates the package file
prepQpeApp(); # creates the QTopia desktop file
startBuildScript(); # starts the ipk build strip buildipk.rc
# startGpgScript(); # Start the GPG key generation (for familiar upload)
copyToDest(); # copies the result into the local ipkgs dir
# and manipulates the Packages file.
This chapter describes the known bugs in relation to the crosscompiling feature. The version is kdevelop 2.1.5 (KDE 3.1)
/usr/lib/libjpeg.so link to your arm-libjpeg when using libjpeg in your programs.