Update libqmatrixclient.

Enable member lazy loading.
Some Qt 5.12 fix.
This commit is contained in:
Black Hat 2018-12-15 10:46:18 +08:00
parent 66e2d99620
commit 8300d022b2
9 changed files with 18 additions and 15 deletions

View File

@ -68,10 +68,8 @@ ColumnLayout {
Control { Control {
Layout.maximumWidth: messageListView.width - (!sentByMe ? 32 + messageRow.spacing : 0) - 48 Layout.maximumWidth: messageListView.width - (!sentByMe ? 32 + messageRow.spacing : 0) - 48
topPadding: 8 verticalPadding: 8
bottomPadding: 8 horizontalPadding: 16
leftPadding: 16
rightPadding: 16
background: Rectangle { background: Rectangle {
color: sentByMe ? "#009DC2" : eventType === "notice" ? "#4285F4" : "#673AB7" color: sentByMe ? "#009DC2" : eventType === "notice" ? "#4285F4" : "#673AB7"

View File

@ -48,7 +48,7 @@ Drawer {
wrapMode: Label.Wrap wrapMode: Label.Wrap
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: room ? room.memberCount + " Members" : "No Member Count" text: room ? room.totalMemberCount + " Members" : "No Member Count"
} }
RowLayout { RowLayout {

View File

@ -813,7 +813,11 @@ Rectangle {
inviteDialog.currentRoom = currentRoom inviteDialog.currentRoom = currentRoom
inviteDialog.open() inviteDialog.open()
} else { } else {
if (enteredRoom) {
enteredRoom.displayed = false
leaveRoom(enteredRoom) leaveRoom(enteredRoom)
}
currentRoom.displayed = true
enterRoom(currentRoom) enterRoom(currentRoom)
enteredRoom = currentRoom enteredRoom = currentRoom
} }

@ -1 +1 @@
Subproject commit be7d25ed22abd07a254bfb8ff6c30de4fcc79e6a Subproject commit fcc8d2ca615fce6e42bf1cf6585d60f94a2db926

View File

@ -42,7 +42,12 @@ Controller::Controller(QObject* parent)
QTimer::singleShot(0, this, SLOT(invokeLogin())); QTimer::singleShot(0, this, SLOT(invokeLogin()));
} }
Controller::~Controller() {} Controller::~Controller() {
for (Connection* c : m_connections) {
c->stopSync();
c->saveState();
}
}
inline QString accessTokenFileName(const AccountSettings& account) { inline QString accessTokenFileName(const AccountSettings& account) {
QString fileName = account.userId(); QString fileName = account.userId();
@ -107,6 +112,8 @@ void Controller::addConnection(Connection* c) {
m_connections.push_back(c); m_connections.push_back(c);
c->setLazyLoading(true);
connect(c, &Connection::syncDone, this, [=] { connect(c, &Connection::syncDone, this, [=] {
emit syncDone(); emit syncDone();
c->sync(30000); c->sync(30000);

View File

@ -29,6 +29,7 @@ QImage ImageProvider::requestImage(const QString& id, QSize* pSize,
QUrl mxcUri{id}; QUrl mxcUri{id};
QImage result = image(mxcUri, requestedSize); QImage result = image(mxcUri, requestedSize);
if (result.isNull()) return {};
if (!requestedSize.isEmpty() && result.size() != requestedSize) { if (!requestedSize.isEmpty() && result.size() != requestedSize) {
QImage scaled = result.scaled(requestedSize, Qt::KeepAspectRatio, QImage scaled = result.scaled(requestedSize, Qt::KeepAspectRatio,
Qt::SmoothTransformation); Qt::SmoothTransformation);

View File

@ -195,8 +195,6 @@ QDateTime SpectralRoom::lastActiveTime() {
return messageEvents().rbegin()->get()->timestamp(); return messageEvents().rbegin()->get()->timestamp();
} }
float SpectralRoom::orderForTag(QString name) { return tag(name).order; }
int SpectralRoom::savedTopVisibleIndex() const { int SpectralRoom::savedTopVisibleIndex() const {
return firstDisplayedMarker() == timelineEdge() return firstDisplayedMarker() == timelineEdge()
? 0 ? 0

View File

@ -66,7 +66,6 @@ class SpectralRoom : public Room {
} }
} }
Q_INVOKABLE float orderForTag(QString name);
Q_INVOKABLE int savedTopVisibleIndex() const; Q_INVOKABLE int savedTopVisibleIndex() const;
Q_INVOKABLE int savedBottomVisibleIndex() const; Q_INVOKABLE int savedBottomVisibleIndex() const;
Q_INVOKABLE void saveViewport(int topIndex, int bottomIndex); Q_INVOKABLE void saveViewport(int topIndex, int bottomIndex);

View File

@ -34,12 +34,8 @@ void UserListModel::setRoom(QMatrixClient::Room* room) {
connect(m_currentRoom, &Room::memberRenamed, this, connect(m_currentRoom, &Room::memberRenamed, this,
&UserListModel::userAdded); &UserListModel::userAdded);
{ {
QElapsedTimer et;
et.start();
m_users = m_currentRoom->users(); m_users = m_currentRoom->users();
std::sort(m_users.begin(), m_users.end(), room->memberSorter()); std::sort(m_users.begin(), m_users.end(), room->memberSorter());
qDebug() << "Sorting" << m_users.size() << "user(s) in"
<< m_currentRoom->displayName() << "took" << et;
} }
for (User* user : m_users) { for (User* user : m_users) {
connect(user, &User::avatarChanged, this, &UserListModel::avatarChanged); connect(user, &User::avatarChanged, this, &UserListModel::avatarChanged);