Nheko-Reborn / nheko

Desktop client for Matrix using Qt and C++20.
https://nheko-reborn.github.io/
GNU General Public License v3.0
1.9k stars 199 forks source link

White screen when Qt.labs.animation is not installed #874

Open Minoru opened 2 years ago

Minoru commented 2 years ago

Describe the bug

When Qt.labs.animation module is not installed, Nheko client displays a white screen instead of the UI. In the console, the following error can be seen:

[2022-01-03 16:02:34.635] [ui] [info] Restoring window size 1920x1033
[2022-01-03 16:02:34.805] [ui] [info] jdenticon plugin not found.
[2022-01-03 16:02:34.853] [qml] [warning] qrc:/qml/Root.qml:142:9: Type ImageOverlay unavailable 
             ImageOverlay { 
             ^ (qrc:/qml/Root.qml:142, )
[2022-01-03 16:02:34.853] [qml] [warning] qrc:/qml/dialogs/ImageOverlay.qml:7:1: module "Qt.labs.animation" is not installed 
     import Qt.labs.animation 1.0 
     ^ (qrc:/qml/dialogs/ImageOverlay.qml:7, )
[2022-01-03 16:02:34.853] [ui] [debug] Status changed to 3
[2022-01-03 16:02:34.937] [ui] [info] starting nheko 0.9.1-193215c0
[2022-01-03 16:02:34.950] [db] [debug] setting up cache

(The rest of the log is trimmed because it contains nothing relevant).

To Reproduce

  1. Uninstall Qt.labs.animation module (on Debian: sudo apt remove qml-module-qt-labs-animation)
  2. Build and start Nheko: git checkout 193215c067a74f27df8dd5899bdc3ed88ca15a3e && cmake --build build --config Release -j9 && ./build/nheko
  3. Notice that the Nheko window is white, and see the aforementioned error in the log.

What happened?

Upon startup, the Nheko window was all white and no UI elements were visible.

Expected behavior

Nheko either fails to compile when Qt.labs.animation is not installed, or it fails to start with a clear message explaining that the module was not found.

Screenshots

No response

Version

193215c067a74f27df8dd5899bdc3ed88ca15a3e

Operating system

Linux

Installation method

Local build

Qt version

5.15.2

C++ compiler

GCC 10.2.1

Desktop Environment

Wayland and Sway WM

Did you use profiles?

Relevant log output

[2022-01-03 16:02:34.635] [ui] [info] Restoring window size 1920x1033
[2022-01-03 16:02:34.805] [ui] [info] jdenticon plugin not found.
[2022-01-03 16:02:34.853] [qml] [warning] qrc:/qml/Root.qml:142:9: Type ImageOverlay unavailable 
             ImageOverlay { 
             ^ (qrc:/qml/Root.qml:142, )
[2022-01-03 16:02:34.853] [qml] [warning] qrc:/qml/dialogs/ImageOverlay.qml:7:1: module "Qt.labs.animation" is not installed 
     import Qt.labs.animation 1.0 
     ^ (qrc:/qml/dialogs/ImageOverlay.qml:7, )
[2022-01-03 16:02:34.853] [ui] [debug] Status changed to 3
[2022-01-03 16:02:34.937] [ui] [info] starting nheko 0.9.1-193215c0
[2022-01-03 16:02:34.950] [db] [debug] setting up cache

Backtrace

No response

redsky17 commented 2 years ago

Unfortunately, QML modules are not required at build time, and forcing them to exist at build time can end up causing problems for a lot of our packagers, so that option doesn't work.

Showing a popup with a message indicating the error might be tenable, but I don't think it's something we're going to work on any time soon (we really need to have a better way of showing errors in nheko in general, and I think that will take some time to design and implement correctly so it works across the board).

In the interim, I'm going to work on updating the readme so some of these hidden requirements are made more obvious for users.

lbeltrame commented 2 years ago

I'm not sure if you can require them via CMake, but if you so, you can set the requirement to be RUNTIME, so that it is shown as such (if you use FeatureSummary).