This chapter describes how to use kdevelop for application development with QPE. This is possible,
since I asked Ralf Nolden, one of the maintainers of kdevelop, to integrate a crosscompiler utility
into kdevelop. The first result was available only a few days after request. Thanks for that ralf.
The patch is done on a kdevelop 1.4 version. In future versions (not in 2.0), the patch should not be necessary any more.
The description is done using a new created application as an example. To compile an existing project just follow the instructions in System preparation on an existing project.
In general, there is an admin patch available for qpe-library usage instead of qt-library. The patch was posted from Ralf in the qpe-interest mailing list. As the patch did not fully work on my system, he did send me a comlete admin-tarball. This worked.
The patch as well as the admin-tarball is available here as tar-archives.
The items described in this chapter need the following things.
Follow the chapters above to prepare your system for kdevelop crosscompilation. Especially the preparation of the Desktop is important ( chapter Desktop).
Follow the steps described below, to get an QPE application including QTDesigner ui-files able to be translated for x11, QVFB and iPAQ.
ipaqt. The project creates three files in its source directory.
This files are named main.cpp, ipaqt.h and ipaqt.cpp.file->new and choose
a QTDesigner file (*.ui). Name the file maindlg.ui. The ok-button will start the designer. Choose
a Dialog-template and add a Textview containing a "HelloWorld"-text and a Pushbutton Quit,
to be able to quit the application. Name the Form MainDlgaccept() slot and store the file.
#include <qwidget.h>
|
class Ipaqt : public QWidget
...
change to
#include <maindlg.h>
|
class Ipaqt : public MainDlg
...
Ipaqt::Ipaqt(QWidget *parent, const char *name) : QWidget(parent, name)
...
change to
Ipaqt::Ipaqt(QWidget *parent, const char *name) : MainDlg(parent, name)
...
QWS
and into QPEApplication for QWS system.
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include "ipaqt.h"
static const char *description =
I18N_NOOP("Ipaqt");
// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
static KCmdLineOptions options[] =
{
{ 0, 0, 0 }
// INSERT YOUR COMMANDLINE OPTIONS HERE
};
int main(int argc, char *argv[])
{
KAboutData aboutData( "ipaqt", I18N_NOOP("Ipaqt"),
VERSION, description, KAboutData::License_GPL,
"(c) 2001, Werner Schulte", 0, 0, "sc@schulte-ac.de");
aboutData.addAuthor("Werner Schulte",0, "sc@schulte-ac.de");
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication a;
Ipaqt *ipaqt = new Ipaqt();
a.setMainWidget(ipaqt);
ipaqt->show();
return a.exec();
}
change to
#ifdef QWS
#include <qpeapplication.h>
#else
#include <qapplication.h>
#endif
#include "ipaqt.h"
int main(int argc, char *argv[])
{
#ifdef QWS
QPEApplication a( argc, argv );
#else
QApplication a( argc, argv );
#endif
Ipaqt *ipaqt = new Ipaqt();
a.setMainWidget(ipaqt);
ipaqt->show();
return a.exec();
}
project->options and disable the extra libraries
kdeui and kdecore. Edit the Makefile.am and add a line at the end containing
KDE_OPTIONS=qtonlybuild->distclean, build->automake, build->configure
to create new makefiles.F9.x11, emb, arm and
create a rc.file in each directory containing the following lines.
#!/bin/sh
../configure --with-qt-dir=$QTDIR
#!/bin/sh
../configure --with-qt-dir=$QTDIR --prefix=$QPEDIR \
--with-extra-includes=$QPEDIR/library --enable-embedded
#!/bin/sh
../configure --with-qt-dir=$QTDIR --prefix=$QPEDIR \
--with-extra-includes=$QPEDIR/library \
--enable-embedded --target=arm-linux
chmod 555 mk*rc.qtx11;./mkcfg.rc;make clean all to recreate
your x11-Version. You find the result in <project>/x11/ipaqt.ipaqt_LDADD. Copy that line and comment the
original by inserting a "#" at the beginning of the line.
Append "-lqpe" to the line.INCLUDES. Copy that line and comment the
original by inserting a "#" at the beginning of the line.
Append "-I$(QPEDIR)/library" to the line.
Copy that modified Makefile.am to Makefile.am.emb for emb/arm compilations."make distclean; make -f Makefile.dist""qtemb;./mkcfg.rc;make clean all" to create
your first Embedded-Version. You find the result in <project>/arm/ipaqt."qtarm;./mkcfg.rc;make clean all" to create
your first iPAQ-Version. You find the result in <project>/arm/ipaqt.
To work with the project, you can use kdevelop for editing the files. To compile the emb- and arm-versions
you have to save all files, enter the emb/arm directory change into the qtemb- or qtarm-mode and just
call "make all". The system will compile the changed sources for the required platform.
Unfortunatly, the QPE requires the extra QPE library (and includes). For this you created the
two Makefile.ams in your source directory. In case of switching back to x11, you have to copy the
Makefile.am.x11 back to Makefile.am, before compilation. Do the same with the
Makefile.am.emb when switching back to emb/arm.
If you want to use the integrated kdevelop compiler, you have to follow step 8. In this case you have to do the step 13 again, when changing back to emb/arm.
If there are new files to be added, do that first using the integrated kdevelop tools. After
rearranging everything, you may have to edit the Makefile.am again. In this case follow
step 12.