mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
cppcheck stuff (#1200)
* cppcheck stuff * Update src/ui/RoomSettings.cpp Co-authored-by: DeepBlueV7.X <nicolas.werner@hotmail.de> * Update src/ui/RoomSettings.cpp Co-authored-by: DeepBlueV7.X <nicolas.werner@hotmail.de> * Fix linting Co-authored-by: DeepBlueV7.X <nicolas.werner@hotmail.de>
This commit is contained in:
parent
5e9eb845ab
commit
8ecbb39dc6
33 changed files with 162 additions and 146 deletions
|
@ -74,7 +74,7 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
|
|||
this,
|
||||
&CompletionProxyModel::newSearchString,
|
||||
this,
|
||||
[this](QString s) {
|
||||
[this](const QString &s) {
|
||||
searchString_ = s.toLower();
|
||||
invalidate();
|
||||
},
|
||||
|
@ -167,7 +167,7 @@ CompletionProxyModel::completionAt(int i) const
|
|||
}
|
||||
|
||||
void
|
||||
CompletionProxyModel::setSearchString(QString s)
|
||||
CompletionProxyModel::setSearchString(const QString &s)
|
||||
{
|
||||
emit newSearchString(s);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
public slots:
|
||||
QVariant completionAt(int i) const;
|
||||
|
||||
void setSearchString(QString s);
|
||||
void setSearchString(const QString &s);
|
||||
QString searchString() const { return searchString_; }
|
||||
|
||||
signals:
|
||||
|
|
|
@ -60,7 +60,7 @@ LoginPage::showError(const QString &msg)
|
|||
}
|
||||
|
||||
void
|
||||
LoginPage::setHomeserver(QString hs)
|
||||
LoginPage::setHomeserver(const QString &hs)
|
||||
{
|
||||
if (hs != homeserver_) {
|
||||
homeserver_ = hs;
|
||||
|
@ -261,9 +261,9 @@ LoginPage::versionOk(bool passwordSupported, bool ssoSupported, QVariantList idp
|
|||
|
||||
void
|
||||
LoginPage::onLoginButtonClicked(LoginMethod loginMethod,
|
||||
QString userid,
|
||||
QString password,
|
||||
QString deviceName)
|
||||
const QString &userid,
|
||||
const QString &password,
|
||||
const QString &deviceName)
|
||||
{
|
||||
clearErrors();
|
||||
|
||||
|
@ -305,13 +305,16 @@ LoginPage::onLoginButtonClicked(LoginMethod loginMethod,
|
|||
});
|
||||
} else {
|
||||
auto sso = new SSOHandler();
|
||||
connect(
|
||||
sso, &SSOHandler::ssoSuccess, this, [this, sso, userid, deviceName](std::string token) {
|
||||
connect(sso,
|
||||
&SSOHandler::ssoSuccess,
|
||||
this,
|
||||
[this, sso, userid, deviceName](const std::string &token) {
|
||||
mtx::requests::Login req{};
|
||||
req.token = token;
|
||||
req.type = mtx::user_interactive::auth_types::token;
|
||||
req.initial_device_display_name =
|
||||
deviceName.trimmed().isEmpty() ? initialDeviceName_() : deviceName.toStdString();
|
||||
req.initial_device_display_name = deviceName.trimmed().isEmpty()
|
||||
? initialDeviceName_()
|
||||
: deviceName.toStdString();
|
||||
http::client()->login(
|
||||
req, [this](const mtx::responses::Login &res, mtx::http::RequestErr err) {
|
||||
if (err) {
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
QString error() { return error_; }
|
||||
QString mxidError() { return mxidError_; }
|
||||
|
||||
void setHomeserver(QString hs);
|
||||
void setHomeserver(const QString &hs);
|
||||
void setMxid(QString id)
|
||||
{
|
||||
if (id != mxid_) {
|
||||
|
@ -130,9 +130,9 @@ public slots:
|
|||
|
||||
// Callback for the login button.
|
||||
void onLoginButtonClicked(LoginMethod loginMethod,
|
||||
QString userid,
|
||||
QString password,
|
||||
QString deviceName);
|
||||
const QString &userid,
|
||||
const QString &password,
|
||||
const QString &deviceName);
|
||||
|
||||
// Callback for errors produced during server probing
|
||||
void versionError(const QString &error_message);
|
||||
|
|
|
@ -27,7 +27,7 @@ RegisterPage::RegisterPage(QObject *parent)
|
|||
}
|
||||
|
||||
void
|
||||
RegisterPage::setError(QString err)
|
||||
RegisterPage::setError(const QString &err)
|
||||
{
|
||||
registrationError_ = err;
|
||||
emit errorChanged();
|
||||
|
@ -35,7 +35,7 @@ RegisterPage::setError(QString err)
|
|||
emit registeringChanged();
|
||||
}
|
||||
void
|
||||
RegisterPage::setHsError(QString err)
|
||||
RegisterPage::setHsError(const QString &err)
|
||||
{
|
||||
hsError_ = err;
|
||||
emit hsErrorChanged();
|
||||
|
@ -50,7 +50,7 @@ RegisterPage::initialDeviceName() const
|
|||
}
|
||||
|
||||
void
|
||||
RegisterPage::setServer(QString server)
|
||||
RegisterPage::setServer(const QString &server)
|
||||
{
|
||||
if (server == lastServer)
|
||||
return;
|
||||
|
@ -165,7 +165,7 @@ RegisterPage::versionsCheck()
|
|||
}
|
||||
|
||||
void
|
||||
RegisterPage::checkUsername(QString name)
|
||||
RegisterPage::checkUsername(const QString &name)
|
||||
{
|
||||
usernameAvailable_ = usernameUnavailable_ = false;
|
||||
usernameError_.clear();
|
||||
|
@ -197,7 +197,9 @@ RegisterPage::checkUsername(QString name)
|
|||
}
|
||||
|
||||
void
|
||||
RegisterPage::startRegistration(QString username, QString password, QString devicename)
|
||||
RegisterPage::startRegistration(const QString &username,
|
||||
const QString &password,
|
||||
const QString &devicename)
|
||||
{
|
||||
// These inputs should still be alright, but check just in case
|
||||
if (!username.isEmpty() && !password.isEmpty() && usernameAvailable_ && supported_) {
|
||||
|
@ -206,7 +208,7 @@ RegisterPage::startRegistration(QString username, QString password, QString devi
|
|||
registering_ = true;
|
||||
emit registeringChanged();
|
||||
|
||||
connect(UIA::instance(), &UIA::error, this, [this](QString msg) {
|
||||
connect(UIA::instance(), &UIA::error, this, [this](const QString &msg) {
|
||||
setError(msg);
|
||||
disconnect(UIA::instance(), &UIA::error, this, nullptr);
|
||||
});
|
||||
|
|
|
@ -29,9 +29,10 @@ class RegisterPage : public QObject
|
|||
public:
|
||||
RegisterPage(QObject *parent = nullptr);
|
||||
|
||||
Q_INVOKABLE void setServer(QString server);
|
||||
Q_INVOKABLE void checkUsername(QString name);
|
||||
Q_INVOKABLE void startRegistration(QString username, QString password, QString deviceName);
|
||||
Q_INVOKABLE void setServer(const QString &server);
|
||||
Q_INVOKABLE void checkUsername(const QString &name);
|
||||
Q_INVOKABLE void
|
||||
startRegistration(const QString &username, const QString &password, const QString &deviceName);
|
||||
Q_INVOKABLE QString initialDeviceName() const;
|
||||
|
||||
bool registering() const { return registering_; }
|
||||
|
@ -58,8 +59,8 @@ signals:
|
|||
private:
|
||||
void versionsCheck();
|
||||
|
||||
void setHsError(QString err);
|
||||
void setError(QString err);
|
||||
void setHsError(const QString &err);
|
||||
void setError(const QString &err);
|
||||
|
||||
QString registrationError_, hsError_, usernameError_;
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
MsgCountComposedIcon::MsgCountComposedIcon(const QString &filename)
|
||||
: QIconEngine()
|
||||
, icon_{QIcon{filename}}
|
||||
{
|
||||
icon_ = QIcon(filename);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -31,8 +31,8 @@ key_verification_mac(mtx::crypto::SAS *sas,
|
|||
DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
|
||||
DeviceVerificationFlow::Type flow_type,
|
||||
TimelineModel *model,
|
||||
QString userID,
|
||||
std::vector<QString> deviceIds_)
|
||||
const QString &userID,
|
||||
const std::vector<QString> &deviceIds_)
|
||||
: sender(false)
|
||||
, type(flow_type)
|
||||
, deviceIds(std::move(deviceIds_))
|
||||
|
@ -86,8 +86,10 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
|
|||
});
|
||||
|
||||
if (model) {
|
||||
connect(
|
||||
this->model_, &TimelineModel::updateFlowEventId, this, [this](std::string event_id_) {
|
||||
connect(this->model_,
|
||||
&TimelineModel::updateFlowEventId,
|
||||
this,
|
||||
[this](const std::string &event_id_) {
|
||||
this->relation.rel_type = mtx::common::RelationType::Reference;
|
||||
this->relation.event_id = event_id_;
|
||||
this->transaction_id = event_id_;
|
||||
|
@ -548,7 +550,7 @@ DeviceVerificationFlow::isSelfVerification() const
|
|||
}
|
||||
|
||||
void
|
||||
DeviceVerificationFlow::setEventId(std::string event_id_)
|
||||
DeviceVerificationFlow::setEventId(const std::string &event_id_)
|
||||
{
|
||||
this->relation.rel_type = mtx::common::RelationType::Reference;
|
||||
this->relation.event_id = event_id_;
|
||||
|
@ -864,8 +866,8 @@ QSharedPointer<DeviceVerificationFlow>
|
|||
DeviceVerificationFlow::NewInRoomVerification(QObject *parent_,
|
||||
TimelineModel *timelineModel_,
|
||||
const mtx::events::msg::KeyVerificationRequest &msg,
|
||||
QString other_user_,
|
||||
QString event_id_)
|
||||
const QString &other_user_,
|
||||
const QString &event_id_)
|
||||
{
|
||||
QSharedPointer<DeviceVerificationFlow> flow(
|
||||
new DeviceVerificationFlow(parent_,
|
||||
|
@ -887,8 +889,8 @@ DeviceVerificationFlow::NewInRoomVerification(QObject *parent_,
|
|||
QSharedPointer<DeviceVerificationFlow>
|
||||
DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
||||
const mtx::events::msg::KeyVerificationRequest &msg,
|
||||
QString other_user_,
|
||||
QString txn_id_)
|
||||
const QString &other_user_,
|
||||
const QString &txn_id_)
|
||||
{
|
||||
QSharedPointer<DeviceVerificationFlow> flow(new DeviceVerificationFlow(
|
||||
parent_, Type::ToDevice, nullptr, other_user_, {QString::fromStdString(msg.from_device)}));
|
||||
|
@ -905,8 +907,8 @@ DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
|||
QSharedPointer<DeviceVerificationFlow>
|
||||
DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
||||
const mtx::events::msg::KeyVerificationStart &msg,
|
||||
QString other_user_,
|
||||
QString txn_id_)
|
||||
const QString &other_user_,
|
||||
const QString &txn_id_)
|
||||
{
|
||||
QSharedPointer<DeviceVerificationFlow> flow(new DeviceVerificationFlow(
|
||||
parent_, Type::ToDevice, nullptr, other_user_, {QString::fromStdString(msg.from_device)}));
|
||||
|
@ -919,7 +921,7 @@ DeviceVerificationFlow::NewToDeviceVerification(QObject *parent_,
|
|||
QSharedPointer<DeviceVerificationFlow>
|
||||
DeviceVerificationFlow::InitiateUserVerification(QObject *parent_,
|
||||
TimelineModel *timelineModel_,
|
||||
QString userid)
|
||||
const QString &userid)
|
||||
{
|
||||
QSharedPointer<DeviceVerificationFlow> flow(
|
||||
new DeviceVerificationFlow(parent_, Type::RoomMsg, timelineModel_, userid, {}));
|
||||
|
@ -928,8 +930,8 @@ DeviceVerificationFlow::InitiateUserVerification(QObject *parent_,
|
|||
}
|
||||
QSharedPointer<DeviceVerificationFlow>
|
||||
DeviceVerificationFlow::InitiateDeviceVerification(QObject *parent_,
|
||||
QString userid,
|
||||
std::vector<QString> devices)
|
||||
const QString &userid,
|
||||
const std::vector<QString> &devices)
|
||||
{
|
||||
assert(!devices.empty());
|
||||
|
||||
|
|
|
@ -110,22 +110,26 @@ public:
|
|||
NewInRoomVerification(QObject *parent_,
|
||||
TimelineModel *timelineModel_,
|
||||
const mtx::events::msg::KeyVerificationRequest &msg,
|
||||
QString other_user_,
|
||||
QString event_id_);
|
||||
const QString &other_user_,
|
||||
const QString &event_id_);
|
||||
static QSharedPointer<DeviceVerificationFlow>
|
||||
NewToDeviceVerification(QObject *parent_,
|
||||
const mtx::events::msg::KeyVerificationRequest &msg,
|
||||
QString other_user_,
|
||||
QString txn_id_);
|
||||
const QString &other_user_,
|
||||
const QString &txn_id_);
|
||||
static QSharedPointer<DeviceVerificationFlow>
|
||||
NewToDeviceVerification(QObject *parent_,
|
||||
const mtx::events::msg::KeyVerificationStart &msg,
|
||||
QString other_user_,
|
||||
QString txn_id_);
|
||||
const QString &other_user_,
|
||||
const QString &txn_id_);
|
||||
static QSharedPointer<DeviceVerificationFlow>
|
||||
InitiateUserVerification(QObject *parent_, TimelineModel *timelineModel_, QString userid);
|
||||
InitiateUserVerification(QObject *parent_,
|
||||
TimelineModel *timelineModel_,
|
||||
const QString &userid);
|
||||
static QSharedPointer<DeviceVerificationFlow>
|
||||
InitiateDeviceVerification(QObject *parent, QString userid, std::vector<QString> devices);
|
||||
InitiateDeviceVerification(QObject *parent,
|
||||
const QString &userid,
|
||||
const std::vector<QString> &devices);
|
||||
|
||||
// getters
|
||||
QString state();
|
||||
|
@ -137,7 +141,7 @@ public:
|
|||
QString transactionId() { return QString::fromStdString(this->transaction_id); }
|
||||
// setters
|
||||
void setDeviceId(QString deviceID);
|
||||
void setEventId(std::string event_id);
|
||||
void setEventId(const std::string &event_id);
|
||||
bool isDeviceVerification() const
|
||||
{
|
||||
return this->type == DeviceVerificationFlow::Type::ToDevice;
|
||||
|
@ -164,8 +168,8 @@ private:
|
|||
DeviceVerificationFlow(QObject *,
|
||||
DeviceVerificationFlow::Type flow_type,
|
||||
TimelineModel *model,
|
||||
QString userID,
|
||||
std::vector<QString> deviceIds_);
|
||||
const QString &userID,
|
||||
const std::vector<QString> &deviceIds_);
|
||||
void setState(State state)
|
||||
{
|
||||
if (state != state_) {
|
||||
|
|
|
@ -951,7 +951,7 @@ download_full_keybackup()
|
|||
});
|
||||
}
|
||||
void
|
||||
lookup_keybackup(const std::string room, const std::string session_id)
|
||||
lookup_keybackup(const std::string &room, const std::string &session_id)
|
||||
{
|
||||
if (!UserSettings::instance()->useOnlineKeyBackup()) {
|
||||
// Online key backup disabled
|
||||
|
@ -1283,7 +1283,7 @@ calculate_trust(const std::string &user_id, const MegolmSessionIndex &index)
|
|||
//! Send encrypted to device messages, targets is a map from userid to device ids or {} for all
|
||||
//! devices
|
||||
void
|
||||
send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::string>> targets,
|
||||
send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::string>> &targets,
|
||||
const mtx::events::collections::DeviceEvents &event,
|
||||
bool force_new_session)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ void
|
|||
import_inbound_megolm_session(
|
||||
const mtx::events::DeviceEvent<mtx::events::msg::ForwardedRoomKey> &roomKey);
|
||||
void
|
||||
lookup_keybackup(const std::string room, const std::string session_id);
|
||||
lookup_keybackup(const std::string &room, const std::string &session_id);
|
||||
void
|
||||
download_full_keybackup();
|
||||
|
||||
|
@ -119,7 +119,7 @@ send_megolm_key_to_device(const std::string &user_id,
|
|||
//! Send encrypted to device messages, targets is a map from userid to device ids or {} for all
|
||||
//! devices
|
||||
void
|
||||
send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::string>> targets,
|
||||
send_encrypted_to_device_messages(const std::map<std::string, std::vector<std::string>> &targets,
|
||||
const mtx::events::collections::DeviceEvents &event,
|
||||
bool force_new_session = false);
|
||||
|
||||
|
|
|
@ -33,7 +33,9 @@ SelfVerificationStatus::SelfVerificationStatus(QObject *o)
|
|||
}
|
||||
|
||||
void
|
||||
SelfVerificationStatus::setupCrosssigning(bool useSSSS, QString password, bool useOnlineKeyBackup)
|
||||
SelfVerificationStatus::setupCrosssigning(bool useSSSS,
|
||||
const QString &password,
|
||||
bool useOnlineKeyBackup)
|
||||
{
|
||||
nhlog::db()->info("Clicked setup crossigning");
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ public:
|
|||
};
|
||||
Q_ENUM(Status)
|
||||
|
||||
Q_INVOKABLE void setupCrosssigning(bool useSSSS, QString password, bool useOnlineKeyBackup);
|
||||
Q_INVOKABLE void
|
||||
setupCrosssigning(bool useSSSS, const QString &password, bool useOnlineKeyBackup);
|
||||
Q_INVOKABLE void verifyMasterKey();
|
||||
Q_INVOKABLE void verifyMasterKeyWithPassphrase();
|
||||
Q_INVOKABLE void verifyUnverifiedDevices();
|
||||
|
|
|
@ -693,7 +693,7 @@ enum Categories
|
|||
};
|
||||
|
||||
Categories
|
||||
tagIdToCat(QString tagId)
|
||||
tagIdToCat(const QString &tagId)
|
||||
{
|
||||
if (tagId.isEmpty())
|
||||
return World;
|
||||
|
@ -757,7 +757,7 @@ FilteredCommunitiesModel::filterAcceptsRow(int sourceRow, const QModelIndex &) c
|
|||
}
|
||||
|
||||
QVariantList
|
||||
CommunitiesModel::spaceChildrenListFromIndex(QString room, int idx) const
|
||||
CommunitiesModel::spaceChildrenListFromIndex(const QString &room, int idx) const
|
||||
{
|
||||
if (idx < -1)
|
||||
return {};
|
||||
|
|
|
@ -167,7 +167,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
Q_INVOKABLE QVariantList spaceChildrenListFromIndex(QString room, int idx = -1) const;
|
||||
Q_INVOKABLE QVariantList spaceChildrenListFromIndex(const QString &room, int idx = -1) const;
|
||||
Q_INVOKABLE void updateSpaceStatus(QString space,
|
||||
QString room,
|
||||
bool setParent,
|
||||
|
|
|
@ -43,8 +43,9 @@ EventStore::EventStore(std::string room_id, QObject *)
|
|||
this,
|
||||
&EventStore::eventFetched,
|
||||
this,
|
||||
[this](
|
||||
std::string id, std::string relatedTo, mtx::events::collections::TimelineEvents timeline) {
|
||||
[this](const std::string &id,
|
||||
const std::string &relatedTo,
|
||||
mtx::events::collections::TimelineEvents timeline) {
|
||||
cache::client()->storeEvent(room_id_, id, {timeline});
|
||||
|
||||
if (!relatedTo.empty()) {
|
||||
|
|
|
@ -803,8 +803,8 @@ InputBar::command(const QString &command, QString args)
|
|||
}
|
||||
|
||||
MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
||||
QString mimetype,
|
||||
QString originalFilename,
|
||||
const QString &mimetype,
|
||||
const QString &originalFilename,
|
||||
bool encrypt,
|
||||
QObject *parent)
|
||||
: QObject(parent)
|
||||
|
@ -911,7 +911,7 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
|||
connect(mediaPlayer,
|
||||
qOverload<const QString &, const QVariant &>(&QMediaPlayer::metaDataChanged),
|
||||
this,
|
||||
[this, mediaPlayer](QString t, QVariant) {
|
||||
[this, mediaPlayer](const QString &t, const QVariant &) {
|
||||
nhlog::ui()->debug("Got metadata {}", t.toStdString());
|
||||
|
||||
if (mediaPlayer->duration() > 0)
|
||||
|
@ -1029,7 +1029,7 @@ MediaUpload::startUpload()
|
|||
}
|
||||
|
||||
void
|
||||
InputBar::finalizeUpload(MediaUpload *upload, QString url)
|
||||
InputBar::finalizeUpload(MediaUpload *upload, const QString &url)
|
||||
{
|
||||
auto mime = upload->mimetype();
|
||||
auto filename = upload->filename();
|
||||
|
|
|
@ -83,8 +83,8 @@ public:
|
|||
Q_ENUM(MediaType)
|
||||
|
||||
explicit MediaUpload(std::unique_ptr<QIODevice> data,
|
||||
QString mimetype,
|
||||
QString originalFilename,
|
||||
const QString &mimetype,
|
||||
const QString &originalFilename,
|
||||
bool encrypt,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
|
@ -218,7 +218,7 @@ private slots:
|
|||
void startTyping();
|
||||
void stopTyping();
|
||||
|
||||
void finalizeUpload(MediaUpload *upload, QString url);
|
||||
void finalizeUpload(MediaUpload *upload, const QString &url);
|
||||
void removeRunUpload(MediaUpload *upload);
|
||||
|
||||
signals:
|
||||
|
|
|
@ -249,7 +249,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
|
||||
void
|
||||
RoomlistModel::updateReadStatus(const std::map<QString, bool> roomReadStatus_)
|
||||
RoomlistModel::updateReadStatus(const std::map<QString, bool> &roomReadStatus_)
|
||||
{
|
||||
std::vector<int> roomsToUpdate;
|
||||
roomsToUpdate.resize(roomReadStatus_.size());
|
||||
|
@ -657,7 +657,7 @@ RoomlistModel::clear()
|
|||
}
|
||||
|
||||
void
|
||||
RoomlistModel::joinPreview(QString roomid)
|
||||
RoomlistModel::joinPreview(const QString &roomid)
|
||||
{
|
||||
if (previewedRooms.contains(roomid)) {
|
||||
ChatPage::instance()->joinRoomVia(
|
||||
|
@ -742,7 +742,7 @@ RoomlistModel::getRoomPreviewById(QString roomid) const
|
|||
}
|
||||
|
||||
void
|
||||
RoomlistModel::setCurrentRoom(QString roomid)
|
||||
RoomlistModel::setCurrentRoom(const QString &roomid)
|
||||
{
|
||||
if ((currentRoom_ && currentRoom_->roomId() == roomid) ||
|
||||
(currentRoomPreview_ && currentRoomPreview_->roomid() == roomid))
|
||||
|
@ -1078,7 +1078,7 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons
|
|||
}
|
||||
|
||||
void
|
||||
FilteredRoomlistModel::toggleTag(QString roomid, QString tag, bool on)
|
||||
FilteredRoomlistModel::toggleTag(const QString &roomid, const QString &tag, bool on)
|
||||
{
|
||||
if (on) {
|
||||
http::client()->put_tag(
|
||||
|
|
|
@ -96,7 +96,7 @@ public slots:
|
|||
void initializeRooms();
|
||||
void sync(const mtx::responses::Sync &sync_);
|
||||
void clear();
|
||||
int roomidToIndex(QString roomid)
|
||||
int roomidToIndex(const QString &roomid)
|
||||
{
|
||||
for (int i = 0; i < (int)roomids.size(); i++) {
|
||||
if (roomids[i] == roomid)
|
||||
|
@ -105,13 +105,13 @@ public slots:
|
|||
|
||||
return -1;
|
||||
}
|
||||
void joinPreview(QString roomid);
|
||||
void joinPreview(const QString &roomid);
|
||||
void acceptInvite(QString roomid);
|
||||
void declineInvite(QString roomid);
|
||||
void leave(QString roomid, QString reason = "");
|
||||
TimelineModel *currentRoom() const { return currentRoom_.get(); }
|
||||
RoomPreview currentRoomPreview() const { return currentRoomPreview_.value_or(RoomPreview{}); }
|
||||
void setCurrentRoom(QString roomid);
|
||||
void setCurrentRoom(const QString &roomid);
|
||||
void resetCurrentRoom()
|
||||
{
|
||||
currentRoom_ = nullptr;
|
||||
|
@ -120,7 +120,7 @@ public slots:
|
|||
}
|
||||
|
||||
private slots:
|
||||
void updateReadStatus(const std::map<QString, bool> roomReadStatus_);
|
||||
void updateReadStatus(const std::map<QString, bool> &roomReadStatus_);
|
||||
|
||||
signals:
|
||||
void totalUnreadMessageCountUpdated(int unreadMessages);
|
||||
|
@ -173,7 +173,7 @@ public slots:
|
|||
void acceptInvite(QString roomid) { roomlistmodel->acceptInvite(roomid); }
|
||||
void declineInvite(QString roomid) { roomlistmodel->declineInvite(roomid); }
|
||||
void leave(QString roomid, QString reason = "") { roomlistmodel->leave(roomid, reason); }
|
||||
void toggleTag(QString roomid, QString tag, bool on);
|
||||
void toggleTag(const QString &roomid, const QString &tag, bool on);
|
||||
void copyLink(QString roomid);
|
||||
|
||||
TimelineModel *currentRoom() const { return roomlistmodel->currentRoom(); }
|
||||
|
|
|
@ -1269,7 +1269,7 @@ TimelineModel::relatedInfo(const QString &id)
|
|||
}
|
||||
|
||||
void
|
||||
TimelineModel::showReadReceipts(QString id)
|
||||
TimelineModel::showReadReceipts(const QString &id)
|
||||
{
|
||||
emit openReadReceiptsDialog(new ReadReceiptsProxy{id, roomId(), this});
|
||||
}
|
||||
|
@ -1372,7 +1372,7 @@ TimelineModel::markEventsAsRead(const std::vector<QString> &event_ids)
|
|||
}
|
||||
|
||||
void
|
||||
TimelineModel::updateLastReadId(QString currentRoomId)
|
||||
TimelineModel::updateLastReadId(const QString ¤tRoomId)
|
||||
{
|
||||
if (currentRoomId == room_id_) {
|
||||
last_event_id = cache::getFullyReadEventId(room_id_.toStdString());
|
||||
|
|
|
@ -285,7 +285,7 @@ public:
|
|||
Q_INVOKABLE void openUserProfile(QString userid);
|
||||
Q_INVOKABLE void unpin(const QString &id);
|
||||
Q_INVOKABLE void pin(const QString &id);
|
||||
Q_INVOKABLE void showReadReceipts(QString id);
|
||||
Q_INVOKABLE void showReadReceipts(const QString &id);
|
||||
Q_INVOKABLE void redactEvent(const QString &id, const QString &reason = "");
|
||||
Q_INVOKABLE void redactAllFromUser(const QString &userid, const QString &reason = "");
|
||||
Q_INVOKABLE int idToIndex(const QString &id) const;
|
||||
|
@ -349,7 +349,7 @@ public slots:
|
|||
int currentIndex() const { return idToIndex(currentId); }
|
||||
void eventShown();
|
||||
void markEventsAsRead(const std::vector<QString> &event_ids);
|
||||
void updateLastReadId(QString currentRoomId);
|
||||
void updateLastReadId(const QString ¤tRoomId);
|
||||
void lastReadIdOnWindowFocus();
|
||||
void checkAfterFetch();
|
||||
QVariantMap getDump(const QString &eventId, const QString &relatedTo) const;
|
||||
|
|
|
@ -246,8 +246,8 @@ TimelineViewManager::escapeEmoji(QString str) const
|
|||
|
||||
void
|
||||
TimelineViewManager::openImageOverlay(TimelineModel *room,
|
||||
QString mxcUrl,
|
||||
QString eventId,
|
||||
const QString &mxcUrl,
|
||||
const QString &eventId,
|
||||
double originalWidth,
|
||||
double proportionalHeight)
|
||||
{
|
||||
|
@ -384,7 +384,7 @@ TimelineViewManager::focusMessageInput()
|
|||
}
|
||||
|
||||
QObject *
|
||||
TimelineViewManager::completerFor(QString completerName, QString roomId)
|
||||
TimelineViewManager::completerFor(const QString &completerName, const QString &roomId)
|
||||
{
|
||||
if (completerName == QLatin1String("user")) {
|
||||
auto userModel = new UsersModel(roomId.toStdString());
|
||||
|
|
|
@ -54,8 +54,8 @@ public:
|
|||
Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
|
||||
bool isConnected() const { return isConnected_; }
|
||||
Q_INVOKABLE void openImageOverlay(TimelineModel *room,
|
||||
QString mxcUrl,
|
||||
QString eventId,
|
||||
const QString &mxcUrl,
|
||||
const QString &eventId,
|
||||
double originalWidth,
|
||||
double proportionalHeight);
|
||||
Q_INVOKABLE void openImagePackSettings(QString roomid);
|
||||
|
@ -112,7 +112,8 @@ public slots:
|
|||
|
||||
void setVideoCallItem();
|
||||
|
||||
QObject *completerFor(QString completerName, QString roomId = QLatin1String(QLatin1String("")));
|
||||
QObject *completerFor(const QString &completerName,
|
||||
const QString &roomId = QLatin1String(QLatin1String("")));
|
||||
void forwardMessageToRoom(mtx::events::collections::TimelineEvents *e, QString roomId);
|
||||
|
||||
RoomlistModel *rooms() { return rooms_; }
|
||||
|
|
|
@ -42,7 +42,7 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent)
|
|||
});
|
||||
connect(this,
|
||||
qOverload<const QString &, const QVariant &>(&MxcMediaProxy::metaDataChanged),
|
||||
[this](QString t, QVariant) {
|
||||
[this](const QString &t, const QVariant &) {
|
||||
if (t == QMediaMetaData::Orientation)
|
||||
emit orientationChanged();
|
||||
});
|
||||
|
|
|
@ -137,9 +137,9 @@ Nheko::setTransientParent(QWindow *window, QWindow *parentWindow) const
|
|||
|
||||
void
|
||||
Nheko::createRoom(bool space,
|
||||
QString name,
|
||||
QString topic,
|
||||
QString aliasLocalpart,
|
||||
const QString &name,
|
||||
const QString &topic,
|
||||
const QString &aliasLocalpart,
|
||||
bool isEncrypted,
|
||||
int preset)
|
||||
{
|
||||
|
|
|
@ -57,9 +57,9 @@ public:
|
|||
Q_INVOKABLE void showUserSettingsPage() const;
|
||||
Q_INVOKABLE void logout() const;
|
||||
Q_INVOKABLE void createRoom(bool space,
|
||||
QString name,
|
||||
QString topic,
|
||||
QString aliasLocalpart,
|
||||
const QString &name,
|
||||
const QString &topic,
|
||||
const QString &aliasLocalpart,
|
||||
bool isEncrypted,
|
||||
int preset);
|
||||
Q_INVOKABLE PowerlevelEditingModels *editPowerlevels(QString room_id_) const
|
||||
|
|
|
@ -35,14 +35,14 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent)
|
|||
"global",
|
||||
"override",
|
||||
roomid_.toStdString(),
|
||||
[this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr &err) {
|
||||
[this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr err) {
|
||||
if (err) {
|
||||
if (err->status_code == 404)
|
||||
http::client()->get_pushrules(
|
||||
"global",
|
||||
"room",
|
||||
roomid_.toStdString(),
|
||||
[this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr &err) {
|
||||
[this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr err) {
|
||||
if (err) {
|
||||
notifications_ = 2; // all messages
|
||||
emit notificationsChanged();
|
||||
|
@ -424,7 +424,7 @@ RoomSettings::changeAccessRules(bool private_,
|
|||
}
|
||||
|
||||
void
|
||||
RoomSettings::changeName(QString name)
|
||||
RoomSettings::changeName(const QString &name)
|
||||
{
|
||||
// Check if the values are changed from the originals.
|
||||
auto newName = name.trimmed().toStdString();
|
||||
|
@ -435,7 +435,7 @@ RoomSettings::changeName(QString name)
|
|||
|
||||
using namespace mtx::events;
|
||||
auto proxy = std::make_shared<ThreadProxy>();
|
||||
connect(proxy.get(), &ThreadProxy::nameEventSent, this, [this](QString newRoomName) {
|
||||
connect(proxy.get(), &ThreadProxy::nameEventSent, this, [this](const QString &newRoomName) {
|
||||
this->info_.name = newRoomName.toStdString();
|
||||
emit roomNameChanged();
|
||||
});
|
||||
|
@ -458,7 +458,7 @@ RoomSettings::changeName(QString name)
|
|||
}
|
||||
|
||||
void
|
||||
RoomSettings::changeTopic(QString topic)
|
||||
RoomSettings::changeTopic(const QString &topic)
|
||||
{
|
||||
// Check if the values are changed from the originals.
|
||||
auto newTopic = topic.trimmed().toStdString();
|
||||
|
@ -469,7 +469,7 @@ RoomSettings::changeTopic(QString topic)
|
|||
|
||||
using namespace mtx::events;
|
||||
auto proxy = std::make_shared<ThreadProxy>();
|
||||
connect(proxy.get(), &ThreadProxy::topicEventSent, this, [this](QString newRoomTopic) {
|
||||
connect(proxy.get(), &ThreadProxy::topicEventSent, this, [this](const QString &newRoomTopic) {
|
||||
this->info_.topic = newRoomTopic.toStdString();
|
||||
emit roomTopicChanged();
|
||||
});
|
||||
|
|
|
@ -138,8 +138,8 @@ public:
|
|||
bool knockingAllowed,
|
||||
bool restrictedAllowed);
|
||||
Q_INVOKABLE void changeNotifications(int currentIndex);
|
||||
Q_INVOKABLE void changeTopic(QString topic);
|
||||
Q_INVOKABLE void changeName(QString name);
|
||||
Q_INVOKABLE void changeTopic(const QString &topic);
|
||||
Q_INVOKABLE void changeName(const QString &name);
|
||||
|
||||
Q_INVOKABLE void applyAllowedFromModel();
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ UIA::genericHandler(QString context)
|
|||
}
|
||||
|
||||
void
|
||||
UIA::continuePassword(QString password)
|
||||
UIA::continuePassword(const QString &password)
|
||||
{
|
||||
mtx::user_interactive::auth::Password p{};
|
||||
p.identifier_type = mtx::user_interactive::auth::Password::UserId;
|
||||
|
@ -176,7 +176,7 @@ UIA::continuePassword(QString password)
|
|||
}
|
||||
|
||||
void
|
||||
UIA::continueEmail(QString email)
|
||||
UIA::continueEmail(const QString &email)
|
||||
{
|
||||
mtx::requests::RequestEmailToken r{};
|
||||
r.client_secret = this->client_secret = mtx::client::utils::random_token(128, false);
|
||||
|
@ -207,7 +207,7 @@ UIA::continueEmail(QString email)
|
|||
});
|
||||
}
|
||||
void
|
||||
UIA::continuePhoneNumber(QString countryCode, QString phoneNumber)
|
||||
UIA::continuePhoneNumber(const QString &countryCode, const QString &phoneNumber)
|
||||
{
|
||||
mtx::requests::RequestMSISDNToken r{};
|
||||
r.client_secret = this->client_secret = mtx::client::utils::random_token(128, false);
|
||||
|
@ -257,7 +257,7 @@ UIA::continue3pidReceived()
|
|||
}
|
||||
|
||||
void
|
||||
UIA::submit3pidToken(QString token)
|
||||
UIA::submit3pidToken(const QString &token)
|
||||
{
|
||||
mtx::requests::IdentitySubmitToken t{};
|
||||
t.client_secret = this->client_secret;
|
||||
|
|
|
@ -28,10 +28,10 @@ public:
|
|||
QString title() const { return title_; }
|
||||
|
||||
public slots:
|
||||
void continuePassword(QString password);
|
||||
void continueEmail(QString email);
|
||||
void continuePhoneNumber(QString countryCode, QString phoneNumber);
|
||||
void submit3pidToken(QString token);
|
||||
void continuePassword(const QString &password);
|
||||
void continueEmail(const QString &email);
|
||||
void continuePhoneNumber(const QString &countryCode, const QString &phoneNumber);
|
||||
void submit3pidToken(const QString &token);
|
||||
void continue3pidReceived();
|
||||
|
||||
signals:
|
||||
|
|
|
@ -21,18 +21,17 @@
|
|||
#include "timeline/TimelineViewManager.h"
|
||||
#include "ui/UIA.h"
|
||||
|
||||
UserProfile::UserProfile(QString roomid,
|
||||
QString userid,
|
||||
UserProfile::UserProfile(const QString &roomid,
|
||||
const QString &userid,
|
||||
TimelineViewManager *manager_,
|
||||
TimelineModel *parent)
|
||||
: QObject(parent)
|
||||
, roomid_(roomid)
|
||||
, userid_(userid)
|
||||
, globalAvatarUrl{QLatin1String("")}
|
||||
, manager(manager_)
|
||||
, model(parent)
|
||||
{
|
||||
globalAvatarUrl = QLatin1String("");
|
||||
|
||||
connect(this,
|
||||
&UserProfile::globalUsernameRetrieved,
|
||||
this,
|
||||
|
@ -325,7 +324,7 @@ UserProfile::startChat()
|
|||
}
|
||||
|
||||
void
|
||||
UserProfile::changeUsername(QString username)
|
||||
UserProfile::changeUsername(const QString &username)
|
||||
{
|
||||
if (isGlobalUserProfile()) {
|
||||
// change global
|
||||
|
@ -349,7 +348,7 @@ UserProfile::changeUsername(QString username)
|
|||
}
|
||||
|
||||
void
|
||||
UserProfile::changeDeviceName(QString deviceID, QString deviceName)
|
||||
UserProfile::changeDeviceName(const QString &deviceID, const QString &deviceName)
|
||||
{
|
||||
http::client()->set_device_name(
|
||||
deviceID.toStdString(), deviceName.toStdString(), [this](mtx::http::RequestErr err) {
|
||||
|
@ -372,7 +371,7 @@ UserProfile::verify(QString device)
|
|||
}
|
||||
|
||||
void
|
||||
UserProfile::unverify(QString device)
|
||||
UserProfile::unverify(const QString &device)
|
||||
{
|
||||
cache::markDeviceUnverified(userid_.toStdString(), device.toStdString());
|
||||
}
|
||||
|
|
|
@ -134,8 +134,8 @@ class UserProfile : public QObject
|
|||
Q_PROPERTY(bool isSelf READ isSelf CONSTANT)
|
||||
Q_PROPERTY(TimelineModel *room READ room CONSTANT)
|
||||
public:
|
||||
UserProfile(QString roomid,
|
||||
QString userid,
|
||||
UserProfile(const QString &roomid,
|
||||
const QString &userid,
|
||||
TimelineViewManager *manager_,
|
||||
TimelineModel *parent = nullptr);
|
||||
|
||||
|
@ -152,7 +152,7 @@ public:
|
|||
TimelineModel *room() const { return model; }
|
||||
|
||||
Q_INVOKABLE void verify(QString device = QLatin1String(""));
|
||||
Q_INVOKABLE void unverify(QString device = QLatin1String(""));
|
||||
Q_INVOKABLE void unverify(const QString &device = QLatin1String(""));
|
||||
Q_INVOKABLE void fetchDeviceList(const QString &userID);
|
||||
Q_INVOKABLE void refreshDevices();
|
||||
Q_INVOKABLE void banUser();
|
||||
|
@ -161,8 +161,8 @@ public:
|
|||
Q_INVOKABLE void kickUser();
|
||||
Q_INVOKABLE void startChat();
|
||||
Q_INVOKABLE void startChat(bool encryptionEnabled);
|
||||
Q_INVOKABLE void changeUsername(QString username);
|
||||
Q_INVOKABLE void changeDeviceName(QString deviceID, QString deviceName);
|
||||
Q_INVOKABLE void changeUsername(const QString &username);
|
||||
Q_INVOKABLE void changeDeviceName(const QString &deviceID, const QString &deviceName);
|
||||
Q_INVOKABLE void changeAvatar();
|
||||
Q_INVOKABLE void openGlobalProfile();
|
||||
|
||||
|
|
Loading…
Reference in a new issue