Diagnostica: perché l'app si chiude subito
L'app sul telefono si apre e si chiude. Dal launcher non si vede niente: né un messaggio, né una schermata. Il motore non cede — ho riprodotto la sequenza esatta del guscio (sessione, CSS della demo, zoom 2,5, clic) sul renderer compilato per aarch64 e eseguito sotto qemu: disegna 1350×4278 senza errori. Quindi il difetto è dove non arrivo a vedere. Questa versione lo fa parlare. - `src/main.cpp`: log su file dal primo istante — versione di Qt, versione di Sailfish OS, contenuto di `/etc/os-release` e `/etc/sailfish-release` (la versione di sistema decide se il binario può caricarsi), stato del QML con gli errori di caricamento, e i segnali di crash (SIGSEGV, SIGABRT, SIGBUS, SIGILL, SIGFPE) scritti prima di uscire - `qInstallMessageHandler`: ogni `qDebug`/`qWarning`, compresi quelli del QML, finisce nello stesso file - `engineview.cpp`: percorso e dimensione della demo letta, ogni disegno con dimensioni e tempo, il font risolto e se esiste - `src/ffi.rs`: un panico Rust attraverso il confine C diventa un `abort` e l'app sparisce senza dire niente. Ora un gancio scrive `~/mosaic-panic.txt` con posizione e messaggio. Separato in `annota_panico()` per poterlo verificare senza far abortire il processo: c'è un test che controlla che il file venga scritto davvero Due file, quindi: `mosaic.log` (dove si arriva) e `mosaic-panic.txt` (se è il motore a cedere). Se non compare nemmeno il primo, l'app muore prima di `main()` — cioè il caricatore non riesce a linkare il binario, ed è un'informazione altrettanto utile. Aggiunto anche `tests/ffi_app_smoke.c`: la sequenza dell'app in C, per provarla sul telefono e sotto qemu.
This commit is contained in:
1 parent
da64b57ae0
commit
f379b316fe
5 files changed
+278
-2
No files matched your search
@@ -67,6 +67,7 @@ pub extern "C" fn engine_render_form(
|
|||||||
base_dir: *const c_char,
|
base_dir: *const c_char,
|
||||||
state_json: *const c_char,
|
state_json: *const c_char,
|
||||||
) -> *mut EngineImage {
|
) -> *mut EngineImage {
|
||||||
|
installa_gancio_panico();
|
||||||
let stato = cstr_or_empty(state_json);
|
let stato = cstr_or_empty(state_json);
|
||||||
let form = parse_form_state(&stato);
|
let form = parse_form_state(&stato);
|
||||||
render_inner(
|
render_inner(
|
||||||
@@ -379,6 +380,49 @@ pub struct EngineDoc {
|
|||||||
|
|
||||||
/// Crea un documento, eseguendo subito gli script (anche esterni).
|
/// Crea un documento, eseguendo subito gli script (anche esterni).
|
||||||
/// `base_url` può essere NULL per i documenti locali.
|
/// `base_url` può essere NULL per i documenti locali.
|
||||||
|
|
||||||
|
/// Aggiunge una riga a `~/mosaic-panic.txt`. Separata dal gancio perché così
|
||||||
|
/// si può verificare che scriva davvero, senza far andare in panico il processo.
|
||||||
|
fn annota_panico(riga: &str) {
|
||||||
|
if let Ok(home) = std::env::var("HOME") {
|
||||||
|
let percorso = std::path::Path::new(&home).join("mosaic-panic.txt");
|
||||||
|
if let Ok(mut f) = std::fs::OpenOptions::new()
|
||||||
|
.create(true)
|
||||||
|
.append(true)
|
||||||
|
.open(percorso)
|
||||||
|
{
|
||||||
|
use std::io::Write;
|
||||||
|
let _ = f.write_all(riga.as_bytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Un panico Rust attraverso il confine C diventa un `abort`: l'app sparisce
|
||||||
|
/// senza dire niente. Questo gancio lascia una traccia in `~/mosaic-panic.txt`
|
||||||
|
/// (e su stderr), così un difetto del motore non è indistinguibile da un crash
|
||||||
|
/// della piattaforma.
|
||||||
|
fn installa_gancio_panico() {
|
||||||
|
static UNA_VOLTA: std::sync::Once = std::sync::Once::new();
|
||||||
|
UNA_VOLTA.call_once(|| {
|
||||||
|
std::panic::set_hook(Box::new(|info| {
|
||||||
|
let dove = info
|
||||||
|
.location()
|
||||||
|
.map(|l| format!("{}:{}", l.file(), l.line()))
|
||||||
|
.unwrap_or_else(|| "posizione ignota".to_string());
|
||||||
|
let messaggio = if let Some(s) = info.payload().downcast_ref::<&str>() {
|
||||||
|
(*s).to_string()
|
||||||
|
} else if let Some(s) = info.payload().downcast_ref::<String>() {
|
||||||
|
s.clone()
|
||||||
|
} else {
|
||||||
|
"panico senza messaggio".to_string()
|
||||||
|
};
|
||||||
|
let riga = format!("PANICO Rust in {}: {}\n", dove, messaggio);
|
||||||
|
eprint!("{}", riga);
|
||||||
|
annota_panico(&riga);
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn engine_doc_new(
|
pub extern "C" fn engine_doc_new(
|
||||||
html: *const c_char,
|
html: *const c_char,
|
||||||
@@ -386,6 +430,7 @@ pub extern "C" fn engine_doc_new(
|
|||||||
base_dir: *const c_char,
|
base_dir: *const c_char,
|
||||||
base_url: *const c_char,
|
base_url: *const c_char,
|
||||||
) -> *mut EngineDoc {
|
) -> *mut EngineDoc {
|
||||||
|
installa_gancio_panico();
|
||||||
let html = cstr_or_empty(html);
|
let html = cstr_or_empty(html);
|
||||||
let css = cstr_or_empty(css);
|
let css = cstr_or_empty(css);
|
||||||
let cartella = {
|
let cartella = {
|
||||||
@@ -611,6 +656,7 @@ pub struct EngineSession {
|
|||||||
/// Crea una sessione (cookie e cache vuoti).
|
/// Crea una sessione (cookie e cache vuoti).
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn engine_session_new() -> *mut EngineSession {
|
pub extern "C" fn engine_session_new() -> *mut EngineSession {
|
||||||
|
installa_gancio_panico();
|
||||||
Box::into_raw(Box::new(EngineSession {
|
Box::into_raw(Box::new(EngineSession {
|
||||||
client: std::rc::Rc::new(crate::net::Client::new()),
|
client: std::rc::Rc::new(crate::net::Client::new()),
|
||||||
}))
|
}))
|
||||||
@@ -726,6 +772,7 @@ pub extern "C" fn engine_doc_new_session(
|
|||||||
base_dir: *const c_char,
|
base_dir: *const c_char,
|
||||||
base_url: *const c_char,
|
base_url: *const c_char,
|
||||||
) -> *mut EngineDoc {
|
) -> *mut EngineDoc {
|
||||||
|
installa_gancio_panico();
|
||||||
let doc = engine_doc_new(html, css, base_dir, base_url);
|
let doc = engine_doc_new(html, css, base_dir, base_url);
|
||||||
if doc.is_null() {
|
if doc.is_null() {
|
||||||
return doc;
|
return doc;
|
||||||
@@ -844,3 +891,28 @@ pub extern "C" fn engine_doc_invio_json(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_panico {
|
||||||
|
/// Il gancio serve solo se scrive: un test che lo installa e verifica il
|
||||||
|
/// file è l'unico modo di saperlo senza far abortire il processo.
|
||||||
|
#[test]
|
||||||
|
fn una_riga_di_panico_finisce_nel_file() {
|
||||||
|
let marcatore = format!("PROVA-PANICO-{}", std::process::id());
|
||||||
|
super::annota_panico(&format!("{marcatore}\n"));
|
||||||
|
let percorso =
|
||||||
|
std::path::Path::new(&std::env::var("HOME").expect("HOME")).join("mosaic-panic.txt");
|
||||||
|
let contenuto = std::fs::read_to_string(&percorso).expect("file dei panico");
|
||||||
|
assert!(
|
||||||
|
contenuto.contains(&marcatore),
|
||||||
|
"la riga non è stata scritta"
|
||||||
|
);
|
||||||
|
// pulizia: non si lascia sporcizia nella home
|
||||||
|
let pulito: String = contenuto
|
||||||
|
.lines()
|
||||||
|
.filter(|l| !l.contains(&marcatore))
|
||||||
|
.map(|l| format!("{l}\n"))
|
||||||
|
.collect();
|
||||||
|
let _ = std::fs::write(&percorso, pulito);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/* Riproduce la sequenza dell'app Sailfish: sessione, documento con il CSS
|
||||||
|
* extra del guscio, disegno alla densità del telefono. Se qualcosa va in
|
||||||
|
* panico nel motore, qui si vede (panic attraverso il confine C = abort). */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "engine.h"
|
||||||
|
|
||||||
|
static char *leggi(const char *p) {
|
||||||
|
FILE *f = fopen(p, "rb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "non apro %s\n", p);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
fseek(f, 0, SEEK_END);
|
||||||
|
long n = ftell(f);
|
||||||
|
fseek(f, 0, SEEK_SET);
|
||||||
|
char *b = malloc((size_t)n + 1);
|
||||||
|
if (fread(b, 1, (size_t)n, f) != (size_t)n) {
|
||||||
|
fclose(f);
|
||||||
|
free(b);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
b[n] = 0;
|
||||||
|
fclose(f);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
const char *base = argc > 1 ? argv[1] : ".";
|
||||||
|
char html_path[1024], css_path[1024], font[1024];
|
||||||
|
snprintf(html_path, sizeof html_path, "%s/demo.html", base);
|
||||||
|
snprintf(css_path, sizeof css_path, "%s/demo.css", base);
|
||||||
|
snprintf(font, sizeof font, "%s/fonts/DejaVuSerif.ttf", base);
|
||||||
|
|
||||||
|
char *html = leggi(html_path);
|
||||||
|
char *css = leggi(css_path);
|
||||||
|
if (!html || !css) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* la stessa sequenza di EngineView */
|
||||||
|
EngineSession *s = engine_session_new();
|
||||||
|
EngineDoc *doc = engine_doc_new_session(s, html, css, base, NULL);
|
||||||
|
if (!doc) {
|
||||||
|
fprintf(stderr, "documento non creato\n");
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
printf("documento creato\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
const float scale = 2.5f;
|
||||||
|
EngineImage *img = engine_doc_render(doc, (uint32_t)(540 * scale), (uint32_t)(900 * scale), scale, 1, font, NULL);
|
||||||
|
if (!img) {
|
||||||
|
fprintf(stderr, "disegno fallito\n");
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
printf("disegnato %ux%u error=%s\n", img->width, img->height, img->error ? img->error : "nessuno");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
/* un clic su un campo, come al tocco */
|
||||||
|
engine_doc_click(doc, 40.0f, 200.0f);
|
||||||
|
printf("clic fatto\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
engine_image_free(img);
|
||||||
|
engine_doc_free(doc);
|
||||||
|
engine_session_free(s);
|
||||||
|
free(html);
|
||||||
|
free(css);
|
||||||
|
printf("fine\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
Name: harbour-mosaic
|
Name: harbour-mosaic
|
||||||
Summary: Mosaic browser with an independent rendering engine
|
Summary: Mosaic browser with an independent rendering engine
|
||||||
Version: 0.8.20
|
Version: 0.8.21
|
||||||
Release: 1
|
Release: 1
|
||||||
Group: Qt/Qt
|
Group: Qt/Qt
|
||||||
License: MIT
|
License: MIT
|
||||||
@@ -21,6 +21,13 @@ engine written from scratch (no WebKit, Blink, Gecko or Servo code).
|
|||||||
Milestone M0: HTML parsing, CSS cascade, block layout and CPU raster.
|
Milestone M0: HTML parsing, CSS cascade, block layout and CPU raster.
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 12 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.8.21-1
|
||||||
|
- VERSIONE DIAGNOSTICA: l'app si chiude subito all'avvio e dal launcher non si
|
||||||
|
vede nulla. Ora scrive un log in ~/.local/share/harbour/harbour-mosaic/mosaic.log
|
||||||
|
con: versione di Qt e di Sailfish OS, contenuto di /etc/os-release, stato del
|
||||||
|
QML con gli errori di caricamento, percorso e dimensione della demo, ogni
|
||||||
|
disegno con dimensioni e tempo, e i segnali di crash (SIGSEGV, SIGABRT, ...)
|
||||||
|
|
||||||
* Thu Nov 12 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.8.20-1
|
* Thu Nov 12 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.8.20-1
|
||||||
- Selettori d'attributo: [attr], =, ~=, |=, ^=, $=, *=, con flag i. Mancavano
|
- Selettori d'attributo: [attr], =, ~=, |=, ^=, $=, *=, con flag i. Mancavano
|
||||||
del tutto: una regola come [class*=columns-] veniva scartata, e con lei la
|
del tutto: una regola come [class*=columns-] veniva scartata, e con lei la
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ EngineView::EngineView(QQuickItem *parent)
|
|||||||
m_vivo = std::make_shared<std::atomic<bool>>(true);
|
m_vivo = std::make_shared<std::atomic<bool>>(true);
|
||||||
setAntialiasing(false);
|
setAntialiasing(false);
|
||||||
m_fontPath = resolveFont();
|
m_fontPath = resolveFont();
|
||||||
|
qInfo() << "mosaic: EngineView costruito, font" << m_fontPath
|
||||||
|
<< "esiste" << QFileInfo::exists(m_fontPath);
|
||||||
m_sessione = std::shared_ptr<EngineSession>(engine_session_new(),
|
m_sessione = std::shared_ptr<EngineSession>(engine_session_new(),
|
||||||
[](EngineSession *s) { engine_session_free(s); });
|
[](EngineSession *s) { engine_session_free(s); });
|
||||||
// i timer della pagina: il motore non legge l'ora, gliela diamo noi
|
// i timer della pagina: il motore non legge l'ora, gliela diamo noi
|
||||||
@@ -135,6 +137,7 @@ bool EngineView::caricaDemo()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_html = QString::fromUtf8(file.readAll());
|
m_html = QString::fromUtf8(file.readAll());
|
||||||
|
qInfo() << "mosaic: demo letta da" << percorso << "byte" << m_html.size();
|
||||||
m_url.clear();
|
m_url.clear();
|
||||||
creaDocumento();
|
creaDocumento();
|
||||||
rerender();
|
rerender();
|
||||||
@@ -373,6 +376,9 @@ void EngineView::rerender()
|
|||||||
m_baseDir.toUtf8().constData(),
|
m_baseDir.toUtf8().constData(),
|
||||||
stateJson().toUtf8().constData());
|
stateJson().toUtf8().constData());
|
||||||
m_renderMs = int(timer.elapsed());
|
m_renderMs = int(timer.elapsed());
|
||||||
|
qInfo() << "mosaic: disegno" << (img ? int(img->width) : -1) << "x"
|
||||||
|
<< (img ? int(img->height) : -1) << "in" << m_renderMs << "ms, zoom" << m_zoom
|
||||||
|
<< "doc" << (m_doc != nullptr);
|
||||||
emit renderMsChanged();
|
emit renderMsChanged();
|
||||||
|
|
||||||
if (!img) {
|
if (!img) {
|
||||||
|
|||||||
+118
-1
@@ -1,17 +1,118 @@
|
|||||||
#include <sailfishapp.h>
|
#include <sailfishapp.h>
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
#include <QtQuick>
|
#include <QtQuick>
|
||||||
|
#include <QtCore>
|
||||||
|
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <csignal>
|
||||||
|
|
||||||
#include "appsettings.h"
|
#include "appsettings.h"
|
||||||
#include "engineview.h"
|
#include "engineview.h"
|
||||||
|
|
||||||
|
// Diagnostica: l'app si chiude subito sul telefono e dal launcher non si vede
|
||||||
|
// niente. Qui ogni passo finisce in un file, compresi i messaggi di QML e i
|
||||||
|
// segnali di crash: senza questo si tira a indovinare.
|
||||||
|
static FILE *g_log = nullptr;
|
||||||
|
|
||||||
|
static void logRiga(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
if (!g_log) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vfprintf(g_log, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
fputc('\n', g_log);
|
||||||
|
fflush(g_log);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void logQt(QtMsgType tipo, const QMessageLogContext &, const QString &msg)
|
||||||
|
{
|
||||||
|
const char *livello = "info";
|
||||||
|
switch (tipo) {
|
||||||
|
case QtDebugMsg: livello = "debug"; break;
|
||||||
|
case QtInfoMsg: livello = "info"; break;
|
||||||
|
case QtWarningMsg: livello = "attenzione"; break;
|
||||||
|
case QtCriticalMsg: livello = "critico"; break;
|
||||||
|
case QtFatalMsg: livello = "fatale"; break;
|
||||||
|
}
|
||||||
|
if (g_log) {
|
||||||
|
fprintf(g_log, "[%s] %s\n", livello, msg.toUtf8().constData());
|
||||||
|
fflush(g_log);
|
||||||
|
}
|
||||||
|
if (tipo == QtFatalMsg) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void logSegnale(int sig)
|
||||||
|
{
|
||||||
|
// qui non si può usare Qt: solo scrittura diretta e uscita immediata
|
||||||
|
const char *nome = "sconosciuto";
|
||||||
|
switch (sig) {
|
||||||
|
case SIGSEGV: nome = "SIGSEGV (accesso non valido)"; break;
|
||||||
|
case SIGABRT: nome = "SIGABRT (abort, per esempio panico Rust)"; break;
|
||||||
|
case SIGBUS: nome = "SIGBUS"; break;
|
||||||
|
case SIGILL: nome = "SIGILL"; break;
|
||||||
|
case SIGFPE: nome = "SIGFPE"; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
if (g_log) {
|
||||||
|
fprintf(g_log, "CRASH: %s\n", nome);
|
||||||
|
fflush(g_log);
|
||||||
|
}
|
||||||
|
signal(sig, SIG_DFL);
|
||||||
|
raise(sig);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void apriLog()
|
||||||
|
{
|
||||||
|
const QString cartella = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||||
|
QDir().mkpath(cartella);
|
||||||
|
QString percorso = cartella + QStringLiteral("/mosaic.log");
|
||||||
|
g_log = fopen(percorso.toUtf8().constData(), "a");
|
||||||
|
if (!g_log) {
|
||||||
|
percorso = QDir::homePath() + QStringLiteral("/mosaic.log");
|
||||||
|
g_log = fopen(percorso.toUtf8().constData(), "a");
|
||||||
|
}
|
||||||
|
if (!g_log) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logRiga("=== avvio ===");
|
||||||
|
logRiga("log: %s", percorso.toUtf8().constData());
|
||||||
|
logRiga("Qt %s", qVersion());
|
||||||
|
logRiga("Sailfish OS %s (kernel %s)", qPrintable(QSysInfo::productVersion()),
|
||||||
|
qPrintable(QSysInfo::kernelVersion()));
|
||||||
|
// la versione di sistema decide se il binario può caricarsi affatto
|
||||||
|
for (const char *f : {"/etc/os-release", "/etc/sailfish-release"}) {
|
||||||
|
QFile v(QString::fromLatin1(f));
|
||||||
|
if (v.open(QIODevice::ReadOnly)) {
|
||||||
|
for (const QByteArray &riga : v.readAll().split('\n')) {
|
||||||
|
if (!riga.trimmed().isEmpty()) {
|
||||||
|
logRiga(" %s: %s", f, riga.trimmed().constData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
|
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
|
||||||
|
apriLog();
|
||||||
|
qInstallMessageHandler(logQt);
|
||||||
|
for (int s : {SIGSEGV, SIGABRT, SIGBUS, SIGILL, SIGFPE}) {
|
||||||
|
signal(s, logSegnale);
|
||||||
|
}
|
||||||
|
logRiga("applicazione creata");
|
||||||
|
|
||||||
app->setOrganizationName(QStringLiteral("harbour"));
|
app->setOrganizationName(QStringLiteral("harbour"));
|
||||||
app->setApplicationName(QStringLiteral("harbour-mosaic"));
|
app->setApplicationName(QStringLiteral("harbour-mosaic"));
|
||||||
|
|
||||||
QScopedPointer<QQuickView> view(SailfishApp::createView());
|
QScopedPointer<QQuickView> view(SailfishApp::createView());
|
||||||
|
logRiga("vista creata");
|
||||||
qmlRegisterType<EngineView>("Harbour.Mosaic", 1, 0, "EngineView");
|
qmlRegisterType<EngineView>("Harbour.Mosaic", 1, 0, "EngineView");
|
||||||
|
|
||||||
// Context property: le pagine aperte da pageStack non vedono le proprietà
|
// Context property: le pagine aperte da pageStack non vedono le proprietà
|
||||||
@@ -19,9 +120,25 @@ int main(int argc, char *argv[])
|
|||||||
AppSettings settings;
|
AppSettings settings;
|
||||||
view->rootContext()->setContextProperty(QStringLiteral("appSettings"), &settings);
|
view->rootContext()->setContextProperty(QStringLiteral("appSettings"), &settings);
|
||||||
|
|
||||||
|
QObject::connect(view.data(), &QQuickView::statusChanged, [view = view.data()](QQuickView::Status stato) {
|
||||||
|
logRiga("stato QML: %d", int(stato));
|
||||||
|
if (stato == QQuickView::Error) {
|
||||||
|
for (const QQmlError &e : view->errors()) {
|
||||||
|
logRiga("errore QML: %s", e.toString().toUtf8().constData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// pathTo: un QUrl relativo si risolve sulla CWD, che dal launcher non è la
|
// pathTo: un QUrl relativo si risolve sulla CWD, che dal launcher non è la
|
||||||
// cartella dell'app — il QML non caricherebbe e la pagina sarebbe bianca.
|
// cartella dell'app — il QML non caricherebbe e la pagina sarebbe bianca.
|
||||||
view->setSource(SailfishApp::pathTo(QStringLiteral("qml/harbour-mosaic.qml")));
|
view->setSource(SailfishApp::pathTo(QStringLiteral("qml/harbour-mosaic.qml")));
|
||||||
|
logRiga("sorgente QML impostata, errori: %d", int(view->errors().count()));
|
||||||
view->show();
|
view->show();
|
||||||
return app->exec();
|
logRiga("finestra mostrata");
|
||||||
|
const int esito = app->exec();
|
||||||
|
logRiga("uscita con %d", esito);
|
||||||
|
if (g_log) {
|
||||||
|
fclose(g_log);
|
||||||
|
}
|
||||||
|
return esito;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user