Munozferna (Talk | contribs) (Created page with 'Category:devguide Category:meego-1.0 Category:tutorial Category:netbook Category:c++ Category:application-developer Category:linux == Introducción =…') |
Munozferna (Talk | contribs) |
||
| Line 30: | Line 30: | ||
* Depure la aplicación en el equipo | * Depure la aplicación en el equipo | ||
| - | == Como hacerlo (versión | + | == Como hacerlo (versión larga) == |
=== Instalar el SDK MeeGo en su equipo con Linux === | === Instalar el SDK MeeGo en su equipo con Linux === | ||
| Line 36: | Line 36: | ||
Vea [[Getting started with the MeeGo SDK for Linux]] para más instrucciones. | Vea [[Getting started with the MeeGo SDK for Linux]] para más instrucciones. | ||
| - | === | + | === Entre al entorno chroot MeeGo === |
| - | + | Vea [[Getting_started_with_the_MeeGo_SDK_for_Linux#Enter the MeeGo chroot environment|estas instrucciones]]. | |
| - | === | + | === Ejecute el Simulator === |
With everything installed, you should now be able to [[Getting_started_with_the_MeeGo_SDK_for_Linux#Run_the_Simulator|run the Simulator]] from the MeeGo environment. | With everything installed, you should now be able to [[Getting_started_with_the_MeeGo_SDK_for_Linux#Run_the_Simulator|run the Simulator]] from the MeeGo environment. | ||
| - | === | + | === Construya el proyecto con Qt Creator === |
Leave the startmeego script running, and start Qt Creator with: | Leave the startmeego script running, and start Qt Creator with: | ||
| Line 54: | Line 54: | ||
[[File:Simulator_QtCreator_splash.png]] | [[File:Simulator_QtCreator_splash.png]] | ||
| - | + | Para configurar el proyecto: | |
* Create a new project (''File > New File or Project''). Under ''Projects'', select ''Qt Gui Application'' and click ''OK''. | * Create a new project (''File > New File or Project''). Under ''Projects'', select ''Qt Gui Application'' and click ''OK''. | ||
| Line 83: | Line 83: | ||
** Double-click in the text entry next to the ''Display'' variable; change ''':0.0''' to ''':2'''. This tells Qt Creator to run the application on display number :2, the one which Xephyr is in control of. | ** Double-click in the text entry next to the ''Display'' variable; change ''':0.0''' to ''':2'''. This tells Qt Creator to run the application on display number :2, the one which Xephyr is in control of. | ||
| - | === | + | === Ejecute la aplicación dentro del Simulator === |
Now you're all set to run the application. | Now you're all set to run the application. | ||
| Line 196: | Line 196: | ||
For more information about using Qt Creator in debug mode, see [http://doc.qt.nokia.com/qtcreator-snapshot/creator-debugging.html]. | For more information about using Qt Creator in debug mode, see [http://doc.qt.nokia.com/qtcreator-snapshot/creator-debugging.html]. | ||
| - | == | + | == Instrucciones opcionales para usar un equipo real MeeGo == |
If you have a real MeeGo device available, it's also possible to run and debug your application on it using Qt Creator. | If you have a real MeeGo device available, it's also possible to run and debug your application on it using Qt Creator. | ||
| - | === Prepare | + | === Prepare el equipo === |
The device requires some configuration and extra packages before you can deploy from Qt Creator to it. Install them from the command line as follows: | The device requires some configuration and extra packages before you can deploy from Qt Creator to it. Install them from the command line as follows: | ||
Contents |
Este tutorial es una introducción para desarrollo de dispositivos MeeGo x86 en Linux. Se explica el flujo de trabajo basico para el desarrollo de aplicaciones, enfocandose en como trabajar conjuntamente las herramientas incluidas en el SDK.
No se entra en detalles sobre Qt, las APIs de MeeGo, or como hacer que una aplicación se integre en el entorno de MeeGo..
Si usted tiene un equipo con MeeGo:
Vea Getting started with the MeeGo SDK for Linux para más instrucciones.
Vea estas instrucciones.
With everything installed, you should now be able to run the Simulator from the MeeGo environment.
Leave the startmeego script running, and start Qt Creator with:
qtcreator &
This runs Qt Creator on the host (not inside Xephyr):
Para configurar el proyecto:
Next write some code:
Then configure the project:
Now you're all set to run the application.
From inside Qt Creator, click on the big green arrow (bottom-left corner) to run the application. This will build it first (using the Qt Version you set up) then run it on display :2 (inside the Xephyr simulated MeeGo desktop).
In the Simulator, you might need to click on the MyZone icon (the house icon) to reveal the application running behind it:
This means running the application from Qt Creator, but with debugging turned on, so you can watch the state of the application while it's running under Xephyr.
In the previous sections, we built the debugging helper for the version of Qt we're using. This needs to be done first, otherwise you can't debug the application.
To put Qt Creator into debug mode, click on the bug icon in the left-hand toolbar. This adds some extra panels to the window which are used to show the stack, watch expressions etc..
Next, you need something to debug. I added a Push Button to the form:
Then added a click handler for it, so that when the button is clicked, a message string is assigned into a variable then output to the console. The code looks like this:
/* file: Headers/mainwindow.h */
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
private slots:
void on_pushButton_clicked();
};
#endif // MAINWINDOW_H
/* file: Sources/mainwindow.cpp */
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QString>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void MainWindow::on_pushButton_clicked()
{
QString message;
message = "I have been well and truly clicked";
qDebug() << message;
}
Most of this is boilerplate generated when I started the project, but the MainWindow::on_pushButton_clicked method is mine. Notice how it also needs to be defined as a private slot in the header file.
Add a breakpoint next to the line where you want the debugger to break by clicking in the editor margin. It looks like this:
(See the red circle on line 34 after message is initialized.)
To run the application in debug mode, click on the green arrow with a bug overlaid on it (bottom left). This starts the application inside Xephyr:
Now, click on the button. The program should pause at the breakpoint. Switch back to Qt Creator and look at the debug panels:
Notice how the Locals and Watchers tab reports the message variable set to "I have been well and truly clicked".
For more information about using Qt Creator in debug mode, see [1].
If you have a real MeeGo device available, it's also possible to run and debug your application on it using Qt Creator.
The device requires some configuration and extra packages before you can deploy from Qt Creator to it. Install them from the command line as follows:
sudo zypper install openssh-server
To start it manually (you'll need to do this just after you've installed it, otherwise it won't be available until you reboot):
sudo /etc/init.d/sshd start
To add it to the init sequence so it starts at boot time:
sudo chkconfig --add sshd
sudo zypper install gdb-gdbserver
In Qt Creator (still running from the chroot):
Once you've completed this, you should be able to deploy and run the application on the netbook:

Here's an example of what the application looks like running on a netbook:
This works almost the same on a remote device as it does inside the Simulator.
If you used the same code as above, try clicking on the Click me button in the application (running on the netbook). The application should pause at the breakpoint; and in Qt Creator, the message variable should then be visible in the Locals and Watchers tab, set to "I have been well and truly clicked". (No screenshot this time, as Qt Creator looks the same as it does for local debugging.)