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/UserSettingsPage.cpp
src/UsersModel.cpp
src/RoomsModel.cpp
src/RoomDirectoryModel.cpp
src/RoomsModel.cpp
src/Utils.cpp
src/WebRTCSession.cpp
src/WelcomePage.cpp
@ -565,8 +565,8 @@ qt5_wrap_cpp(MOC_HEADERS
src/TrayIcon.h
src/UserSettingsPage.h
src/UsersModel.h
src/RoomsModel.h
src/RoomDirectoryModel.h
src/RoomsModel.h
src/WebRTCSession.h
src/WelcomePage.h
src/ReadReceiptsModel.h

View file

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

View file

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

View file

@ -143,11 +143,6 @@
<file>qml/emoji/StickerPicker.qml</file>
<file>qml/UserProfile.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/Encrypted.qml</file>
<file>qml/delegates/FileMessage.qml</file>

View file

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

View file

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

View file

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