source: subsurface/subsurface-mobile-main.cpp

Last change on this file was a55efcf, checked in by Dirk Hohndel <dirk@…>, 4 weeks ago

Move the fill_computer_list() out of widgets

fill_computer_list() creates a Qt friendly
structure that contains all of the necessary
information about dive computers and it's
devices, and it's needed both in Qml and Widgets
to allow the user to download their dives.

This patch makes it possible to use the code
in QML without duplication.

Signed-off-by: Tomaz Canabrava <tcanabrava@…>
Signed-off-by: Dirk Hohndel <dirk@…>

  • Property mode set to 100644
File size: 1.8 KB
Line 
1// SPDX-License-Identifier: GPL-2.0
2/* main.c */
3#include <locale.h>
4#include <stdio.h>
5#include <string.h>
6#include <stdlib.h>
7#include <time.h>
8
9#include "core/dive.h"
10#include "core/qt-gui.h"
11#include "core/subsurfacestartup.h"
12#include "core/color.h"
13#include "core/qthelper.h"
14#include "core/helpers.h"
15#include "core/downloadfromdcthread.h"
16
17#include <QStringList>
18#include <QApplication>
19#include <QLoggingCategory>
20#include <git2.h>
21
22int main(int argc, char **argv)
23{
24        int i;
25        QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
26        QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
27        QApplication *application = new QApplication(argc, argv);
28        (void)application;
29        QStringList arguments = QCoreApplication::arguments();
30
31        bool dedicated_console = arguments.length() > 1 &&
32                                 (arguments.at(1) == QString("--win32console"));
33        subsurface_console_init(dedicated_console, false);
34
35        for (i = 1; i < arguments.length(); i++) {
36                QString a = arguments.at(i);
37                if (!a.isEmpty() && a.at(0) == '-') {
38                        parse_argument(a.toLocal8Bit().data());
39                        continue;
40                }
41        }
42        git_libgit2_init();
43        setup_system_prefs();
44        if (uiLanguage(0).contains("-US"))
45                default_prefs.units = IMPERIAL_units;
46        prefs = default_prefs;
47        fill_profile_color();
48        fill_computer_list();
49
50        parse_xml_init();
51        taglist_init_global();
52        init_ui();
53        if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE)
54                set_filename(prefs.default_filename, true);
55        else
56                set_filename(NULL, true);
57
58        // some hard coded settings
59        prefs.animation_speed = 0; // we render the profile to pixmap, no animations
60
61        // always show the divecomputer reported ceiling in red
62        prefs.redceiling = 1;
63
64        init_proxy();
65
66        if (!quit)
67                run_ui();
68        exit_ui();
69        taglist_free(g_tag_list);
70        parse_xml_exit();
71        subsurface_console_exit();
72        free_prefs();
73        return 0;
74}
Note: See TracBrowser for help on using the repository browser.