This commit is contained in:
Nicolas Werner 2023-06-02 01:37:53 +02:00
parent c25d0c6b2f
commit de8522a185
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
20 changed files with 95 additions and 116 deletions

View file

@ -13,7 +13,6 @@
#include "Cache_p.h"
#include "emoji/Provider.h"
QString
emoji::categoryToName(emoji::Emoji::Category cat)
{
@ -69,7 +68,6 @@ GridImagePackModel::GridImagePackModel(const std::string &roomId, bool stickers,
, room_id(roomId)
, columns(stickers ? 3 : 7)
{
if (!stickers) {
for (const auto &category : {
emoji::Emoji::Category::People,

View file

@ -52,9 +52,7 @@ public:
QImage m_pixmap;
};
class JdenticonProvider
:
public QQuickAsyncImageProvider
class JdenticonProvider : public QQuickAsyncImageProvider
{
Q_OBJECT

View file

@ -5,9 +5,9 @@
#include <QApplication>
#include <QMessageBox>
#include <mtx/events/collections.hpp>
#include <mtx/requests.hpp>
#include <mtx/responses/login.hpp>
#include <mtx/events/collections.hpp>
#include "AliasEditModel.h"
#include "BlurhashProvider.h"
@ -132,8 +132,6 @@ MainWindow::MainWindow(QWindow *parent)
void
MainWindow::registerQmlTypes()
{
qmlRegisterUncreatableMetaObject(qml_mtx_events::staticMetaObject,
"im.nheko",
1,
@ -253,7 +251,6 @@ MainWindow::registerQmlTypes()
qmlRegisterSingletonInstance("im.nheko", 1, 0, "Settings", userSettings_.data());
qmlRegisterUncreatableType<FilteredCommunitiesModel>(
"im.nheko",
1,

View file

@ -15,8 +15,6 @@
#include "nlohmann/json.hpp"
#include <mtx/responses.hpp>
namespace http {
mtx::http::Client *

View file

@ -70,9 +70,7 @@ public:
QImage m_image;
};
class MxcImageProvider
:
public QQuickAsyncImageProvider
class MxcImageProvider : public QQuickAsyncImageProvider
{
Q_OBJECT

View file

@ -20,7 +20,6 @@
#include "timeline/Permissions.h"
#include "timeline/TimelineModel.h"
SingleImagePackModel::SingleImagePackModel(ImagePackInfo pack_, QObject *parent)
: QAbstractListModel(parent)
, roomid_(std::move(pack_.source_room))
@ -29,7 +28,6 @@ SingleImagePackModel::SingleImagePackModel(ImagePackInfo pack_, QObject *parent)
, pack(std::move(pack_.pack))
, fromSpace_(pack_.from_space)
{
if (!pack.pack)
pack.pack = mtx::events::msc2545::ImagePack::PackDescription{};

View file

@ -337,8 +337,10 @@ main(int argc, char *argv[])
app.installTranslator(&qtTranslator);
QTranslator appTranslator;
if(appTranslator.load(
QLocale(), QStringLiteral("nheko"), QStringLiteral("_"), QStringLiteral(":/translations")))
if (appTranslator.load(QLocale(),
QStringLiteral("nheko"),
QStringLiteral("_"),
QStringLiteral(":/translations")))
app.installTranslator(&appTranslator);
MainWindow w;

View file

@ -17,7 +17,6 @@
#include "Utils.h"
#include "timeline/TimelineModel.h"
CommunitiesModel::CommunitiesModel(QObject *parent)
: QAbstractListModel(parent)
, hiddenTagIds_{UserSettings::instance()->hiddenTags()}

View file

@ -18,7 +18,6 @@
#include "UserSettingsPage.h"
#include "Utils.h"
QCache<EventStore::IdIndex, olm::DecryptionResult> EventStore::decryptedEvents_{1000};
QCache<EventStore::IdIndex, mtx::events::collections::TimelineEvents> EventStore::events_by_id_{
1000};
@ -27,7 +26,6 @@ QCache<EventStore::Index, mtx::events::collections::TimelineEvents> EventStore::
EventStore::EventStore(std::string room_id, QObject *)
: room_id_(std::move(room_id))
{
auto range = cache::client()->getTimelineRange(room_id_);
if (range) {

View file

@ -11,10 +11,10 @@
#include <QObject>
#include <QVariant>
#include <mtx/common.hpp>
#include <mtx/events/collections.hpp>
#include <mtx/responses/messages.hpp>
#include <mtx/responses/sync.hpp>
#include <mtx/common.hpp>
#include "Reaction.h"
#include "encryption/Olm.h"

View file

@ -994,18 +994,21 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
if (mimeClass_ == u"video") {
auto newSurface = new QVideoSink(this);
connect(
newSurface, &QVideoSink::videoFrameChanged, this, [this, mediaPlayer](const QVideoFrame& frame) {
connect(newSurface,
&QVideoSink::videoFrameChanged,
this,
[this, mediaPlayer](const QVideoFrame &frame) {
QImage img = frame.toImage();
if (img.size().isEmpty())
return;
mediaPlayer->stop();
auto orientation = mediaPlayer->metaData().value(QMediaMetaData::Orientation).toInt();
auto orientation =
mediaPlayer->metaData().value(QMediaMetaData::Orientation).toInt();
if (orientation == 90 || orientation == 270 || orientation == 180) {
img =
img.transformed(QTransform().rotate(orientation), Qt::SmoothTransformation);
img = img.transformed(QTransform().rotate(orientation),
Qt::SmoothTransformation);
}
nhlog::ui()->debug("Got image {}x{}", img.width(), img.height());
@ -1036,9 +1039,8 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
&QMediaPlayer::errorOccurred,
this,
[](QMediaPlayer::Error error, QString errorString) {
nhlog::ui()->debug("Media player error {} and errorStr {}",
error,
errorString.toStdString());
nhlog::ui()->debug(
"Media player error {} and errorStr {}", error, errorString.toStdString());
});
connect(mediaPlayer,
&QMediaPlayer::mediaStatusChanged,
@ -1046,10 +1048,7 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
nhlog::ui()->debug(
"Media player status {} and error {}", status, mediaPlayer->error());
});
connect(mediaPlayer,
&QMediaPlayer::metaDataChanged,
this,
[this, mediaPlayer]() {
connect(mediaPlayer, &QMediaPlayer::metaDataChanged, this, [this, mediaPlayer]() {
nhlog::ui()->debug("Got metadata {}");
if (mediaPlayer->duration() > 0)
@ -1077,8 +1076,8 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
auto originalFile = qobject_cast<QFile *>(source.get());
mediaPlayer->setSourceDevice(source.get(),
QUrl(originalFile ? originalFile->fileName() : originalFilename_));
mediaPlayer->setSourceDevice(
source.get(), QUrl(originalFile ? originalFile->fileName() : originalFilename_));
mediaPlayer->play();
}

View file

@ -28,7 +28,6 @@ RoomlistModel::RoomlistModel(TimelineViewManager *parent)
: QAbstractListModel(parent)
, manager(parent)
{
connect(ChatPage::instance(), &ChatPage::decryptSidebarChanged, this, [this]() {
auto decrypt = ChatPage::instance()->userSettings()->decryptSidebar();
QHash<QString, QSharedPointer<TimelineModel>>::iterator i;

View file

@ -31,7 +31,6 @@
#include "Utils.h"
#include "encryption/Olm.h"
namespace std {
inline uint // clazy:exclude=qhash-namespace
qHash(const std::string &key, uint seed = 0)

View file

@ -25,22 +25,15 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent)
{
connect(this, &MxcMediaProxy::eventIdChanged, &MxcMediaProxy::startDownload);
connect(this, &MxcMediaProxy::roomChanged, &MxcMediaProxy::startDownload);
connect(this,
&QMediaPlayer::errorOccurred,
this,
[](QMediaPlayer::Error error, QString errorString) {
nhlog::ui()->debug("Media player error {} and errorStr {}",
error,
errorString.toStdString());
connect(
this, &QMediaPlayer::errorOccurred, this, [](QMediaPlayer::Error error, QString errorString) {
nhlog::ui()->debug(
"Media player error {} and errorStr {}", error, errorString.toStdString());
});
connect(this, &MxcMediaProxy::mediaStatusChanged, [this](QMediaPlayer::MediaStatus status) {
nhlog::ui()->info("Media player status {} and error {}", status, this->error());
});
connect(this,
&MxcMediaProxy::metaDataChanged,
[this]() {
emit orientationChanged();
});
connect(this, &MxcMediaProxy::metaDataChanged, [this]() { emit orientationChanged(); });
connect(ChatPage::instance()->timelineManager()->rooms(),
&RoomlistModel::currentRoomChanged,
@ -51,7 +44,8 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent)
int
MxcMediaProxy::orientation() const
{
//nhlog::ui()->debug("metadata: {}", availableMetaData().join(QStringLiteral(",")).toStdString());
// nhlog::ui()->debug("metadata: {}",
// availableMetaData().join(QStringLiteral(",")).toStdString());
auto orientation = metaData().value(QMediaMetaData::Orientation).toInt();
nhlog::ui()->debug("Video orientation: {}", orientation);
return orientation;

View file

@ -4,13 +4,13 @@
#pragma once
#include <QVideoSink>
#include <QBuffer>
#include <QUrl>
#include <QMediaPlayer>
#include <QObject>
#include <QPointer>
#include <QString>
#include <QUrl>
#include <QVideoSink>
#include "Logging.h"

View file

@ -5,8 +5,8 @@
#include "NhekoGlobalObject.h"
#include <QApplication>
#include <QGuiApplication>
#include <QDesktopServices>
#include <QGuiApplication>
#include <QStyle>
#include <QUrl>
#include <QWindow>
@ -184,9 +184,11 @@ Nheko::createRoom(bool space,
void
Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString newRole) const
{
const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
const QNativeInterface::QX11Application *x11Interface =
qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
if (!x11Interface) return;
if (!x11Interface)
return;
auto connection = x11Interface->connection();
@ -198,7 +200,12 @@ Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString new
auto atom = reply->atom;
free(reply);
xcb_change_property(connection, XCB_PROP_MODE_REPLACE, win->winId(),
atom, XCB_ATOM_STRING, 8,
role.size(), role.data());
xcb_change_property(connection,
XCB_PROP_MODE_REPLACE,
win->winId(),
atom,
XCB_ATOM_STRING,
8,
role.size(),
role.data());
}

View file

@ -4,7 +4,6 @@
#include "Theme.h"
QPalette
Theme::paletteFromTheme(QStringView theme)
{

View file

@ -41,7 +41,6 @@ extern "C"
}
#endif
using namespace mtx::events;
using namespace mtx::events::voip;
@ -60,7 +59,6 @@ CallManager::CallManager(QObject *parent)
, session_(WebRTCSession::instance())
, turnServerTimer_(this)
{
#ifdef GSTREAMER_AVAILABLE
std::string errorMessage;
if (session_.havePlugins(true, true, ScreenShareType::XDP, &errorMessage)) {
@ -186,7 +184,8 @@ CallManager::CallManager(QObject *parent)
nhlog::ui()->error("WebRTC: access to ringtone file denied");
break;
default:
nhlog::ui()->error("WebRTC: unable to play ringtone, {}", errorString.toStdString());
nhlog::ui()->error("WebRTC: unable to play ringtone, {}",
errorString.toStdString());
break;
}
});
@ -820,8 +819,7 @@ CallManager::retrieveTurnServer()
void
CallManager::playRingtone(const QUrl &ringtone, bool repeat)
{
player_.setLoops(repeat ? QMediaPlayer::Infinite :
1);
player_.setLoops(repeat ? QMediaPlayer::Infinite : 1);
player_.setSource(ringtone);
// player_.audioOutput()->setVolume(100);
player_.play();

View file

@ -438,7 +438,6 @@ struct PipeWireStream
QVariantMap map;
};
const QDBusArgument &
operator>>(const QDBusArgument &argument, PipeWireStream &stream)
{

View file

@ -41,7 +41,6 @@ extern "C"
// https://github.com/vector-im/riot-web/issues/10173
#define STUN_SERVER "stun://turn.matrix.org:3478"
using webrtc::CallType;
using webrtc::ScreenShareType;
using webrtc::State;