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:
Loren Burkholder 2022-10-03 17:57:30 -04:00 committed by GitHub
parent 5e9eb845ab
commit 8ecbb39dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 162 additions and 146 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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