Develop for the Nokia N900 and Maemo 5 OS!
Learn how to program the next-generation smartphone-come-internet tablet, the Nokia N900…
Set up the main window with the menus and other contents:
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setupFileMenu();
setupHelpMenu();
setupEditor();
setCentralWidget(editor);
setWindowTitle(tr(“CodeEditor”));
}
Set the application’s about menu:
void MainWindow::about()
{
QMessageBox::about(this, tr(“About CodeEditor”),
tr(“<p>CodeEditor is a C/C++ Source code file editor.</p>”));
}
Set up the action for New File creation:
void MainWindow::newFile()
{
editor->clear();
}Set up the action for File Open:
void MainWindow::openFile(const QString &path)
{
QString fileName = path;Search for C/C++/header files with wildcards *.c, *.cpp and *.h:
if (fileName.isNull())
fileName = QFileDialog::getOpenFileName(this,
tr(“Open File”), “”, “C/C++ Files (*.cpp *.c *.h)”);if (!fileName.isEmpty()) {
QFile file(fileName);
if (file.open(QFile::ReadOnly | QFile::Text))
editor->setPlainText(file.readAll());
}
}
Set up the editor interface:
void MainWindow::setupEditor()
{
QFont font;
Set up the editor font:
font.setFamily(“Courier”);
font.setFixedPitch(true);
font.setPointSize(10);
editor = new QTextEdit;
editor->setFont(font);
Create an instance of codeColor:
highlighter = new codeColor(editor->document());















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
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?
Same problem here, can’t get past page 1. Using IE 7 on Vista.
will not go past Page 1.
it would be awesome if someone could fix this.Thanks.
Florian, using maemo 5 browser
Fixed – thanks for picking up on it.