diff options
author | Loren Burkholder <55629213+LorenDB@users.noreply.github.com> | 2022-10-03 17:57:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 21:57:30 +0000 |
commit | 8ecbb39dc6303fcf3ae36ad033d7e90ea29b9003 (patch) | |
tree | ccbf44824e2a038254ce77ae3890d2d6d86b0a94 /src/ui | |
parent | Merge pull request #1202 from Nheko-Reborn/grammar (diff) | |
download | nheko-8ecbb39dc6303fcf3ae36ad033d7e90ea29b9003.tar.xz |
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>
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/MxcMediaProxy.cpp | 2 | ||||
-rw-r--r-- | src/ui/NhekoGlobalObject.cpp | 6 | ||||
-rw-r--r-- | src/ui/NhekoGlobalObject.h | 6 | ||||
-rw-r--r-- | src/ui/RoomSettings.cpp | 12 | ||||
-rw-r--r-- | src/ui/RoomSettings.h | 4 | ||||
-rw-r--r-- | src/ui/UIA.cpp | 8 | ||||
-rw-r--r-- | src/ui/UIA.h | 8 | ||||
-rw-r--r-- | src/ui/UserProfile.cpp | 13 | ||||
-rw-r--r-- | src/ui/UserProfile.h | 10 |
9 files changed, 34 insertions, 35 deletions
diff --git a/src/ui/MxcMediaProxy.cpp b/src/ui/MxcMediaProxy.cpp index 96ef89b5..3676a74e 100644 --- a/src/ui/MxcMediaProxy.cpp +++ b/src/ui/MxcMediaProxy.cpp @@ -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(); }); diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp index b24e68a9..0573d5ee 100644 --- a/src/ui/NhekoGlobalObject.cpp +++ b/src/ui/NhekoGlobalObject.cpp @@ -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) { diff --git a/src/ui/NhekoGlobalObject.h b/src/ui/NhekoGlobalObject.h index e9034ebc..77ec50d7 100644 --- a/src/ui/NhekoGlobalObject.h +++ b/src/ui/NhekoGlobalObject.h @@ -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 diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp index 9b81e777..546cda29 100644 --- a/src/ui/RoomSettings.cpp +++ b/src/ui/RoomSettings.cpp @@ -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(); }); diff --git a/src/ui/RoomSettings.h b/src/ui/RoomSettings.h index 35698310..f4aa664d 100644 --- a/src/ui/RoomSettings.h +++ b/src/ui/RoomSettings.h @@ -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(); diff --git a/src/ui/UIA.cpp b/src/ui/UIA.cpp index 93fd6c94..d67d1ba9 100644 --- a/src/ui/UIA.cpp +++ b/src/ui/UIA.cpp @@ -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; diff --git a/src/ui/UIA.h b/src/ui/UIA.h index 9c10dade..a97df4ac 100644 --- a/src/ui/UIA.h +++ b/src/ui/UIA.h @@ -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: diff --git a/src/ui/UserProfile.cpp b/src/ui/UserProfile.cpp index bd02b308..a3bc87de 100644 --- a/src/ui/UserProfile.cpp +++ b/src/ui/UserProfile.cpp @@ -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()); } diff --git a/src/ui/UserProfile.h b/src/ui/UserProfile.h index 1675c0e5..90e39b89 100644 --- a/src/ui/UserProfile.h +++ b/src/ui/UserProfile.h @@ -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(); |