<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 03/03/2017 08:17, Jérémie Guichard
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAN27bAst=NbFvey9tKyMQrgP5FuV0agQAEOV9uxVVzrP+kd5iA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello Willem,
        <div><br>
        </div>
        <div>Unfortunately I am not very advanced in QML, but like with
          any other technologies I like to learn, dig for issues and get
          things forward. Furthermore when I have interest in the final
          goal :)</div>
        <div><br>
        </div>
        <div>First things first, I'd have to get the code so I can have
          a look at the current state, I guess there is a branch in
          Subsurface repo, is it: <a moz-do-not-send="true"
href="https://github.com/Subsurface-divelog/subsurface/tree/android-kirigami2"
            class="gmail-branch-name gmail-css-truncate-target"
style="box-sizing:border-box;background-color:rgb(234,245,255);color:rgb(3,102,214);display:inline-block;padding:2px
6px;font-stretch:normal;font-size:12px;line-height:normal;font-family:sfmono-regular,consolas,"liberation
mono",menlo,courier,monospace;border-radius:3px;outline-width:0px;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:top">android-kirigami2</a>?
          If not, just point me to the right one :)</div>
        <div>Then I guess you could tell me what you'd like me to have a
          look at. I'll be able then to tell you then if I'm up for the
          task :)</div>
        <div><br>
        </div>
        <div>I'm currently abroad passing my dive instructor course, so
          I will sometimes be busy with it, but it generally gives me a
          bit of free time every day.</div>
        <div><br>
        </div>
        <div>Best regards,</div>
        <div><br>
        </div>
        <div>Jeremie</div>
      </div>
    </blockquote>
    <br>
    Hi Jérémie,<br>
    <br>
    I started some work on downloading dives to Subsurface-mobile about
    18-24 months ago. At that stage the major problem was that the USB
    back end was not available like today. Therefore the work stalled.
    Since then, Anton has finalised the USB back end and only a UI is
    required to do the downloads.<br>
    <br>
    In Subsurface-desktop, the UI is based on Qt-widgets. However this
    approach is not viable in the mobile environment. Consequently, the
    mobile UI is based on QML / Kirigami. This means that UI components
    in the desktop code cannot be directly ported to mobile but need a
    rewrite. However, both the Qt-widgets as well as the QML have access
    to background code independent of the UI. This background code is in
    C++. <br>
    <br>
    The file subsurface/mobile-widgets/qml/main.qml contains the main
    menu system for Subsurface-mobile. Line 144 contains the code:<br>
                Kirigami.Action {<br>
                    text: qsTr("Manage dives")....etc<br>
    This is the menu item that appears when selecting "Manage dives" in
    Subsurface-mobile.<br>
    If you insert the following after line 149 in that file:<br>
                    Kirigami.Action {<br>
                        text: qsTr("Get dives from dive computer")<br>
                        onTriggered: {<br>
                            stackView.push(downloadDivesWindow)<br>
                        }<br>
                    }<br>
    then the mobile download screen is activated.<br>
    <br>
    The file subsurface/mobile-widgets/qml/DownloadFromDiveComputer.qml
    contains the QML for downloads. Apart from the buttons, it comprises
    two comboboxes to select the vendor/make and model of the dive
    computer being downloaded from. E.g. vendor "Mares" and model
    "Matrix". The names in the combo-boxes are supplied by QStringLists
    in the background C++ code. A QStringListModel is then used to store
    the information in the QStringList. It is also used by the QML to
    display the correct dive computer vendor or model names. Similarly,
    there is a table of dives that have been downloaded to
    Subsurface-Mobile with headers "Date/Time, Duration, Depth". When
    download is complete, this table is populated with the correct
    information. Similar to the comboboxes, this table is actually a Qt
    QAbstractTable that is accessed using a QAbstractTableModel, which
    is also visible on the QML side. There is also a progress bar in
    this screen.<br>
    <br>
    The main download code for the desktop version is located in
    subsurface/desktop-widgets/downloadfromdivecomputer.cpp. This file
    cannot be directly accessed by the mobile code because it contains
    Qt-widgets. However, within this file there is a large amount of
    background C++ code that is usable both from the desktop and from
    the mobile side. It is therefore necessary to remove all the
    background (UI-independent) code from downloadfromdivecomputer.cpp
    and to save it as a separate C++ file, the header file of which can
    be #included in downloadfromdivecomputer.cpp. I did a large
    proportion of that but I see my code has been removed.<br>
    <br>
    Within downloadfromdivecomputer.cpp there is an object
    DownloadThread. Instantiation of that thread starts the USB back end
    that Anton completed. One does not need to deal with any low-level
    code to execute the download.<br>
    <br>
    So the tasks are:<br>
    1) Separate the existing C++ code in downloadfromdivecomputer that
    is usable from the QML side into a separate file, callable from both
    the desktop as well as the mobile side.<br>
    Create C++ code that serves as a back end for QML, including:<br>
    2) Populate the two comboboxes with the approapriate vendor and
    model data. This means: create the appropriate QStrinList and
    QStringListModels. I did this before the switch to kirigami, but I
    see the code has been removed.<br>
    3) Create an appropriate QAbstartcTable and a corresponding
    QAbstractTableModel to feed the right dive download data to the
    table on the mobile screen and to allow later integration of the
    selected downloaded dives into the dive list.<br>
    4) Instantiate the DownloadThread.<br>
    <br>
    I hope this makes some sense to you. I am as new as you are to
    kirigami. I am not experienced with QML. But creating a download
    interface for Subsurface-mobile is likely to have a huge effect on
    its usability and the degree to which divers make use of
    Subsurface-mobile. Therefore this work is definitely worth it.<br>
    <br>
    Kind regards,<br>
    willem<br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
  </body>
</html>