Fix various warnings
This commit is contained in:
@@ -25,6 +25,7 @@ void FileTransferPseudoJob::fileTransferProgress(QString id, qint64 progress, qi
|
||||
|
||||
void FileTransferPseudoJob::fileTransferCompleted(QString id, QUrl localFile)
|
||||
{
|
||||
Q_UNUSED(localFile);
|
||||
if (id != m_eventId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ void CustomEmojiModel::addEmoji(const QString &name, const QUrl &location)
|
||||
auto job = Controller::instance().activeConnection()->uploadFile(location.toLocalFile());
|
||||
|
||||
if (running(job)) {
|
||||
connect(job, &BaseJob::success, this, [this, name, job] {
|
||||
connect(job, &BaseJob::success, this, [name, job] {
|
||||
const auto &data = Controller::instance().activeConnection()->accountData("im.ponies.user_emotes");
|
||||
auto json = data != nullptr ? data->contentJson() : QJsonObject();
|
||||
auto emojiData = json["images"].toObject();
|
||||
@@ -141,6 +141,8 @@ QVariant CustomEmojiModel::data(const QModelIndex &idx, int role) const
|
||||
return QUrl(QStringLiteral("image://mxc/") + data.url.mid(6));
|
||||
case Roles::MxcUrl:
|
||||
return data.url.mid(6);
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
|
||||
@@ -498,7 +498,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (role == SourceRole) {
|
||||
return evt.originalJson();
|
||||
return QJsonDocument(evt.fullJson()).toJson();
|
||||
}
|
||||
|
||||
if (role == DelegateTypeRole) {
|
||||
@@ -983,7 +983,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
if (role == IsPendingRole) {
|
||||
return row < m_currentRoom->pendingEvents().size();
|
||||
return row < static_cast<int>(m_currentRoom->pendingEvents().size());
|
||||
}
|
||||
|
||||
return {};
|
||||
|
||||
@@ -43,20 +43,27 @@ void SearchModel::search()
|
||||
}
|
||||
|
||||
SearchJob::RoomEventsCriteria criteria{
|
||||
m_searchText,
|
||||
{},
|
||||
RoomEventFilter{
|
||||
.rooms = {m_room->id()},
|
||||
},
|
||||
"recent",
|
||||
SearchJob::IncludeEventContext{3, 3, true},
|
||||
false,
|
||||
none,
|
||||
.searchTerm = m_searchText,
|
||||
.keys = {},
|
||||
.filter =
|
||||
RoomEventFilter{
|
||||
.unreadThreadNotifications = none,
|
||||
.lazyLoadMembers = true,
|
||||
.includeRedundantMembers = false,
|
||||
.notRooms = {},
|
||||
.rooms = {m_room->id()},
|
||||
.containsUrl = false,
|
||||
},
|
||||
.orderBy = "recent",
|
||||
.eventContext = SearchJob::IncludeEventContext{3, 3, true},
|
||||
.includeState = false,
|
||||
.groupings = none,
|
||||
|
||||
};
|
||||
|
||||
auto job = m_connection->callApi<SearchJob>(SearchJob::Categories{criteria});
|
||||
m_job = job;
|
||||
connect(job, &BaseJob::finished, this, [=] {
|
||||
connect(job, &BaseJob::finished, this, [this, job] {
|
||||
beginResetModel();
|
||||
m_result = job->searchCategories().roomEvents;
|
||||
endResetModel();
|
||||
@@ -116,6 +123,7 @@ QVariant SearchModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
int SearchModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
#ifdef QUOTIENT_07
|
||||
if (m_result.has_value()) {
|
||||
return m_result->results.size();
|
||||
|
||||
@@ -49,7 +49,7 @@ void StateModel::setRoom(NeoChatRoom *room)
|
||||
Q_EMIT roomChanged();
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
connect(room, &NeoChatRoom::changed, this, [=] {
|
||||
connect(room, &NeoChatRoom::changed, this, [this] {
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
});
|
||||
|
||||
@@ -254,17 +254,16 @@ const RoomEvent *NeoChatRoom::lastEvent() const
|
||||
continue;
|
||||
}
|
||||
|
||||
if (event->isStateEvent() && !NeoChatConfig::self()->showStateEvent()) {
|
||||
if (event->isStateEvent() && !NeoChatConfig::showStateEvent()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto roomMemberEvent = eventCast<const RoomMemberEvent>(event)) {
|
||||
if ((roomMemberEvent->isJoin() || roomMemberEvent->isLeave()) && !NeoChatConfig::self()->showLeaveJoinEvent()) {
|
||||
if ((roomMemberEvent->isJoin() || roomMemberEvent->isLeave()) && !NeoChatConfig::showLeaveJoinEvent()) {
|
||||
continue;
|
||||
} else if (roomMemberEvent->isRename() && !roomMemberEvent->isJoin() && !roomMemberEvent->isLeave() && !NeoChatConfig::self()->showRename()) {
|
||||
} else if (roomMemberEvent->isRename() && !roomMemberEvent->isJoin() && !roomMemberEvent->isLeave() && !NeoChatConfig::showRename()) {
|
||||
continue;
|
||||
} else if (roomMemberEvent->isAvatarUpdate() && !roomMemberEvent->isJoin() && !roomMemberEvent->isLeave()
|
||||
&& !NeoChatConfig::self()->showAvatarUpdate()) {
|
||||
} else if (roomMemberEvent->isAvatarUpdate() && !roomMemberEvent->isJoin() && !roomMemberEvent->isLeave() && !NeoChatConfig::showAvatarUpdate()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -321,7 +320,7 @@ QString NeoChatRoom::lastEventToString(Qt::TextFormat format, bool stripNewlines
|
||||
return roomMembername(event->senderId()) + (event->isStateEvent() ? QLatin1String(" ") : QLatin1String(": "))
|
||||
+ eventToString(*event, format, stripNewlines);
|
||||
}
|
||||
return QLatin1String("");
|
||||
return {};
|
||||
}
|
||||
|
||||
bool NeoChatRoom::isEventHighlighted(const RoomEvent *e) const
|
||||
@@ -765,6 +764,7 @@ QString NeoChatRoom::eventToGenericString(const RoomEvent &evt) const
|
||||
},
|
||||
#ifdef QUOTIENT_07
|
||||
[](const PollStartEvent &e) {
|
||||
Q_UNUSED(e);
|
||||
return i18n("started a poll");
|
||||
},
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user