Next Previous Contents

6. Using Kdevelop (before kdevelop 2.1)

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.

6.1 General

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.

6.2 Requirements

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).

6.3 System preparation

Follow the steps described below, to get an QPE application including QTDesigner ui-files able to be translated for x11, QVFB and iPAQ.

  1. Create a new project using kdevelop. Choose the kde-mini template not to make a too large application. Name it ipaqt. The project creates three files in its source directory. This files are named main.cpp, ipaqt.h and ipaqt.cpp.
  2. Create a new Dialog-File using QTDesigner. For this you choose 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 MainDlg
    . Setup the layout, connect the button to the accept() slot and store the file.
  3. Change the ipaqt.h to use MainDlg instead of QWidget. From
    #include <qwidget.h>
     | 
    class Ipaqt : public QWidget
    ...
    
    change to
    #include <maindlg.h>
     | 
    class Ipaqt : public MainDlg
    ...
    
  4. Change the ipaqt.cpp to use MainDlg instead of QWidget. From
    Ipaqt::Ipaqt(QWidget *parent, const char *name) : QWidget(parent, name)
    ...
    
    change to
    Ipaqt::Ipaqt(QWidget *parent, const char *name) : MainDlg(parent, name)
    ...
    
  5. Change main.cpp. Delete all k-includes, the KCmdLineOtions method and the first 6 lines of the main-method. Add the includes for qapplication or qpeapplication. Change the Kapplication into QApplication for non 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();
    }
    
  6. Enter the menu project->options and disable the extra libraries kdeui and kdecore. Edit the Makefile.am and add a line at the end containing KDE_OPTIONS=qtonly
  7. Install the admin-patch. Either patch your admin dir or just remove it and extract the admin.tar.gz archive in your project directory.
  8. Choose (one after the other) build->distclean, build->automake, build->configure to create new makefiles.
  9. Compile and start your program for X11 use pressing F9.
  10. Start a terminal and enter your project directory. Create the directories x11, emb, arm and create a rc.file in each directory containing the following lines. Change the accessability using chmod 555 mk*rc.
  11. Enter the directory x11 and enter qtx11;./mkcfg.rc;make clean all to recreate your x11-Version. You find the result in <project>/x11/ipaqt.
  12. Copy the Makefile.am of your source directory to Makefile.am.x11 for x11 compilations. Change the Makefile.am of your source directory again. Search the line starting with ipaqt_LDADD. Copy that line and comment the original by inserting a "#" at the beginning of the line. Append "-lqpe" to the line.
    Search the line starting with 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.
  13. In your project directory enter "make distclean; make -f Makefile.dist"
  14. Enter the directory emb and enter "qtemb;./mkcfg.rc;make clean all" to create your first Embedded-Version. You find the result in <project>/arm/ipaqt.
  15. Enter the directory arm and enter "qtarm;./mkcfg.rc;make clean all" to create your first iPAQ-Version. You find the result in <project>/arm/ipaqt.
Hopefully everything worked fine.

6.4 Working with the project.

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.


Next Previous Contents