QMatrixClient -> Quotient
This commit is contained in:
@@ -46,6 +46,9 @@ find_package(Qt5 5.12 REQUIRED Widgets Network Quick Qml Gui Svg Multimedia)
|
|||||||
if(LINUX)
|
if(LINUX)
|
||||||
find_package(Qt5DBus REQUIRED)
|
find_package(Qt5DBus REQUIRED)
|
||||||
endif(LINUX)
|
endif(LINUX)
|
||||||
|
if (APPLE)
|
||||||
|
find_package(Qt5MacExtras REQUIRED)
|
||||||
|
endif(APPLE)
|
||||||
# Qt5_Prefix is only used to show Qt path in message()
|
# Qt5_Prefix is only used to show Qt path in message()
|
||||||
# Qt5_BinDir is where all the binary tools for Qt are
|
# Qt5_BinDir is where all the binary tools for Qt are
|
||||||
if (QT_QMAKE_EXECUTABLE)
|
if (QT_QMAKE_EXECUTABLE)
|
||||||
@@ -79,7 +82,7 @@ endif ()
|
|||||||
if (NOT USE_INTREE_LIBQMC)
|
if (NOT USE_INTREE_LIBQMC)
|
||||||
find_package(Quotient 0.6 REQUIRED)
|
find_package(Quotient 0.6 REQUIRED)
|
||||||
if (NOT Quotient_FOUND)
|
if (NOT Quotient_FOUND)
|
||||||
message( WARNING "libQMatrixClient not found; configuration will most likely fail.")
|
message( WARNING "libQuotient not found; configuration will most likely fail.")
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
@@ -110,7 +113,7 @@ endif()
|
|||||||
message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
|
message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
|
||||||
message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" )
|
message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" )
|
||||||
if (USE_INTREE_LIBQMC)
|
if (USE_INTREE_LIBQMC)
|
||||||
message( STATUS "Using in-tree libQMatrixClient")
|
message( STATUS "Using in-tree libQuotient")
|
||||||
if (GIT_FOUND)
|
if (GIT_FOUND)
|
||||||
execute_process(COMMAND
|
execute_process(COMMAND
|
||||||
"${GIT_EXECUTABLE}" rev-parse -q HEAD
|
"${GIT_EXECUTABLE}" rev-parse -q HEAD
|
||||||
@@ -120,7 +123,7 @@ if (USE_INTREE_LIBQMC)
|
|||||||
message( STATUS " Library git SHA1: ${LIB_GIT_SHA1}")
|
message( STATUS " Library git SHA1: ${LIB_GIT_SHA1}")
|
||||||
endif (GIT_FOUND)
|
endif (GIT_FOUND)
|
||||||
else ()
|
else ()
|
||||||
message( STATUS "Using libQMatrixClient ${Quotient_VERSION} at ${Quotient_DIR}")
|
message( STATUS "Using libQuotient ${Quotient_VERSION} at ${Quotient_DIR}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
message( STATUS "=============================================================================" )
|
message( STATUS "=============================================================================" )
|
||||||
@@ -209,7 +212,9 @@ target_link_libraries(${PROJECT_NAME}
|
|||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
GIT_SHA1="${GIT_SHA1}" LIB_GIT_SHA1="${LIB_GIT_SHA1}")
|
GIT_SHA1="${GIT_SHA1}" LIB_GIT_SHA1="${LIB_GIT_SHA1}")
|
||||||
|
|
||||||
if(LINUX)
|
if (APPLE)
|
||||||
|
target_link_libraries(${PROJECT_NAME} Qt5::MacExtras)
|
||||||
|
elseif(LINUX)
|
||||||
target_link_libraries(${PROJECT_NAME} Qt5::DBus)
|
target_link_libraries(${PROJECT_NAME} Qt5::DBus)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Submodule include/libQuotient updated: de378851ef...fadce11be9
@@ -10,14 +10,14 @@
|
|||||||
#include <QtCore/QAtomicPointer>
|
#include <QtCore/QAtomicPointer>
|
||||||
#include <QtCore/QReadWriteLock>
|
#include <QtCore/QReadWriteLock>
|
||||||
|
|
||||||
namespace QMatrixClient {
|
namespace Quotient {
|
||||||
class Connection;
|
class Connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ThumbnailResponse : public QQuickImageResponse {
|
class ThumbnailResponse : public QQuickImageResponse {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ThumbnailResponse(QMatrixClient::Connection* c,
|
ThumbnailResponse(Quotient::Connection* c,
|
||||||
QString mediaId,
|
QString mediaId,
|
||||||
const QSize& requestedSize);
|
const QSize& requestedSize);
|
||||||
~ThumbnailResponse() override = default;
|
~ThumbnailResponse() override = default;
|
||||||
@@ -28,11 +28,11 @@ class ThumbnailResponse : public QQuickImageResponse {
|
|||||||
void doCancel();
|
void doCancel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMatrixClient::Connection* c;
|
Quotient::Connection* c;
|
||||||
const QString mediaId;
|
const QString mediaId;
|
||||||
const QSize requestedSize;
|
const QSize requestedSize;
|
||||||
const QString localFile;
|
const QString localFile;
|
||||||
QMatrixClient::MediaThumbnailJob* job = nullptr;
|
Quotient::MediaThumbnailJob* job = nullptr;
|
||||||
|
|
||||||
QImage image;
|
QImage image;
|
||||||
QString errorStr;
|
QString errorStr;
|
||||||
@@ -45,7 +45,7 @@ class ThumbnailResponse : public QQuickImageResponse {
|
|||||||
|
|
||||||
class MatrixImageProvider : public QObject, public QQuickAsyncImageProvider {
|
class MatrixImageProvider : public QObject, public QQuickAsyncImageProvider {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QMatrixClient::Connection* connection READ connection WRITE
|
Q_PROPERTY(Quotient::Connection* connection READ connection WRITE
|
||||||
setConnection NOTIFY connectionChanged)
|
setConnection NOTIFY connectionChanged)
|
||||||
public:
|
public:
|
||||||
explicit MatrixImageProvider() = default;
|
explicit MatrixImageProvider() = default;
|
||||||
@@ -54,8 +54,8 @@ class MatrixImageProvider : public QObject, public QQuickAsyncImageProvider {
|
|||||||
const QString& id,
|
const QString& id,
|
||||||
const QSize& requestedSize) override;
|
const QSize& requestedSize) override;
|
||||||
|
|
||||||
QMatrixClient::Connection* connection() { return m_connection; }
|
Quotient::Connection* connection() { return m_connection; }
|
||||||
void setConnection(QMatrixClient::Connection* connection) {
|
void setConnection(Quotient::Connection* connection) {
|
||||||
m_connection.store(connection);
|
m_connection.store(connection);
|
||||||
emit connectionChanged();
|
emit connectionChanged();
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ class MatrixImageProvider : public QObject, public QQuickAsyncImageProvider {
|
|||||||
void connectionChanged();
|
void connectionChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAtomicPointer<QMatrixClient::Connection> m_connection;
|
QAtomicPointer<Quotient::Connection> m_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MatrixImageProvider_H
|
#endif // MatrixImageProvider_H
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
NotificationsManager::NotificationsManager(QObject* parent) : QObject(parent) {
|
NotificationsManager::NotificationsManager(QObject* parent) : QObject(parent) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotificationsManager::postNotification(const QString& roomId,
|
void NotificationsManager::postNotification(const QString& roomId,
|
||||||
const QString& eventId,
|
const QString& eventId,
|
||||||
@@ -20,35 +18,40 @@ void NotificationsManager::postNotification(const QString& roomId,
|
|||||||
|
|
||||||
UNUserNotificationCenter* center =
|
UNUserNotificationCenter* center =
|
||||||
[UNUserNotificationCenter currentNotificationCenter];
|
[UNUserNotificationCenter currentNotificationCenter];
|
||||||
UNAuthorizationOptions options = UNAuthorizationOptionAlert + UNAuthorizationOptionSound;
|
UNAuthorizationOptions options =
|
||||||
|
UNAuthorizationOptionAlert + UNAuthorizationOptionSound;
|
||||||
|
|
||||||
[center requestAuthorizationWithOptions:options
|
[center requestAuthorizationWithOptions:options
|
||||||
completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
completionHandler:^(BOOL granted,
|
||||||
if (!granted) {
|
NSError* _Nullable error) {
|
||||||
NSLog(@"Something went wrong");
|
if (!granted) {
|
||||||
}
|
NSLog(@"Something went wrong");
|
||||||
}];
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:300
|
UNTimeIntervalNotificationTrigger* trigger =
|
||||||
repeats:NO];
|
[UNTimeIntervalNotificationTrigger triggerWithTimeInterval:0 repeats:NO];
|
||||||
|
|
||||||
UNMutableNotificationContent *content = [UNMutableNotificationContent new];
|
UNMutableNotificationContent* content = [UNMutableNotificationContent new];
|
||||||
|
|
||||||
content.title = roomName.toNSString();
|
content.title = roomName.toNSString();
|
||||||
content.subtitle = QString("%1 sent a message").arg(senderName).toNSString();
|
content.subtitle = QString("%1 sent a message").arg(senderName).toNSString();
|
||||||
content.body = text.toNSString();
|
content.body = text.toNSString();
|
||||||
content.sound = [UNNotificationSound defaultSound];
|
content.sound = [UNNotificationSound defaultSound];
|
||||||
|
|
||||||
NSString *identifier = QApplication::applicationName().toNSString();
|
NSString* identifier = QApplication::applicationName().toNSString();
|
||||||
|
|
||||||
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:identifier
|
UNNotificationRequest* request =
|
||||||
content:content trigger:trigger];
|
[UNNotificationRequest requestWithIdentifier:identifier
|
||||||
|
content:content
|
||||||
|
trigger:trigger];
|
||||||
|
|
||||||
[center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
|
[center addNotificationRequest:request
|
||||||
if (error != nil) {
|
withCompletionHandler:^(NSError* _Nullable error) {
|
||||||
NSLog(@"Something went wrong: %@",error);
|
if (error != nil) {
|
||||||
}
|
NSLog(@"Something went wrong: %@", error);
|
||||||
}];
|
}
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
// unused
|
// unused
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QAbstractListModel>
|
#include <QtCore/QAbstractListModel>
|
||||||
|
|
||||||
using namespace QMatrixClient;
|
using namespace Quotient;
|
||||||
|
|
||||||
class RoomType : public QObject {
|
class RoomType : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -21,7 +21,7 @@ class RoomType : public QObject {
|
|||||||
Normal,
|
Normal,
|
||||||
Deprioritized,
|
Deprioritized,
|
||||||
};
|
};
|
||||||
REGISTER_ENUM(Types)
|
Q_ENUMS(Types)
|
||||||
};
|
};
|
||||||
|
|
||||||
class RoomListModel : public QAbstractListModel {
|
class RoomListModel : public QAbstractListModel {
|
||||||
|
|||||||
@@ -263,7 +263,6 @@ QString SpectralRoom::eventToString(const RoomEvent& evt,
|
|||||||
case MembershipType::Invite:
|
case MembershipType::Invite:
|
||||||
if (e.repeatsState())
|
if (e.repeatsState())
|
||||||
return tr("reinvited %1 to the room").arg(subjectName);
|
return tr("reinvited %1 to the room").arg(subjectName);
|
||||||
FALLTHROUGH;
|
|
||||||
case MembershipType::Join: {
|
case MembershipType::Join: {
|
||||||
if (e.repeatsState())
|
if (e.repeatsState())
|
||||||
return tr("joined the room (repeated)");
|
return tr("joined the room (repeated)");
|
||||||
|
|||||||
@@ -6,16 +6,16 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtCore/QAbstractListModel>
|
#include <QtCore/QAbstractListModel>
|
||||||
|
|
||||||
namespace QMatrixClient {
|
namespace Quotient {
|
||||||
class Connection;
|
class Connection;
|
||||||
class Room;
|
class Room;
|
||||||
class User;
|
class User;
|
||||||
} // namespace QMatrixClient
|
} // namespace Quotient
|
||||||
|
|
||||||
class UserListModel : public QAbstractListModel {
|
class UserListModel : public QAbstractListModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(
|
Q_PROPERTY(
|
||||||
QMatrixClient::Room* room READ room WRITE setRoom NOTIFY roomChanged)
|
Quotient::Room* room READ room WRITE setRoom NOTIFY roomChanged)
|
||||||
public:
|
public:
|
||||||
enum EventRoles {
|
enum EventRoles {
|
||||||
NameRole = Qt::UserRole + 1,
|
NameRole = Qt::UserRole + 1,
|
||||||
@@ -24,12 +24,12 @@ class UserListModel : public QAbstractListModel {
|
|||||||
ObjectRole
|
ObjectRole
|
||||||
};
|
};
|
||||||
|
|
||||||
using User = QMatrixClient::User;
|
using User = Quotient::User;
|
||||||
|
|
||||||
UserListModel(QObject* parent = nullptr);
|
UserListModel(QObject* parent = nullptr);
|
||||||
|
|
||||||
QMatrixClient::Room* room() const { return m_currentRoom; }
|
Quotient::Room* room() const { return m_currentRoom; }
|
||||||
void setRoom(QMatrixClient::Room* room);
|
void setRoom(Quotient::Room* room);
|
||||||
User* userAt(QModelIndex index) const;
|
User* userAt(QModelIndex index) const;
|
||||||
|
|
||||||
QVariant data(const QModelIndex& index, int role = NameRole) const override;
|
QVariant data(const QModelIndex& index, int role = NameRole) const override;
|
||||||
@@ -44,10 +44,10 @@ class UserListModel : public QAbstractListModel {
|
|||||||
void userAdded(User* user);
|
void userAdded(User* user);
|
||||||
void userRemoved(User* user);
|
void userRemoved(User* user);
|
||||||
void refresh(User* user, QVector<int> roles = {});
|
void refresh(User* user, QVector<int> roles = {});
|
||||||
void avatarChanged(User* user, const QMatrixClient::Room* context);
|
void avatarChanged(User* user, const Quotient::Room* context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMatrixClient::Room* m_currentRoom;
|
Quotient::Room* m_currentRoom;
|
||||||
QList<User*> m_users;
|
QList<User*> m_users;
|
||||||
|
|
||||||
int findUserPos(User* user) const;
|
int findUserPos(User* user) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user