Fix nits from code review

This commit is contained in:
kamathmanu 2021-08-09 09:18:08 -04:00
parent 2dfccda73c
commit 6a75e5270c
7 changed files with 7 additions and 19 deletions

View file

@ -359,8 +359,8 @@ set(SRC_FILES
src/TrayIcon.cpp src/TrayIcon.cpp
src/UserSettingsPage.cpp src/UserSettingsPage.cpp
src/UsersModel.cpp src/UsersModel.cpp
src/RoomsModel.cpp
src/RoomDirectoryModel.cpp src/RoomDirectoryModel.cpp
src/RoomsModel.cpp
src/Utils.cpp src/Utils.cpp
src/WebRTCSession.cpp src/WebRTCSession.cpp
src/WelcomePage.cpp src/WelcomePage.cpp
@ -565,8 +565,8 @@ qt5_wrap_cpp(MOC_HEADERS
src/TrayIcon.h src/TrayIcon.h
src/UserSettingsPage.h src/UserSettingsPage.h
src/UsersModel.h src/UsersModel.h
src/RoomsModel.h
src/RoomDirectoryModel.h src/RoomDirectoryModel.h
src/RoomsModel.h
src/WebRTCSession.h src/WebRTCSession.h
src/WelcomePage.h src/WelcomePage.h
src/ReadReceiptsModel.h src/ReadReceiptsModel.h

View file

@ -6,7 +6,6 @@ import QtQuick 2.9
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import im.nheko 1.0 import im.nheko 1.0
import im.nheko.RoomDirectoryModel 1.0
ApplicationWindow { ApplicationWindow {
id: roomDirectoryWindow id: roomDirectoryWindow
@ -40,7 +39,7 @@ ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
font.pixelSize: fontMetrics.font.pixelSize font.pixelSize: fontMetrics.font.pixelSize
padding: Math.ceil(1.5 * Nheko.paddingSmall) padding: Nheko.paddingMedium
color: Nheko.colors.text color: Nheko.colors.text
placeholderText: qsTr("Search for public rooms") placeholderText: qsTr("Search for public rooms")
onTextChanged: searchTimer.restart() onTextChanged: searchTimer.restart()
@ -57,7 +56,6 @@ ApplicationWindow {
ListView { ListView {
id: roomDirView id: roomDirView
anchors.fill: parent anchors.fill: parent
height: parent.height - searchBarLayout.height
model: RoomDirectoryModel { model: RoomDirectoryModel {
id: roomDir id: roomDir
} }
@ -67,7 +65,7 @@ ApplicationWindow {
property color background: Nheko.colors.window property color background: Nheko.colors.window
property color importantText: Nheko.colors.text property color importantText: Nheko.colors.text
property color unimportantText: Nheko.colors.buttonText property color unimportantText: Nheko.colors.buttonText
property int avatarSize: Math.ceil(fontMetrics.lineSpacing * 4) property int avatarSize: fontMetrics.lineSpacing * 4
color: background color: background
@ -121,7 +119,7 @@ ApplicationWindow {
Layout.preferredWidth: parent.width Layout.preferredWidth: parent.width
spacing: Nheko.paddingSmall spacing: Nheko.paddingSmall
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.preferredHeight: Math.ceil(fontMetrics.lineSpacing * 4) Layout.preferredHeight: fontMetrics.lineSpacing * 4
Label { Label {
id: roomTopic id: roomTopic

View file

@ -565,7 +565,6 @@ Component {
ToolTip.text: qsTr("Room directory") ToolTip.text: qsTr("Room directory")
Layout.margins: Nheko.paddingMedium Layout.margins: Nheko.paddingMedium
onClicked: { onClicked: {
console.debug("Roomdir clicked");
var win = roomDirectoryComponent.createObject(timelineRoot); var win = roomDirectoryComponent.createObject(timelineRoot);
win.show(); win.show();
} }

View file

@ -143,11 +143,6 @@
<file>qml/emoji/StickerPicker.qml</file> <file>qml/emoji/StickerPicker.qml</file>
<file>qml/UserProfile.qml</file> <file>qml/UserProfile.qml</file>
<file>qml/RoomDirectory.qml</file> <file>qml/RoomDirectory.qml</file>
<file>qml/delegates/MessageDelegate.qml</file>
<file>qml/delegates/TextMessage.qml</file>
<file>qml/delegates/NoticeMessage.qml</file>
<file>qml/delegates/ImageMessage.qml</file>
<file>qml/delegates/PlayableMediaMessage.qml</file>
<file>qml/delegates/MessageDelegate.qml</file> <file>qml/delegates/MessageDelegate.qml</file>
<file>qml/delegates/Encrypted.qml</file> <file>qml/delegates/Encrypted.qml</file>
<file>qml/delegates/FileMessage.qml</file> <file>qml/delegates/FileMessage.qml</file>

View file

@ -42,9 +42,7 @@ RoomDirectoryModel::resetDisplayedData()
nextBatch_ = ""; nextBatch_ = "";
canFetchMore_ = true; canFetchMore_ = true;
beginRemoveRows(QModelIndex(), 0, static_cast<int>(publicRoomsData_.size()));
publicRoomsData_.clear(); publicRoomsData_.clear();
endRemoveRows();
endResetModel(); endResetModel();
} }
@ -87,8 +85,7 @@ RoomDirectoryModel::getViasForRoom(const std::vector<std::string> &aliases)
std::transform( std::transform(
aliases.begin(), aliases.end(), std::back_inserter(vias), [](const auto &alias) { aliases.begin(), aliases.end(), std::back_inserter(vias), [](const auto &alias) {
const auto roomAliasDelimiter = ":"; return alias.substr(alias.find(":") + 1);
return alias.substr(alias.find(roomAliasDelimiter) + 1);
}); });
return vias; return vias;

View file

@ -51,7 +51,6 @@ public:
inline bool canFetchMore(const QModelIndex &) const override inline bool canFetchMore(const QModelIndex &) const override
{ {
nhlog::net()->debug("determining if can fetch more");
return canFetchMore_; return canFetchMore_;
} }
void fetchMore(const QModelIndex &) override; void fetchMore(const QModelIndex &) override;

View file

@ -287,7 +287,7 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
"Error: Only enums"); "Error: Only enums");
qmlRegisterType<RoomDirectoryModel>( qmlRegisterType<RoomDirectoryModel>(
"im.nheko.RoomDirectoryModel", 1, 0, "RoomDirectoryModel"); "im.nheko", 1, 0, "RoomDirectoryModel");
#ifdef USE_QUICK_VIEW #ifdef USE_QUICK_VIEW
view = new QQuickView(parent); view = new QQuickView(parent);