UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Porting QT/C++ app to clickable

    Scheduled Pinned Locked Moved App Development
    7 Posts 5 Posters 1.1k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • G Offline
        graphik_
        last edited by

        Hello community,

        I like to try to port an existing application into a clickable.
        The desired application is Moonlight (https://github.com/moonlight-stream/moonlight-qt).
        This is gamestream client which is impleneted in QT and C++.

        For my understanding a porting should be do able because the technology is used for clickables too.
        (If some dependencies will not work because the QT version has to be something special is written on another paper)

        For now I try to figure out how such a project would need to be restructured so that clickable would try to compile it properly.

        Moonlight uses git submodules, those could be added in the clickable "libs" folder too which should be one required step.
        But for example I have no idea where to put the language files or settings cpp files.

        The C++ clickable I selected on creation is relativly flat. A main.cpp and the qml folder for the UI.

        Someone here who could help me to udnerstand the clickable structure better or knows some similar project which could be used as a reference?

        Regards,
        graphik_

        mateo_saltaM 1 Reply Last reply Reply Quote 0
        • mymikeM Offline
          mymike
          last edited by

          @jonius Do you mind giving a hand with this?

          1 Reply Last reply Reply Quote 1
          • mateo_saltaM Offline
            mateo_salta @graphik_
            last edited by

            @graphik_ looks like it uses sdl2, maybe @abmyii could take a look too?

            A 1 Reply Last reply Reply Quote 1
            • joniusJ Offline
              jonius
              last edited by jonius

              You got the right approach already. Clickable does not require any specific project structure. Ideally you would just add a clickable config (clickable.json) and a few UT specific files (manifest, apparmor config, maybe a specific desktop file), see Pure Maps for example. Only the folder packaging/click is UT specific.

              I would go step by step like this:

              • add a simple clickable.json with builder set to qmake
              • run clickable build -a amd64 and see what happens
                • you might need to set some build_args that would be consumed by QMake
                • you will probably need to add dependencies to the build container (dependencies_target and dependencies_host for build tools)
                • for dependencies that are not available in the ubuntu repos, you already mentioned the libraries feature. Refer to this guide for details
              • Once it builds the app, you can start with what is needed for the click package
                • Create a new app with clickable create filling in the details
                • Copy over the manifest.json.in, rename it to manifest.json and just put fix values where there are placeholders.
                • Copy over the the apparmor file and add policies if needed.
                • For the desktop file I would look for one in the build or source dir, copy it over and add the line X-Ubuntu-Touch=true.
                • Add those 3 files to install_data.
                • Try first in Desktop Mode with clickable desktop and then on the device clickable chain build install launch logs -a arm64 # or armhf

              Just for calification: click is the package format that Ubuntu Touch expects. The tool to create such a package is called click, too (but you don't use that one directly if using Clickable). Clickable is a tool that knows how to handle click, do cross compiling utilizing docker (Clickable also provides the necessary images), handle build tools like CMake, QMake or cargo, run apps in Desktop Mode, handle some debugging tools like gdb, configure an IDE, install a click on your device and so on. So it is like a swizz knife for UT app development...

              1 Reply Last reply Reply Quote 2
              • joniusJ Offline
                jonius
                last edited by jonius

                Looking at their required dependencies you might get somewhere. But do you know whether their UI is optimized for small touch screens?

                G 1 Reply Last reply Reply Quote 0
                • G Offline
                  graphik_ @jonius
                  last edited by

                  @jonius thank you for the detailed information and the short guideline. I will try this at the weekend and we will see how far it will goes.

                  It also looks like I missed some information about the clickable design, but this is clear now.

                  The UI should work fine on small devices. The PC and Android app have the same layout which is pretty usable on a smartphone.

                  I will update the thread as soon as I tested the new information.

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    abmyii @mateo_salta
                    last edited by abmyii

                    @mateo_salta Sorry for the late reply - I check my messages infrequently.

                    @graphik_ I successfully built this on my device, but I don't think moonlight has Mir support, so it doesn't work for me. If you have a Wayland device I can describe the steps required to build and test it yourself.

                    I believe the limitation stems from libva which doesn't appear to have Mir support (https://github.com/moonlight-stream/moonlight-qt/blob/51b5f8046f1864e36cfa6efefbe2de71ef98ca92/app/streaming/video/ffmpeg-renderers/vaapi.h#L18-L31).

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post