mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-21 18:50:47 +03:00
Speedup room switching by forcing a bigger initial item size
This commit is contained in:
parent
392c07adbe
commit
87c063b112
7 changed files with 14 additions and 11 deletions
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
#ifdef QML_DEBUGGING
|
||||
#include <QQmlDebuggingEnabler>
|
||||
QQmlDebuggingEnabler enabler;
|
||||
QQmlTriviallyDestructibleDebuggingEnabler enabler;
|
||||
#endif
|
||||
|
||||
#if HAVE_BACKTRACE_SYMBOLS_FD
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue