Skip to content

Commit 2075092

Browse files
committed
Use QMatrixClient::Settings in QML instead of Qt.labs.settings
Because QMatrixClient::Settings now allows to read from the legacy location, and because it doesn't write the setting when not necessary.
1 parent 183bc34 commit 2075092

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

client/chatroomwidget.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "lib/events/roommessageevent.h"
3333
#include "lib/user.h"
3434
#include "lib/connection.h"
35+
#include "lib/settings.h"
3536
#include "models/messageeventmodel.h"
3637
#include "imageprovider.h"
3738
#include "chatedit.h"
@@ -42,6 +43,7 @@ ChatRoomWidget::ChatRoomWidget(QWidget* parent)
4243
, readMarkerOnScreen(false)
4344
{
4445
qmlRegisterType<QuaternionRoom>();
46+
qmlRegisterType<QMatrixClient::Settings>("QMatrixClient", 1, 0, "Settings");
4547
m_messageModel = new MessageEventModel(this);
4648

4749
m_roomAvatar = new QLabel();

client/qml/chat.qml

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import QtQuick 2.2
22
import QtQuick.Controls 1.0
33
import QtQuick.Controls.Styles 1.0
44
import QtQuick.Layouts 1.1
5-
import Qt.labs.settings 1.0
5+
import QMatrixClient 1.0
66

77
Item {
88
id: root
99

1010
Settings {
11-
id: uiSettings
12-
category: "UI"
13-
property bool condense_chat: false
11+
id: settings
12+
property bool condense_chat: value("UI/condense_chat", false)
1413
}
1514
SystemPalette { id: defaultPalette; colorGroup: SystemPalette.Active }
1615
SystemPalette { id: disabledPalette; colorGroup: SystemPalette.Disabled }
@@ -286,7 +285,7 @@ Item {
286285
ToolButton {
287286
id: showSourceButton
288287
text: "..."
289-
Layout.maximumHeight: uiSettings.condense_chat ?
288+
Layout.maximumHeight: settings.condense_chat ?
290289
contentRect.height : implicitHeight
291290
Layout.alignment: Qt.AlignTop
292291

0 commit comments

Comments
 (0)