Fix roomlist "jumping around".
Remove custom DPI code from main.cpp. Hide redacted event in roomlist.
This commit is contained in:
12
src/main.cpp
12
src/main.cpp
@@ -26,18 +26,6 @@
|
||||
using namespace QMatrixClient;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN) || defined(Q_OS_FREEBSD)
|
||||
if (qgetenv("QT_SCALE_FACTOR").size() == 0) {
|
||||
QSettings settings("ENCOM", "Spectral");
|
||||
float factor = settings.value("Interface/dpi", 100).toFloat() / 100;
|
||||
|
||||
qDebug() << "DPI:" << factor;
|
||||
|
||||
if (factor != -1)
|
||||
qputenv("QT_SCALE_FACTOR", QString::number(factor).toUtf8());
|
||||
}
|
||||
#endif
|
||||
|
||||
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
|
||||
@@ -107,12 +107,26 @@ void SpectralRoom::sendTypingNotification(bool isTyping) {
|
||||
}
|
||||
|
||||
QString SpectralRoom::lastEvent() {
|
||||
if (timelineSize() == 0)
|
||||
return "";
|
||||
const RoomEvent* lastEvent = messageEvents().rbegin()->get();
|
||||
return user(lastEvent->senderId())->displayname() +
|
||||
(lastEvent->isStateEvent() ? " " : ": ") +
|
||||
utils::removeReply(eventToString(*lastEvent));
|
||||
for (auto i = messageEvents().rbegin(); i < messageEvents().rend(); i++) {
|
||||
const RoomEvent* evt = i->get();
|
||||
|
||||
if (is<RedactionEvent>(*evt))
|
||||
continue;
|
||||
if (evt->isRedacted())
|
||||
continue;
|
||||
|
||||
if (evt->isStateEvent() &&
|
||||
static_cast<const StateEventBase*>(evt)->repeatsState())
|
||||
continue;
|
||||
|
||||
if (connection()->isIgnored(user(evt->senderId())))
|
||||
continue;
|
||||
|
||||
return user(evt->senderId())->displayname() +
|
||||
(evt->isStateEvent() ? " " : ": ") +
|
||||
utils::removeReply(eventToString(*evt));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
bool SpectralRoom::isEventHighlighted(const RoomEvent* e) const {
|
||||
|
||||
Reference in New Issue
Block a user