Clean up final nits

This commit is contained in:
kamathmanu 2021-08-14 09:44:34 -04:00
parent 9ab1296131
commit eaddfb4f73
3 changed files with 14 additions and 14 deletions

View file

@ -22,6 +22,7 @@ ApplicationWindow {
color: Nheko.colors.window color: Nheko.colors.window
modality: Qt.WindowModal modality: Qt.WindowModal
flags: Qt.Dialog | Qt.WindowCloseButtonHint flags: Qt.Dialog | Qt.WindowCloseButtonHint
Component.onCompleted: Nheko.reparent(roomDirectoryWindow)
title: qsTr("Explore Public Rooms") title: qsTr("Explore Public Rooms")
Shortcut { Shortcut {
@ -35,6 +36,12 @@ ApplicationWindow {
anchors.fill: parent anchors.fill: parent
model: publicRooms model: publicRooms
ScrollHelper {
flickable: parent
anchors.fill: parent
enabled: !Settings.mobileMode
}
delegate: Rectangle { delegate: Rectangle {
id: roomDirDelegate id: roomDirDelegate
@ -44,7 +51,7 @@ ApplicationWindow {
property int avatarSize: fontMetrics.lineSpacing * 4 property int avatarSize: fontMetrics.lineSpacing * 4
color: background color: background
height: avatarSize + 2.5 * Nheko.paddingMedium height: avatarSize + Nheko.paddingLarge
width: ListView.view.width width: ListView.view.width
RowLayout { RowLayout {
@ -67,7 +74,6 @@ ApplicationWindow {
id: textContent id: textContent
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true
width: parent.width - avatar.width width: parent.width - avatar.width
Layout.preferredWidth: parent.width - avatar.width Layout.preferredWidth: parent.width - avatar.width
Layout.preferredHeight: roomNameRow.height + roomDescriptionRow.height Layout.preferredHeight: roomNameRow.height + roomDescriptionRow.height
@ -76,7 +82,6 @@ ApplicationWindow {
RowLayout { RowLayout {
id: roomNameRow id: roomNameRow
Layout.fillWidth: true
spacing: 0 spacing: 0
ElidedLabel { ElidedLabel {
@ -92,7 +97,6 @@ ApplicationWindow {
RowLayout { RowLayout {
id: roomDescriptionRow id: roomDescriptionRow
Layout.fillWidth: true
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
@ -116,7 +120,6 @@ ApplicationWindow {
Item { Item {
id: numMembersRectangle id: numMembersRectangle
Layout.fillWidth: false
Layout.margins: Nheko.paddingSmall Layout.margins: Nheko.paddingSmall
width: roomCount.width width: roomCount.width
@ -125,8 +128,6 @@ ApplicationWindow {
color: roomDirDelegate.unimportantText color: roomDirDelegate.unimportantText
anchors.centerIn: parent anchors.centerIn: parent
Layout.fillWidth: false
font.weight: Font.Thin
font.pixelSize: fontMetrics.font.pixelSize font.pixelSize: fontMetrics.font.pixelSize
text: model.numMembers.toString() text: model.numMembers.toString()
} }
@ -136,7 +137,6 @@ ApplicationWindow {
Item { Item {
id: buttonRectangle id: buttonRectangle
Layout.fillWidth: false
Layout.margins: Nheko.paddingSmall Layout.margins: Nheko.paddingSmall
width: joinRoomButton.width width: joinRoomButton.width
@ -175,7 +175,6 @@ ApplicationWindow {
anchors.margins: Nheko.paddingLarge anchors.margins: Nheko.paddingLarge
running: visible running: visible
foreground: Nheko.colors.mid foreground: Nheko.colors.mid
z: 7
} }
} }

View file

@ -69,10 +69,8 @@ RoomDirectoryModel::setSearchTerm(const QString &f)
bool bool
RoomDirectoryModel::canJoinRoom(const QByteArray &room) RoomDirectoryModel::canJoinRoom(const QByteArray &room)
{ {
const auto &cache = cache::roomInfo();
const QString room_id(room); const QString room_id(room);
const bool validRoom = !room_id.isNull() && !room_id.isEmpty(); return !room_id.isEmpty() && !cache::getRoomInfo({room_id.toStdString()}).count(room_id);
return validRoom && !cache.contains(room_id);
} }
std::vector<std::string> std::vector<std::string>

View file

@ -71,11 +71,14 @@ signals:
void reachedEndOfPaginationChanged(); void reachedEndOfPaginationChanged();
public slots: public slots:
void displayRooms(std::vector<mtx::responses::PublicRoomsChunk> rooms,
const std::string &next_batch);
void setMatrixServer(const QString &s = ""); void setMatrixServer(const QString &s = "");
void setSearchTerm(const QString &f); void setSearchTerm(const QString &f);
private slots:
void displayRooms(std::vector<mtx::responses::PublicRoomsChunk> rooms,
const std::string &next_batch);
private: private:
static constexpr size_t limit_ = 50; static constexpr size_t limit_ = 50;