mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 17:40:47 +03:00
Minor adjustments
This commit is contained in:
parent
a8e17b9c91
commit
8b139c32a3
18 changed files with 37 additions and 37 deletions
|
@ -40,7 +40,7 @@ public:
|
||||||
const QString &roomid,
|
const QString &roomid,
|
||||||
const QString &msg,
|
const QString &msg,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t media_size,
|
uint64_t media_size,
|
||||||
const QString &url = "") noexcept;
|
const QString &url = "") noexcept;
|
||||||
void login(const QString &username, const QString &password) noexcept;
|
void login(const QString &username, const QString &password) noexcept;
|
||||||
void registerUser(const QString &username,
|
void registerUser(const QString &username,
|
||||||
|
@ -116,22 +116,22 @@ signals:
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size);
|
uint64_t size);
|
||||||
void fileUploaded(const QString &roomid,
|
void fileUploaded(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size);
|
uint64_t size);
|
||||||
void audioUploaded(const QString &roomid,
|
void audioUploaded(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size);
|
uint64_t size);
|
||||||
void videoUploaded(const QString &roomid,
|
void videoUploaded(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size);
|
uint64_t size);
|
||||||
void roomAvatarRetrieved(const QString &roomid,
|
void roomAvatarRetrieved(const QString &roomid,
|
||||||
const QPixmap &img,
|
const QPixmap &img,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
|
@ -151,9 +151,9 @@ signals:
|
||||||
void syncCompleted(const mtx::responses::Sync &response);
|
void syncCompleted(const mtx::responses::Sync &response);
|
||||||
void syncFailed(const QString &msg);
|
void syncFailed(const QString &msg);
|
||||||
void joinFailed(const QString &msg);
|
void joinFailed(const QString &msg);
|
||||||
void messageSent(const QString &event_id, const QString &roomid, const int txn_id);
|
void messageSent(const QString &event_id, const QString &roomid, int txn_id);
|
||||||
void messageSendFailed(const QString &roomid, const int txn_id);
|
void messageSendFailed(const QString &roomid, int txn_id);
|
||||||
void emoteSent(const QString &event_id, const QString &roomid, const int txn_id);
|
void emoteSent(const QString &event_id, const QString &roomid, int txn_id);
|
||||||
void messagesRetrieved(const QString &room_id, const mtx::responses::Messages &msgs);
|
void messagesRetrieved(const QString &room_id, const mtx::responses::Messages &msgs);
|
||||||
void joinedRoom(const QString &room_id);
|
void joinedRoom(const QString &room_id);
|
||||||
void leftRoom(const QString &room_id);
|
void leftRoom(const QString &room_id);
|
||||||
|
|
|
@ -25,5 +25,5 @@ firstChar(const QString &input);
|
||||||
|
|
||||||
//! Get a human readable file size with the appropriate units attached.
|
//! Get a human readable file size with the appropriate units attached.
|
||||||
QString
|
QString
|
||||||
humanReadableFileSize(const uint64_t bytes);
|
humanReadableFileSize(uint64_t bytes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void setLabels(const QString &type, const QString &mime, const int upload_size);
|
void setLabels(const QString &type, const QString &mime, uint64_t upload_size);
|
||||||
|
|
||||||
bool isImage_;
|
bool isImage_;
|
||||||
QPixmap image_;
|
QPixmap image_;
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct PendingMessage
|
||||||
QString body;
|
QString body;
|
||||||
QString filename;
|
QString filename;
|
||||||
QString mime;
|
QString mime;
|
||||||
int64_t media_size;
|
uint64_t media_size;
|
||||||
QString event_id;
|
QString event_id;
|
||||||
TimelineItem *widget;
|
TimelineItem *widget;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ struct PendingMessage
|
||||||
QString body,
|
QString body,
|
||||||
QString filename,
|
QString filename,
|
||||||
QString mime,
|
QString mime,
|
||||||
int64_t media_size,
|
uint64_t media_size,
|
||||||
QString event_id,
|
QString event_id,
|
||||||
TimelineItem *widget)
|
TimelineItem *widget)
|
||||||
: ty(ty)
|
: ty(ty)
|
||||||
|
@ -96,7 +96,7 @@ public:
|
||||||
void addUserMessage(const QString &url,
|
void addUserMessage(const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size);
|
uint64_t size);
|
||||||
void updatePendingMessage(int txn_id, QString event_id);
|
void updatePendingMessage(int txn_id, QString event_id);
|
||||||
void scrollDown();
|
void scrollDown();
|
||||||
QLabel *createDateSeparator(QDateTime datetime);
|
QLabel *createDateSeparator(QDateTime datetime);
|
||||||
|
@ -243,7 +243,7 @@ void
|
||||||
TimelineView::addUserMessage(const QString &url,
|
TimelineView::addUserMessage(const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size)
|
uint64_t size)
|
||||||
{
|
{
|
||||||
auto with_sender = lastSender_ != local_user_;
|
auto with_sender = lastSender_ != local_user_;
|
||||||
auto trimmed = QFileInfo{filename}.fileName(); // Trim file path.
|
auto trimmed = QFileInfo{filename}.fileName(); // Trim file path.
|
||||||
|
|
|
@ -67,22 +67,22 @@ public slots:
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t dsize);
|
uint64_t dsize);
|
||||||
void queueFileMessage(const QString &roomid,
|
void queueFileMessage(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t dsize);
|
uint64_t dsize);
|
||||||
void queueAudioMessage(const QString &roomid,
|
void queueAudioMessage(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t dsize);
|
uint64_t dsize);
|
||||||
void queueVideoMessage(const QString &roomid,
|
void queueVideoMessage(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t dsize);
|
uint64_t dsize);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void messageSent(const QString &eventid, const QString &roomid, int txnid);
|
void messageSent(const QString &eventid, const QString &roomid, int txnid);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
AudioItem(QSharedPointer<MatrixClient> client,
|
AudioItem(QSharedPointer<MatrixClient> client,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const int64_t size,
|
uint64_t size,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
FileItem(QSharedPointer<MatrixClient> client,
|
FileItem(QSharedPointer<MatrixClient> client,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const int64_t size,
|
uint64_t size,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
ImageItem(QSharedPointer<MatrixClient> client,
|
ImageItem(QSharedPointer<MatrixClient> client,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const int64_t size,
|
uint64_t size,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
void setImage(const QPixmap &image);
|
void setImage(const QPixmap &image);
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
VideoItem(QSharedPointer<MatrixClient> client,
|
VideoItem(QSharedPointer<MatrixClient> client,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const int64_t size,
|
uint64_t size,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -263,28 +263,28 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
||||||
connect(client_.data(),
|
connect(client_.data(),
|
||||||
&MatrixClient::imageUploaded,
|
&MatrixClient::imageUploaded,
|
||||||
this,
|
this,
|
||||||
[=](QString roomid, QString filename, QString url, QString mime, int64_t dsize) {
|
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||||
text_input_->hideUploadSpinner();
|
text_input_->hideUploadSpinner();
|
||||||
view_manager_->queueImageMessage(roomid, filename, url, mime, dsize);
|
view_manager_->queueImageMessage(roomid, filename, url, mime, dsize);
|
||||||
});
|
});
|
||||||
connect(client_.data(),
|
connect(client_.data(),
|
||||||
&MatrixClient::fileUploaded,
|
&MatrixClient::fileUploaded,
|
||||||
this,
|
this,
|
||||||
[=](QString roomid, QString filename, QString url, QString mime, int64_t dsize) {
|
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||||
text_input_->hideUploadSpinner();
|
text_input_->hideUploadSpinner();
|
||||||
view_manager_->queueFileMessage(roomid, filename, url, mime, dsize);
|
view_manager_->queueFileMessage(roomid, filename, url, mime, dsize);
|
||||||
});
|
});
|
||||||
connect(client_.data(),
|
connect(client_.data(),
|
||||||
&MatrixClient::audioUploaded,
|
&MatrixClient::audioUploaded,
|
||||||
this,
|
this,
|
||||||
[=](QString roomid, QString filename, QString url, QString mime, int64_t dsize) {
|
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||||
text_input_->hideUploadSpinner();
|
text_input_->hideUploadSpinner();
|
||||||
view_manager_->queueAudioMessage(roomid, filename, url, mime, dsize);
|
view_manager_->queueAudioMessage(roomid, filename, url, mime, dsize);
|
||||||
});
|
});
|
||||||
connect(client_.data(),
|
connect(client_.data(),
|
||||||
&MatrixClient::videoUploaded,
|
&MatrixClient::videoUploaded,
|
||||||
this,
|
this,
|
||||||
[=](QString roomid, QString filename, QString url, QString mime, int64_t dsize) {
|
[=](QString roomid, QString filename, QString url, QString mime, uint64_t dsize) {
|
||||||
text_input_->hideUploadSpinner();
|
text_input_->hideUploadSpinner();
|
||||||
view_manager_->queueVideoMessage(roomid, filename, url, mime, dsize);
|
view_manager_->queueVideoMessage(roomid, filename, url, mime, dsize);
|
||||||
});
|
});
|
||||||
|
|
|
@ -281,7 +281,7 @@ MatrixClient::sendRoomMessage(mtx::events::MessageType ty,
|
||||||
const QString &roomid,
|
const QString &roomid,
|
||||||
const QString &msg,
|
const QString &msg,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t media_size,
|
uint64_t media_size,
|
||||||
const QString &url) noexcept
|
const QString &url) noexcept
|
||||||
{
|
{
|
||||||
QUrlQuery query;
|
QUrlQuery query;
|
||||||
|
|
|
@ -135,7 +135,7 @@ utils::firstChar(const QString &input)
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
utils::humanReadableFileSize(const uint64_t bytes)
|
utils::humanReadableFileSize(uint64_t bytes)
|
||||||
{
|
{
|
||||||
constexpr static const char *units[] = {"B", "KiB", "MiB", "GiB", "TiB"};
|
constexpr static const char *units[] = {"B", "KiB", "MiB", "GiB", "TiB"};
|
||||||
constexpr static const int length = sizeof(units) / sizeof(units[0]);
|
constexpr static const int length = sizeof(units) / sizeof(units[0]);
|
||||||
|
|
|
@ -103,7 +103,7 @@ PreviewUploadOverlay::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PreviewUploadOverlay::setLabels(const QString &type, const QString &mime, const int upload_size)
|
PreviewUploadOverlay::setLabels(const QString &type, const QString &mime, uint64_t upload_size)
|
||||||
{
|
{
|
||||||
if (mediaType_ == "image") {
|
if (mediaType_ == "image") {
|
||||||
if (!image_.loadFromData(data_)) {
|
if (!image_.loadFromData(data_)) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ TimelineViewManager::queueImageMessage(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size)
|
uint64_t size)
|
||||||
{
|
{
|
||||||
if (!timelineViewExists(roomid)) {
|
if (!timelineViewExists(roomid)) {
|
||||||
qDebug() << "Cannot send m.image message to a non-managed view";
|
qDebug() << "Cannot send m.image message to a non-managed view";
|
||||||
|
@ -110,7 +110,7 @@ TimelineViewManager::queueFileMessage(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size)
|
uint64_t size)
|
||||||
{
|
{
|
||||||
if (!timelineViewExists(roomid)) {
|
if (!timelineViewExists(roomid)) {
|
||||||
qDebug() << "Cannot send m.file message to a non-managed view";
|
qDebug() << "Cannot send m.file message to a non-managed view";
|
||||||
|
@ -127,7 +127,7 @@ TimelineViewManager::queueAudioMessage(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size)
|
uint64_t size)
|
||||||
{
|
{
|
||||||
if (!timelineViewExists(roomid)) {
|
if (!timelineViewExists(roomid)) {
|
||||||
qDebug() << "Cannot send m.audio message to a non-managed view";
|
qDebug() << "Cannot send m.audio message to a non-managed view";
|
||||||
|
@ -144,7 +144,7 @@ TimelineViewManager::queueVideoMessage(const QString &roomid,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
const int64_t size)
|
uint64_t size)
|
||||||
{
|
{
|
||||||
if (!timelineViewExists(roomid)) {
|
if (!timelineViewExists(roomid)) {
|
||||||
qDebug() << "Cannot send m.video message to a non-managed view";
|
qDebug() << "Cannot send m.video message to a non-managed view";
|
||||||
|
|
|
@ -91,7 +91,7 @@ AudioItem::AudioItem(QSharedPointer<MatrixClient> client,
|
||||||
AudioItem::AudioItem(QSharedPointer<MatrixClient> client,
|
AudioItem::AudioItem(QSharedPointer<MatrixClient> client,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const int64_t size,
|
uint64_t size,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, url_{url}
|
, url_{url}
|
||||||
|
|
|
@ -78,7 +78,7 @@ FileItem::FileItem(QSharedPointer<MatrixClient> client,
|
||||||
FileItem::FileItem(QSharedPointer<MatrixClient> client,
|
FileItem::FileItem(QSharedPointer<MatrixClient> client,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const int64_t size,
|
uint64_t size,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, url_{url}
|
, url_{url}
|
||||||
|
|
|
@ -62,7 +62,7 @@ ImageItem::ImageItem(QSharedPointer<MatrixClient> client,
|
||||||
ImageItem::ImageItem(QSharedPointer<MatrixClient> client,
|
ImageItem::ImageItem(QSharedPointer<MatrixClient> client,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const int64_t size,
|
uint64_t size,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, url_{url}
|
, url_{url}
|
||||||
|
|
|
@ -68,7 +68,7 @@ VideoItem::VideoItem(QSharedPointer<MatrixClient> client,
|
||||||
VideoItem::VideoItem(QSharedPointer<MatrixClient> client,
|
VideoItem::VideoItem(QSharedPointer<MatrixClient> client,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
const int64_t size,
|
uint64_t size,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, url_{url}
|
, url_{url}
|
||||||
|
|
Loading…
Reference in a new issue