From 8b139c32a3b4a92e32a4737b599cf14e61b8a096 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Mon, 19 Feb 2018 22:09:21 +0200 Subject: [PATCH] Minor adjustments --- include/MatrixClient.h | 16 ++++++++-------- include/Utils.h | 2 +- include/dialogs/PreviewUploadOverlay.h | 2 +- include/timeline/TimelineView.h | 8 ++++---- include/timeline/TimelineViewManager.h | 8 ++++---- include/timeline/widgets/AudioItem.h | 2 +- include/timeline/widgets/FileItem.h | 2 +- include/timeline/widgets/ImageItem.h | 2 +- include/timeline/widgets/VideoItem.h | 2 +- src/ChatPage.cc | 8 ++++---- src/MatrixClient.cc | 2 +- src/Utils.cc | 2 +- src/dialogs/PreviewUploadOverlay.cc | 2 +- src/timeline/TimelineViewManager.cc | 8 ++++---- src/timeline/widgets/AudioItem.cc | 2 +- src/timeline/widgets/FileItem.cc | 2 +- src/timeline/widgets/ImageItem.cc | 2 +- src/timeline/widgets/VideoItem.cc | 2 +- 18 files changed, 37 insertions(+), 37 deletions(-) diff --git a/include/MatrixClient.h b/include/MatrixClient.h index 03cd866..91e6db2 100644 --- a/include/MatrixClient.h +++ b/include/MatrixClient.h @@ -40,7 +40,7 @@ public: const QString &roomid, const QString &msg, const QString &mime, - const int64_t media_size, + uint64_t media_size, const QString &url = "") noexcept; void login(const QString &username, const QString &password) noexcept; void registerUser(const QString &username, @@ -116,22 +116,22 @@ signals: const QString &filename, const QString &url, const QString &mime, - const int64_t size); + uint64_t size); void fileUploaded(const QString &roomid, const QString &filename, const QString &url, const QString &mime, - const int64_t size); + uint64_t size); void audioUploaded(const QString &roomid, const QString &filename, const QString &url, const QString &mime, - const int64_t size); + uint64_t size); void videoUploaded(const QString &roomid, const QString &filename, const QString &url, const QString &mime, - const int64_t size); + uint64_t size); void roomAvatarRetrieved(const QString &roomid, const QPixmap &img, const QString &url, @@ -151,9 +151,9 @@ signals: void syncCompleted(const mtx::responses::Sync &response); void syncFailed(const QString &msg); void joinFailed(const QString &msg); - void messageSent(const QString &event_id, const QString &roomid, const int txn_id); - void messageSendFailed(const QString &roomid, const int txn_id); - void emoteSent(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, 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 joinedRoom(const QString &room_id); void leftRoom(const QString &room_id); diff --git a/include/Utils.h b/include/Utils.h index 2c764f8..30e592c 100644 --- a/include/Utils.h +++ b/include/Utils.h @@ -25,5 +25,5 @@ firstChar(const QString &input); //! Get a human readable file size with the appropriate units attached. QString -humanReadableFileSize(const uint64_t bytes); +humanReadableFileSize(uint64_t bytes); } diff --git a/include/dialogs/PreviewUploadOverlay.h b/include/dialogs/PreviewUploadOverlay.h index c951671..48795ca 100644 --- a/include/dialogs/PreviewUploadOverlay.h +++ b/include/dialogs/PreviewUploadOverlay.h @@ -42,7 +42,7 @@ signals: private: 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_; QPixmap image_; diff --git a/include/timeline/TimelineView.h b/include/timeline/TimelineView.h index 782f3af..96d7690 100644 --- a/include/timeline/TimelineView.h +++ b/include/timeline/TimelineView.h @@ -45,7 +45,7 @@ struct PendingMessage QString body; QString filename; QString mime; - int64_t media_size; + uint64_t media_size; QString event_id; TimelineItem *widget; @@ -54,7 +54,7 @@ struct PendingMessage QString body, QString filename, QString mime, - int64_t media_size, + uint64_t media_size, QString event_id, TimelineItem *widget) : ty(ty) @@ -96,7 +96,7 @@ public: void addUserMessage(const QString &url, const QString &filename, const QString &mime, - const int64_t size); + uint64_t size); void updatePendingMessage(int txn_id, QString event_id); void scrollDown(); QLabel *createDateSeparator(QDateTime datetime); @@ -243,7 +243,7 @@ void TimelineView::addUserMessage(const QString &url, const QString &filename, const QString &mime, - const int64_t size) + uint64_t size) { auto with_sender = lastSender_ != local_user_; auto trimmed = QFileInfo{filename}.fileName(); // Trim file path. diff --git a/include/timeline/TimelineViewManager.h b/include/timeline/TimelineViewManager.h index a531be8..c7bbd71 100644 --- a/include/timeline/TimelineViewManager.h +++ b/include/timeline/TimelineViewManager.h @@ -67,22 +67,22 @@ public slots: const QString &filename, const QString &url, const QString &mime, - const int64_t dsize); + uint64_t dsize); void queueFileMessage(const QString &roomid, const QString &filename, const QString &url, const QString &mime, - const int64_t dsize); + uint64_t dsize); void queueAudioMessage(const QString &roomid, const QString &filename, const QString &url, const QString &mime, - const int64_t dsize); + uint64_t dsize); void queueVideoMessage(const QString &roomid, const QString &filename, const QString &url, const QString &mime, - const int64_t dsize); + uint64_t dsize); private slots: void messageSent(const QString &eventid, const QString &roomid, int txnid); diff --git a/include/timeline/widgets/AudioItem.h b/include/timeline/widgets/AudioItem.h index 06f4b8f..88e84d0 100644 --- a/include/timeline/widgets/AudioItem.h +++ b/include/timeline/widgets/AudioItem.h @@ -49,7 +49,7 @@ public: AudioItem(QSharedPointer client, const QString &url, const QString &filename, - const int64_t size, + uint64_t size, QWidget *parent = nullptr); QSize sizeHint() const override; diff --git a/include/timeline/widgets/FileItem.h b/include/timeline/widgets/FileItem.h index 36d72f2..cc6cd2e 100644 --- a/include/timeline/widgets/FileItem.h +++ b/include/timeline/widgets/FileItem.h @@ -43,7 +43,7 @@ public: FileItem(QSharedPointer client, const QString &url, const QString &filename, - const int64_t size, + uint64_t size, QWidget *parent = nullptr); QSize sizeHint() const override; diff --git a/include/timeline/widgets/ImageItem.h b/include/timeline/widgets/ImageItem.h index 9e5fa82..28a0b46 100644 --- a/include/timeline/widgets/ImageItem.h +++ b/include/timeline/widgets/ImageItem.h @@ -37,7 +37,7 @@ public: ImageItem(QSharedPointer client, const QString &url, const QString &filename, - const int64_t size, + uint64_t size, QWidget *parent = nullptr); void setImage(const QPixmap &image); diff --git a/include/timeline/widgets/VideoItem.h b/include/timeline/widgets/VideoItem.h index 65b87c9..8973297 100644 --- a/include/timeline/widgets/VideoItem.h +++ b/include/timeline/widgets/VideoItem.h @@ -38,7 +38,7 @@ public: VideoItem(QSharedPointer client, const QString &url, const QString &filename, - const int64_t size, + uint64_t size, QWidget *parent = nullptr); private: diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 8899ffc..3bca5cd 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -263,28 +263,28 @@ ChatPage::ChatPage(QSharedPointer client, connect(client_.data(), &MatrixClient::imageUploaded, 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(); view_manager_->queueImageMessage(roomid, filename, url, mime, dsize); }); connect(client_.data(), &MatrixClient::fileUploaded, 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(); view_manager_->queueFileMessage(roomid, filename, url, mime, dsize); }); connect(client_.data(), &MatrixClient::audioUploaded, 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(); view_manager_->queueAudioMessage(roomid, filename, url, mime, dsize); }); connect(client_.data(), &MatrixClient::videoUploaded, 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(); view_manager_->queueVideoMessage(roomid, filename, url, mime, dsize); }); diff --git a/src/MatrixClient.cc b/src/MatrixClient.cc index de9ce77..fae0230 100644 --- a/src/MatrixClient.cc +++ b/src/MatrixClient.cc @@ -281,7 +281,7 @@ MatrixClient::sendRoomMessage(mtx::events::MessageType ty, const QString &roomid, const QString &msg, const QString &mime, - const int64_t media_size, + uint64_t media_size, const QString &url) noexcept { QUrlQuery query; diff --git a/src/Utils.cc b/src/Utils.cc index 858d4e7..6f438c2 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -135,7 +135,7 @@ utils::firstChar(const QString &input) } 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 int length = sizeof(units) / sizeof(units[0]); diff --git a/src/dialogs/PreviewUploadOverlay.cc b/src/dialogs/PreviewUploadOverlay.cc index f200701..5b4b9ff 100644 --- a/src/dialogs/PreviewUploadOverlay.cc +++ b/src/dialogs/PreviewUploadOverlay.cc @@ -103,7 +103,7 @@ PreviewUploadOverlay::init() } 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 (!image_.loadFromData(data_)) { diff --git a/src/timeline/TimelineViewManager.cc b/src/timeline/TimelineViewManager.cc index 0e2bde2..3fee59c 100644 --- a/src/timeline/TimelineViewManager.cc +++ b/src/timeline/TimelineViewManager.cc @@ -93,7 +93,7 @@ TimelineViewManager::queueImageMessage(const QString &roomid, const QString &filename, const QString &url, const QString &mime, - const int64_t size) + uint64_t size) { if (!timelineViewExists(roomid)) { 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 &url, const QString &mime, - const int64_t size) + uint64_t size) { if (!timelineViewExists(roomid)) { 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 &url, const QString &mime, - const int64_t size) + uint64_t size) { if (!timelineViewExists(roomid)) { 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 &url, const QString &mime, - const int64_t size) + uint64_t size) { if (!timelineViewExists(roomid)) { qDebug() << "Cannot send m.video message to a non-managed view"; diff --git a/src/timeline/widgets/AudioItem.cc b/src/timeline/widgets/AudioItem.cc index 9075bc5..6054d70 100644 --- a/src/timeline/widgets/AudioItem.cc +++ b/src/timeline/widgets/AudioItem.cc @@ -91,7 +91,7 @@ AudioItem::AudioItem(QSharedPointer client, AudioItem::AudioItem(QSharedPointer client, const QString &url, const QString &filename, - const int64_t size, + uint64_t size, QWidget *parent) : QWidget(parent) , url_{url} diff --git a/src/timeline/widgets/FileItem.cc b/src/timeline/widgets/FileItem.cc index eda6e83..258536e 100644 --- a/src/timeline/widgets/FileItem.cc +++ b/src/timeline/widgets/FileItem.cc @@ -78,7 +78,7 @@ FileItem::FileItem(QSharedPointer client, FileItem::FileItem(QSharedPointer client, const QString &url, const QString &filename, - const int64_t size, + uint64_t size, QWidget *parent) : QWidget(parent) , url_{url} diff --git a/src/timeline/widgets/ImageItem.cc b/src/timeline/widgets/ImageItem.cc index f91799c..e8fa069 100644 --- a/src/timeline/widgets/ImageItem.cc +++ b/src/timeline/widgets/ImageItem.cc @@ -62,7 +62,7 @@ ImageItem::ImageItem(QSharedPointer client, ImageItem::ImageItem(QSharedPointer client, const QString &url, const QString &filename, - const int64_t size, + uint64_t size, QWidget *parent) : QWidget(parent) , url_{url} diff --git a/src/timeline/widgets/VideoItem.cc b/src/timeline/widgets/VideoItem.cc index 34c0a64..788db0e 100644 --- a/src/timeline/widgets/VideoItem.cc +++ b/src/timeline/widgets/VideoItem.cc @@ -68,7 +68,7 @@ VideoItem::VideoItem(QSharedPointer client, VideoItem::VideoItem(QSharedPointer client, const QString &url, const QString &filename, - const int64_t size, + uint64_t size, QWidget *parent) : QWidget(parent) , url_{url}