mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile: add timer to measure startup.
Subsurface-mobile has a long startup time; in order to isolate the problem(s) a timer is added to see where time is "lost". The collected startup times are added to the clipboard together with the other logs, allowing test users to report back. All this is only enabled when compiling with -DENABLE_STARTUP_TIMING Closes #1340 [Dirk Hohndel: collapsed multiple commits and minor white space cleanups, added missing QMutex variable] Signed-off-by: Jan Iversen <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3963e44404
commit
76f61468e6
4 changed files with 77 additions and 0 deletions
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include "mobile-widgets/qml/kirigami/src/kirigamiplugin.h"
|
||||
|
||||
#include "core/ssrf.h"
|
||||
|
||||
QObject *qqWindowObject = NULL;
|
||||
|
||||
void set_non_bt_addresses() {
|
||||
|
@ -51,6 +53,7 @@ void init_ui()
|
|||
|
||||
void run_ui()
|
||||
{
|
||||
LOG_STP("run_ui starting");
|
||||
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
|
||||
qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile");
|
||||
|
||||
|
@ -63,6 +66,7 @@ void run_ui()
|
|||
qmlRegisterType<MapLocation>("org.subsurfacedivelog.mobile", 1, 0, "MapLocation");
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
LOG_STP("run_ui qml engine started");
|
||||
KirigamiPlugin::getInstance().registerTypes();
|
||||
#if defined(__APPLE__) && !defined(Q_OS_IOS)
|
||||
// when running the QML UI on a Mac the deployment of the QML Components seems
|
||||
|
@ -79,11 +83,13 @@ void run_ui()
|
|||
#endif
|
||||
engine.addImportPath("qrc://imports");
|
||||
DiveListModel diveListModel;
|
||||
LOG_STP("run_ui diveListModel started");
|
||||
DiveListSortModel *sortModel = new DiveListSortModel(0);
|
||||
sortModel->setSourceModel(&diveListModel);
|
||||
sortModel->setDynamicSortFilter(true);
|
||||
sortModel->setSortRole(DiveListModel::DiveDateRole);
|
||||
sortModel->sort(0, Qt::DescendingOrder);
|
||||
LOG_STP("run_ui diveListModel sorted");
|
||||
GpsListModel gpsListModel;
|
||||
QSortFilterProxyModel *gpsSortModel = new QSortFilterProxyModel(0);
|
||||
gpsSortModel->setSourceModel(&gpsListModel);
|
||||
|
@ -95,11 +101,13 @@ void run_ui()
|
|||
ctxt->setContextProperty("gpsModel", gpsSortModel);
|
||||
ctxt->setContextProperty("vendorList", vendorList);
|
||||
set_non_bt_addresses();
|
||||
LOG_STP("run_ui set_non_bt_adresses");
|
||||
|
||||
ctxt->setContextProperty("connectionListModel", &connectionListModel);
|
||||
ctxt->setContextProperty("logModel", MessageHandlerModel::self());
|
||||
|
||||
engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml")));
|
||||
LOG_STP("run_ui qml loaded");
|
||||
qqWindowObject = engine.rootObjects().value(0);
|
||||
if (!qqWindowObject) {
|
||||
fprintf(stderr, "can't create window object\n");
|
||||
|
@ -112,8 +120,10 @@ void run_ui()
|
|||
QScreen *screen = qml_window->screen();
|
||||
QObject::connect(qml_window, &QQuickWindow::screenChanged, QMLManager::instance(), &QMLManager::screenChanged);
|
||||
QMLManager *manager = QMLManager::instance();
|
||||
LOG_STP("run_ui qmlmanager instance started");
|
||||
// now that the log file is initialized...
|
||||
show_computer_list();
|
||||
LOG_STP("run_ui show_computer_list");
|
||||
|
||||
manager->setDevicePixelRatio(qml_window->devicePixelRatio(), qml_window->screen());
|
||||
manager->dlSortModel = sortModel;
|
||||
|
@ -124,6 +134,7 @@ void run_ui()
|
|||
qml_window->setWidth(800);
|
||||
#endif
|
||||
qml_window->show();
|
||||
LOG_STP("run_ui running exec");
|
||||
qApp->exec();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue