Dawnfoster (Talk | contribs) m (→Introducción) |
Munozferna (Talk | contribs) (→Depurar la aplicación en el equipo) |
||
| Line 256: | Line 256: | ||
=== Depurar la aplicación en el equipo === | === Depurar la aplicación en el equipo === | ||
| - | + | Esto funciona casi de la misma manera en un equipo remoto, que como funciona dentro del simulador. | |
| - | # Configure | + | # Configure el equipo |
| - | # | + | # En Qt Creator, haga clic en configuración de ''Target'' (icono en la parte inferior izquierda con un monitor). Asegurese de que en la opción ''Build'' esta configurada como ''Debug'' y en ''Run'' configure '''testapp on MeeGo device''' (el equipo remoto). |
| - | # | + | # Haga clic en el icono de una flecha verde con un insecto, para iniciar la aplicación en modo depuración. |
| - | + | Si usted uso el mismo codigo que se mostro arriba, intente hacer clic en el boton ''Click me'' dentro de la aplicación (que esta en el equipo). La aplicación deberia pausar en el punto de interrupción; y en Qt Creator, la variable ''message'' deberia estar visible en la pestaña ''Locals and Watchers'', y con el valor "I have been well and truly clicked". | |
== Ver esta pagina en otros idiomas == | == Ver esta pagina en otros idiomas == | ||
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, o 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.
Con todo instalado, usted deberia poder ahora ejecutar el simulador desde el entorno de MeeGo.
Deje el guión startmeego ejecutandose, e inicie Qt Creator asi:
qtcreator &
Esto ejecuta Qt Creator en la maquina host (no dentro de Xephyr):
Para configurar el proyecto:
Luego escribimos algo de codigo:
Y configuramos el proyecto:
En este momento, ya tenemos todo listo para ejecutar la aplicación.
Desde el Qt Creator, haga clic sobre la el boton de ejecutar (flecha verde en la parte inferior izquierda) para ejecutar la aplicación. Esto la construirá utilizando la version de Qt que configuró, y luego la ejecutara en el display :2 (dentro del escritorio MeeGo simulado en Xephyr).
En el simulador, puede ser necesario hacer clic en el icono MyZone (icono de casa) para mostrar la aplicación que esta corriendo:
Esto quiere decir, ejecutar la aplicación desde Qt Creator, pero con las opciones de depuración activadas, para poder observer el estado de la aplicación mientras corre bajo 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].
Si usted tiene disponible un equipo con MeeGo, tambien es posible ejecutar y depurar sus aplicaciones en el usando Qt Creator.
El equipo requiere cierta configuración y paquetes extras antes de que pueda desplegar la aplicacion desde Qt Creator. Instalelos desde la linea de comandos como se explica:
sudo zypper install openssh-server
Para iniciar el servicio manualmente (solo tiene que hacer esto justo despues de instalarlo, de lo contrario, solo estará disponible hasta que reinicie el equipo):
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
Dentro de Qt Creator (aún corriendo dentro del 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:
Esto funciona casi de la misma manera en un equipo remoto, que como funciona dentro del simulador.
Si usted uso el mismo codigo que se mostro arriba, intente hacer clic en el boton Click me dentro de la aplicación (que esta en el equipo). La aplicación deberia pausar en el punto de interrupción; y en Qt Creator, la variable message deberia estar visible en la pestaña Locals and Watchers, y con el valor "I have been well and truly clicked".