QMatrixClient -> Quotient
This commit is contained in:
@@ -10,14 +10,14 @@
|
||||
#include <QtCore/QAtomicPointer>
|
||||
#include <QtCore/QReadWriteLock>
|
||||
|
||||
namespace QMatrixClient {
|
||||
namespace Quotient {
|
||||
class Connection;
|
||||
}
|
||||
|
||||
class ThumbnailResponse : public QQuickImageResponse {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ThumbnailResponse(QMatrixClient::Connection* c,
|
||||
ThumbnailResponse(Quotient::Connection* c,
|
||||
QString mediaId,
|
||||
const QSize& requestedSize);
|
||||
~ThumbnailResponse() override = default;
|
||||
@@ -28,11 +28,11 @@ class ThumbnailResponse : public QQuickImageResponse {
|
||||
void doCancel();
|
||||
|
||||
private:
|
||||
QMatrixClient::Connection* c;
|
||||
Quotient::Connection* c;
|
||||
const QString mediaId;
|
||||
const QSize requestedSize;
|
||||
const QString localFile;
|
||||
QMatrixClient::MediaThumbnailJob* job = nullptr;
|
||||
Quotient::MediaThumbnailJob* job = nullptr;
|
||||
|
||||
QImage image;
|
||||
QString errorStr;
|
||||
@@ -45,7 +45,7 @@ class ThumbnailResponse : public QQuickImageResponse {
|
||||
|
||||
class MatrixImageProvider : public QObject, public QQuickAsyncImageProvider {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QMatrixClient::Connection* connection READ connection WRITE
|
||||
Q_PROPERTY(Quotient::Connection* connection READ connection WRITE
|
||||
setConnection NOTIFY connectionChanged)
|
||||
public:
|
||||
explicit MatrixImageProvider() = default;
|
||||
@@ -54,8 +54,8 @@ class MatrixImageProvider : public QObject, public QQuickAsyncImageProvider {
|
||||
const QString& id,
|
||||
const QSize& requestedSize) override;
|
||||
|
||||
QMatrixClient::Connection* connection() { return m_connection; }
|
||||
void setConnection(QMatrixClient::Connection* connection) {
|
||||
Quotient::Connection* connection() { return m_connection; }
|
||||
void setConnection(Quotient::Connection* connection) {
|
||||
m_connection.store(connection);
|
||||
emit connectionChanged();
|
||||
}
|
||||
@@ -64,7 +64,7 @@ class MatrixImageProvider : public QObject, public QQuickAsyncImageProvider {
|
||||
void connectionChanged();
|
||||
|
||||
private:
|
||||
QAtomicPointer<QMatrixClient::Connection> m_connection;
|
||||
QAtomicPointer<Quotient::Connection> m_connection;
|
||||
};
|
||||
|
||||
#endif // MatrixImageProvider_H
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
NotificationsManager::NotificationsManager(QObject* parent) : QObject(parent) {
|
||||
|
||||
}
|
||||
NotificationsManager::NotificationsManager(QObject* parent) : QObject(parent) {}
|
||||
|
||||
void NotificationsManager::postNotification(const QString& roomId,
|
||||
const QString& eventId,
|
||||
@@ -20,35 +18,40 @@ void NotificationsManager::postNotification(const QString& roomId,
|
||||
|
||||
UNUserNotificationCenter* center =
|
||||
[UNUserNotificationCenter currentNotificationCenter];
|
||||
UNAuthorizationOptions options = UNAuthorizationOptionAlert + UNAuthorizationOptionSound;
|
||||
UNAuthorizationOptions options =
|
||||
UNAuthorizationOptionAlert + UNAuthorizationOptionSound;
|
||||
|
||||
[center requestAuthorizationWithOptions:options
|
||||
completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
||||
if (!granted) {
|
||||
NSLog(@"Something went wrong");
|
||||
}
|
||||
}];
|
||||
completionHandler:^(BOOL granted,
|
||||
NSError* _Nullable error) {
|
||||
if (!granted) {
|
||||
NSLog(@"Something went wrong");
|
||||
}
|
||||
}];
|
||||
|
||||
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:300
|
||||
repeats:NO];
|
||||
UNTimeIntervalNotificationTrigger* trigger =
|
||||
[UNTimeIntervalNotificationTrigger triggerWithTimeInterval:0 repeats:NO];
|
||||
|
||||
UNMutableNotificationContent *content = [UNMutableNotificationContent new];
|
||||
UNMutableNotificationContent* content = [UNMutableNotificationContent new];
|
||||
|
||||
content.title = roomName.toNSString();
|
||||
content.subtitle = QString("%1 sent a message").arg(senderName).toNSString();
|
||||
content.body = text.toNSString();
|
||||
content.sound = [UNNotificationSound defaultSound];
|
||||
|
||||
NSString *identifier = QApplication::applicationName().toNSString();
|
||||
NSString* identifier = QApplication::applicationName().toNSString();
|
||||
|
||||
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:identifier
|
||||
content:content trigger:trigger];
|
||||
UNNotificationRequest* request =
|
||||
[UNNotificationRequest requestWithIdentifier:identifier
|
||||
content:content
|
||||
trigger:trigger];
|
||||
|
||||
[center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
|
||||
if (error != nil) {
|
||||
NSLog(@"Something went wrong: %@",error);
|
||||
}
|
||||
}];
|
||||
[center addNotificationRequest:request
|
||||
withCompletionHandler:^(NSError* _Nullable error) {
|
||||
if (error != nil) {
|
||||
NSLog(@"Something went wrong: %@", error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
// unused
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <QtCore/QAbstractListModel>
|
||||
|
||||
using namespace QMatrixClient;
|
||||
using namespace Quotient;
|
||||
|
||||
class RoomType : public QObject {
|
||||
Q_OBJECT
|
||||
@@ -21,7 +21,7 @@ class RoomType : public QObject {
|
||||
Normal,
|
||||
Deprioritized,
|
||||
};
|
||||
REGISTER_ENUM(Types)
|
||||
Q_ENUMS(Types)
|
||||
};
|
||||
|
||||
class RoomListModel : public QAbstractListModel {
|
||||
|
||||
@@ -263,7 +263,6 @@ QString SpectralRoom::eventToString(const RoomEvent& evt,
|
||||
case MembershipType::Invite:
|
||||
if (e.repeatsState())
|
||||
return tr("reinvited %1 to the room").arg(subjectName);
|
||||
FALLTHROUGH;
|
||||
case MembershipType::Join: {
|
||||
if (e.repeatsState())
|
||||
return tr("joined the room (repeated)");
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
#include <QObject>
|
||||
#include <QtCore/QAbstractListModel>
|
||||
|
||||
namespace QMatrixClient {
|
||||
namespace Quotient {
|
||||
class Connection;
|
||||
class Room;
|
||||
class User;
|
||||
} // namespace QMatrixClient
|
||||
} // namespace Quotient
|
||||
|
||||
class UserListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(
|
||||
QMatrixClient::Room* room READ room WRITE setRoom NOTIFY roomChanged)
|
||||
Quotient::Room* room READ room WRITE setRoom NOTIFY roomChanged)
|
||||
public:
|
||||
enum EventRoles {
|
||||
NameRole = Qt::UserRole + 1,
|
||||
@@ -24,12 +24,12 @@ class UserListModel : public QAbstractListModel {
|
||||
ObjectRole
|
||||
};
|
||||
|
||||
using User = QMatrixClient::User;
|
||||
using User = Quotient::User;
|
||||
|
||||
UserListModel(QObject* parent = nullptr);
|
||||
|
||||
QMatrixClient::Room* room() const { return m_currentRoom; }
|
||||
void setRoom(QMatrixClient::Room* room);
|
||||
Quotient::Room* room() const { return m_currentRoom; }
|
||||
void setRoom(Quotient::Room* room);
|
||||
User* userAt(QModelIndex index) const;
|
||||
|
||||
QVariant data(const QModelIndex& index, int role = NameRole) const override;
|
||||
@@ -44,10 +44,10 @@ class UserListModel : public QAbstractListModel {
|
||||
void userAdded(User* user);
|
||||
void userRemoved(User* user);
|
||||
void refresh(User* user, QVector<int> roles = {});
|
||||
void avatarChanged(User* user, const QMatrixClient::Room* context);
|
||||
void avatarChanged(User* user, const Quotient::Room* context);
|
||||
|
||||
private:
|
||||
QMatrixClient::Room* m_currentRoom;
|
||||
Quotient::Room* m_currentRoom;
|
||||
QList<User*> m_users;
|
||||
|
||||
int findUserPos(User* user) const;
|
||||
|
||||
Reference in New Issue
Block a user