diff --git a/CMakeLists.txt b/CMakeLists.txt index 54dda2264569f7a0be01aa094916dfd65d81f08b..7160ef9642c1e9e6931f59beefa8460df32c0711 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,6 @@ option(APPVEYOR_BUILD "Build on appveyor" OFF) option(CI_BUILD "Set when building in CI. Enables -Werror where possible" OFF) option(ASAN "Compile with address sanitizers" OFF) option(QML_DEBUGGING "Enable qml debugging" OFF) -option(COMPILE_QML "Compile Qml. It will make Nheko faster, but you will need to recompile it, when you update Qt." OFF) if(UNIX AND NOT APPLE) option(MAN "Build man page" ON) else() @@ -241,7 +240,6 @@ endif() # Discover Qt dependencies. # find_package(Qt6 6.5 COMPONENTS Core Widgets Gui LinguistTools Svg Multimedia Qml QuickControls2 REQUIRED) -#find_package(Qt6QuickCompiler) find_package(Qt6DBus) if(USE_BUNDLED_QTKEYCHAIN) @@ -633,11 +631,7 @@ endif() # # Bundle resources # -if(Qt6QuickCompiler_FOUND AND COMPILE_QML) - qtquick_compiler_add_resources(QRC resources/res.qrc) -else() - qt_add_resources(QRC resources/res.qrc) -endif() +qt_add_resources(QRC resources/res.qrc) if(APPLE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa -framework UserNotifications") diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 97a121ebf5f0c2e596a2a8a9b2bde5b8a9b8306c..0b7a5a20ad2b5dc3577a065af3dec2b65119320b 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -47,7 +47,7 @@ Item { anchors.rightMargin: scrollbar.interactive ? scrollbar.width : 0 // reuseItems still has a few bugs, see https://bugreports.qt.io/browse/QTBUG-95105 https://bugreports.qt.io/browse/QTBUG-95107 //onModelChanged: if (room) room.sendReset() - //reuseItems: true + reuseItems: true boundsBehavior: Flickable.StopAtBounds displayMarginBeginning: height / 4 displayMarginEnd: height / 4 diff --git a/resources/qml/TimelineBubbleMessageStyle.qml b/resources/qml/TimelineBubbleMessageStyle.qml index add701a143c3627b5cdd00fb54e7f87900dd1726..2e0381315093ed72cba0353e51f0857eb1887c79 100644 --- a/resources/qml/TimelineBubbleMessageStyle.qml +++ b/resources/qml/TimelineBubbleMessageStyle.qml @@ -11,7 +11,9 @@ TimelineEvent { id: wrapper ListView.delayRemove: true width: chat.delegateMaxWidth - height: Math.max((section.item?.height ?? 0) + gridContainer.implicitHeight + reactionRow.implicitHeight + unreadRow.height, 10) + // We return a larger size for any item but the most bottom one, if it isn't initialized yet, since otherwise Qt will create way too many items. + // If we did that also for the first item, it would mess with the scroll location a bit, so we don't do it for that item. + height: Math.max((section.item?.height ?? 0) + ((gridContainer.implicitHeight < 1 && index != 0) ? 100 : gridContainer.implicitHeight) + reactionRow.implicitHeight + unreadRow.height, 10) anchors.horizontalCenter: ListView.view.contentItem.horizontalCenter //room: chatRoot.roommodel diff --git a/resources/qml/TimelineDefaultMessageStyle.qml b/resources/qml/TimelineDefaultMessageStyle.qml index a4466442dff328e5ff2be8cfa1fa422eb1c682b6..55c62b02d5aeb1919afdda5cb0bc3ebf9eb97d0d 100644 --- a/resources/qml/TimelineDefaultMessageStyle.qml +++ b/resources/qml/TimelineDefaultMessageStyle.qml @@ -11,7 +11,9 @@ TimelineEvent { id: wrapper ListView.delayRemove: true width: chat.delegateMaxWidth - height: Math.max((section.item?.height ?? 0) + gridContainer.implicitHeight + reactionRow.implicitHeight + unreadRow.height, 10) + // We return a larger size for any item but the most bottom one, if it isn't initialized yet, since otherwise Qt will create way too many items. + // If we did that also for the first item, it would mess with the scroll location a bit, so we don't do it for that item. + height: Math.max((section.item?.height ?? 0) + ((gridContainer.implicitHeight < 1 && index != 0) ? 100 : gridContainer.implicitHeight) + reactionRow.implicitHeight + unreadRow.height, 10) anchors.horizontalCenter: ListView.view.contentItem.horizontalCenter //room: chatRoot.roommodel diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml index 2a47d275f7a1b588d1de7f9e9c6f4377c16ab401..7c035922cff49d490a659210c8814538a7d01e7f 100644 --- a/resources/qml/delegates/PlayableMediaMessage.qml +++ b/resources/qml/delegates/PlayableMediaMessage.qml @@ -35,6 +35,7 @@ Item { // TODO: Show error in overlay or so? roomm: room + // FIXME: This takes 500ms on my device, why and how can we avoid that? audioOutput: AudioOutput { muted: mediaControls.muted volume: mediaControls.desiredVolume diff --git a/src/main.cpp b/src/main.cpp index c90cbc2e3ec0387e397b72bc804913a57ca385d1..efe9333d779b7d45463dd7e8ccc1e0076076a47a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,7 +47,7 @@ #ifdef QML_DEBUGGING #include <QQmlDebuggingEnabler> -QQmlDebuggingEnabler enabler; +QQmlTriviallyDestructibleDebuggingEnabler enabler; #endif #if HAVE_BACKTRACE_SYMBOLS_FD diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index a49dde3cb5e62b23b8c7e6af737fad10f9e1294a..05a3c45c72370ff4aeb1840ce7ac2e22cff15470 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -997,6 +997,8 @@ TimelineModel::multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSp return; } + // nhlog::db()->debug("MultiData called for {}", index.row()); + // HACK(Nico): fetchMore likes to break with dynamically sized delegates and reuseItems if (index.row() + 1 == rowCount() && !m_paginationInProgress) const_cast<TimelineModel *>(this)->fetchMore(index); @@ -1025,6 +1027,8 @@ TimelineModel::multiData(const QString &id, return; } + // nhlog::db()->debug("MultiData called for {}", id.toStdString()); + auto event = events.get(id.toStdString(), relatedTo.toStdString()); if (!event) {