Official website for Linux User & Developer
FOLLOW US ON:
Mar
16

Develop for the Nokia N900 and Maemo 5 OS!

by Kunal Deo

Learn how to program the next-generation smartphone-come-internet tablet, the Nokia N900…

Initial file to open inside the editor:

QFile file(“moc_codeColor.cpp”);
if (file.open(QFile::ReadOnly | QFile::Text))
editor->setPlainText(file.readAll());
}
void MainWindow::setupFileMenu()
{
QMenu *fileMenu = new QMenu(tr(“&File”), this);
menuBar()->addMenu(fileMenu);

Connect signals and slots:

fileMenu->addAction(tr(“&New”), this, SLOT(newFile()),
QKeySequence(tr(“Ctrl+N”,
“File|New”)));
fileMenu->addAction(tr(“&Open…”), this, SLOT(openFile()),
QKeySequence(tr(“Ctrl+O”,
“File|Open”)));
fileMenu->addAction(tr(“E&xit”), qApp, SLOT(quit()),
QKeySequence(tr(“Ctrl+Q”,
“File|Exit”)));
}
void MainWindow::setupHelpMenu()
{
QMenu *helpMenu = new QMenu(tr(“&Help”), this);
menuBar()->addMenu(helpMenu);
helpMenu->addAction(tr(“&About”), this, SLOT(about()));
helpMenu->addAction(tr(“About &Qt”), qApp, SLOT(aboutQt()));
}

8. Creating the project file
You can either use qmake to create the project file or write it by hand. It is recommended that you use qmake first and then customise it according to your needs. For our simple project , a qmake-generated project file is enough.

Open the Scratchbox environment and perform the following command to create the project file.

[sbox-FREMANTLE_X86: ~/codeEditor] > qmake -project
This command will generate a project file with the directory name. In this case it is codeEditor.pro
codeEditor.pro
##################
# Automatically generated by qmake (2.01a) Thu Jan 12 12:30:01 2010
##################

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

# Input
HEADERS += codeColor.h mainwindow.h
SOURCES += codeColor.cpp main.cpp mainwindow.cpp

9. Generating the makefile and compiling the application
Makefiles specify how to derive the target program from each of its dependencies. Now that we have the project file with us, we can use qmake to generate the Maemo-specific makefile.
Open the Scratchbox environment and perform the following command to create the makefile:

[sbox-FREMANTLE_X86: ~/codeEditor] > qmake

Pages: 1 2 3 4 5 6 7
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.
    • Ray McConaghy

      When I finally run the program (codeColor) I get the following error ( this is, however the latest SDK for Maemo5). Can you help?

      [sbox-FREMANTLE_X86: ~/codeColor] > run-standalone.sh ./codeColor
      codeColor[3820]: GLIB CRITICAL ** Gtk – gtk_widget_set_sensitive: assertion `GTK_IS_WIDGET (widget)’ failed

      Also, I got confused with the article… it asked me to create a directory called …/codeColor… but the prompt in your article showed you running in scratchbox in a directory …/codeEditor ( where did that come from?). I am a newbie so perhaps these are stupid questions!!

      Best regards

    • Ricardo

      I’m not able to access this full article, clicking the diferent page numbers or even directly loading the URL in my browsers always redirects to first page.

      Tested with Firefox 3.6.8 and Opera 10.61.

      Bug? Anyone else having the same problem?

    • Sean

      Same problem here, can’t get past page 1. Using IE 7 on Vista.

    • florian

      will not go past Page 1.
      it would be awesome if someone could fix this.Thanks.

      Florian, using maemo 5 browser

    • Russell Barnes

      Fixed – thanks for picking up on it.

    • http://nill ZIA

      living in CIS Russia . My question how to reinstall Maemo sofware 5 or latest without USB internet or bluetooth support (which not working in my N900 )? Is there any way how to reinstall this from flash memory card 2GB any support or download stand alone Exe File any software ? Thanks if you can reply my email waiting