Minor adjustments

This commit is contained in:
Konstantinos Sideris 2018-02-19 22:09:21 +02:00
parent a8e17b9c91
commit 8b139c32a3
18 changed files with 37 additions and 37 deletions

View file

@ -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);

View file

@ -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);
} }

View file

@ -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_;

View file

@ -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.

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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:

View file

@ -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);
}); });

View file

@ -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;

View file

@ -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]);

View file

@ -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_)) {

View file

@ -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";

View file

@ -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}

View file

@ -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}

View file

@ -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}

View file

@ -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}