Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take ints by value rather than reference in UserModel methods #4712

Merged
merged 1 commit into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/gui/tray/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,15 +905,15 @@ Q_INVOKABLE int UserModel::currentUserId() const
return _currentUserId;
}

Q_INVOKABLE bool UserModel::isUserConnected(const int &id)
Q_INVOKABLE bool UserModel::isUserConnected(const int id)
{
if (id < 0 || id >= _users.size())
return false;

return _users[id]->isConnected();
}

QImage UserModel::avatarById(const int &id)
QImage UserModel::avatarById(const int id)
{
if (id < 0 || id >= _users.size())
return {};
Expand Down Expand Up @@ -1014,7 +1014,7 @@ Q_INVOKABLE void UserModel::openCurrentAccountServer()
QDesktopServices::openUrl(url);
}

Q_INVOKABLE void UserModel::switchCurrentUser(const int &id)
Q_INVOKABLE void UserModel::switchCurrentUser(const int id)
{
if (_currentUserId < 0 || _currentUserId >= _users.size())
return;
Expand All @@ -1025,23 +1025,23 @@ Q_INVOKABLE void UserModel::switchCurrentUser(const int &id)
emit newUserSelected();
}

Q_INVOKABLE void UserModel::login(const int &id)
Q_INVOKABLE void UserModel::login(const int id)
{
if (id < 0 || id >= _users.size())
return;

_users[id]->login();
}

Q_INVOKABLE void UserModel::logout(const int &id)
Q_INVOKABLE void UserModel::logout(const int id)
{
if (id < 0 || id >= _users.size())
return;

_users[id]->logout();
}

Q_INVOKABLE void UserModel::removeAccount(const int &id)
Q_INVOKABLE void UserModel::removeAccount(const int id)
{
if (id < 0 || id >= _users.size())
return;
Expand Down
12 changes: 6 additions & 6 deletions src/gui/tray/usermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class UserModel : public QAbstractListModel

QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

QImage avatarById(const int &id);
QImage avatarById(const int id);

User *currentUser() const;

Expand All @@ -173,11 +173,11 @@ class UserModel : public QAbstractListModel
Q_INVOKABLE int numUsers();
Q_INVOKABLE QString currentUserServer();
int currentUserId() const;
Q_INVOKABLE bool isUserConnected(const int &id);
Q_INVOKABLE void switchCurrentUser(const int &id);
Q_INVOKABLE void login(const int &id);
Q_INVOKABLE void logout(const int &id);
Q_INVOKABLE void removeAccount(const int &id);
Q_INVOKABLE bool isUserConnected(const int id);
Q_INVOKABLE void switchCurrentUser(const int id);
Q_INVOKABLE void login(const int id);
Q_INVOKABLE void logout(const int id);
Q_INVOKABLE void removeAccount(const int id);

Q_INVOKABLE std::shared_ptr<OCC::UserStatusConnector> userStatusConnector(int id);

Expand Down